<commit_before>package roart.ml;

import java.util.List;
import java.util.Map;

import roart.indicator.Indicator;
import roart.indicator.IndicatorMACD;
import roart.util.Constants;

public class MLSparkLRModel  extends MLSparkModel {
    @Override
    public int getId() {
        return 2;
    }
    @Override
    public String getName() {
        return "LR";
    }

    @Override
    public int addTitles(Object[] objs, int retindex, Indicator indicator, String title, String key, String subType, List<Integer> typeList0, Map<Integer, String> mapTypes0, MLDao dao) {
        retindex = super.addTitles(objs, retindex, indicator,title, key, subType, typeList0, mapTypes0, dao);
        //objs[retindex++] = title + Constants.WEBBR + subType + name + " prob";
        List<Integer> typeList = indicator.getTypeList();
        Map<Integer, String> mapTypes = indicator.getMapTypes();
       for (int mapTypeInt : typeList) {
             String mapType = mapTypes.get(mapTypeInt);
            String val = "";
            //String lr = "" + DbSpark.eval("LogisticRegression ", title, "common");
            String lr = "";
            //val = "" + roundme(dao.eval(id, key, mapType));
            objs[retindex++] = title + Constants.WEBBR +  subType + getName() + mapType + " prob ";
        }
        return retindex;
    }

    @Override
    public int addResults(Object[] fields, int retindex, String id, MLModel model, Indicator indicator, Map<String, Map<String, Double[]>> mapResult, Map<Double, String> labelMapShort) {
    //        public int addResults(Object[] fields, int retindex, String id, Map<Integer, Map<String, Double[]>> commonIdTypeModelHistMap, String subType, List<Integer> typeList, Map<Integer, String> mapTypes) {
        retindex = super.addResults(fields, retindex, id, model, indicator, mapResult, labelMapShort);
        //fields[retindex++] = type != null ? labelMapShort.get(type[1]) : null;                   
        List<Integer> typeList = indicator.getTypeList();
        Map<Integer, String> mapTypes = indicator.getMapTypes();
        for (int mapTypeInt : typeList) {
            String mapType = mapTypes.get(mapTypeInt);
            Map<String, Double[]> resultMap1 = mapResult.get(mapType);
            Double[] type = resultMap1.get(id);
            fields[retindex++] = type != null ? labelMapShort.get(type[1]) : null;
        }
                
                return retindex;
     }
    
    @Override
    public int getSizes(Indicator indicator) { 
        return 2 * super.getSizes(indicator);
    }
}
<commit_msg>Do not use labels with probability.<commit_after>package roart.ml;

import java.util.List;
import java.util.Map;

import roart.indicator.Indicator;
import roart.indicator.IndicatorMACD;
import roart.util.Constants;

public class MLSparkLRModel  extends MLSparkModel {
    @Override
    public int getId() {
        return 2;
    }
    @Override
    public String getName() {
        return "LR";
    }

    @Override
    public int addTitles(Object[] objs, int retindex, Indicator indicator, String title, String key, String subType, List<Integer> typeList0, Map<Integer, String> mapTypes0, MLDao dao) {
        retindex = super.addTitles(objs, retindex, indicator,title, key, subType, typeList0, mapTypes0, dao);
        //objs[retindex++] = title + Constants.WEBBR + subType + name + " prob";
        List<Integer> typeList = indicator.getTypeList();
        Map<Integer, String> mapTypes = indicator.getMapTypes();
       for (int mapTypeInt : typeList) {
             String mapType = mapTypes.get(mapTypeInt);
            String val = "";
            //String lr = "" + DbSpark.eval("LogisticRegression ", title, "common");
            String lr = "";
            //val = "" + roundme(dao.eval(id, key, mapType));
            objs[retindex++] = title + Constants.WEBBR +  subType + getName() + mapType + " prob ";
        }
        return retindex;
    }

    @Override
    public int addResults(Object[] fields, int retindex, String id, MLModel model, Indicator indicator, Map<String, Map<String, Double[]>> mapResult, Map<Double, String> labelMapShort) {
    //        public int addResults(Object[] fields, int retindex, String id, Map<Integer, Map<String, Double[]>> commonIdTypeModelHistMap, String subType, List<Integer> typeList, Map<Integer, String> mapTypes) {
        retindex = super.addResults(fields, retindex, id, model, indicator, mapResult, labelMapShort);
        //fields[retindex++] = type != null ? labelMapShort.get(type[1]) : null;                   
        List<Integer> typeList = indicator.getTypeList();
        Map<Integer, String> mapTypes = indicator.getMapTypes();
        for (int mapTypeInt : typeList) {
            String mapType = mapTypes.get(mapTypeInt);
            Map<String, Double[]> resultMap1 = mapResult.get(mapType);
            Double[] type = resultMap1.get(id);
            fields[retindex++] = type != null ? type[1] : null;
        }
                
                return retindex;
     }
    
    @Override
    public int getSizes(Indicator indicator) { 
        return 2 * super.getSizes(indicator);
    }
}

{'fraction_non_alphanumeric': 0.12035053554040896, 'fraction_numerical': 0.0038948393378773127, 'mean_word_length': 2.776470588235294, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3740960', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1509, 'n_words': 385}