Diff of /src/biodiscml/demo.java [000000] .. [ce076b]

Switch to unified view

a b/src/biodiscml/demo.java
1
/*
2
 *
3
 */
4
package biodiscml;
5
6
import java.io.FileWriter;
7
import java.io.PrintWriter;
8
import java.util.HashMap;
9
10
/**
11
 *
12
 * @author mik
13
 */
14
public class demo {
15
16
    // public static String folder = "/home/mickael/ownCloud/";
17
    public static String folder = "E:\\cloud\\";
18
    // public static String folder = "C:\\Users\\Mickael\\ownCloud\\";
19
20
    public static void main(String[] args) {
21
        System.out.println("=== Demo mode ===");
22
        //trainingExecution();
23
        //testingExecution();
24
        bestModel();
25
        //benchmark();
26
    }
27
28
    private static void trainingExecution() {
29
        try {
30
            //String s[] = {"-config " + folder + "Data\\TCGA_PRAD\\datamining\\config.conf -train"};
31
            //String s[] = {"-config " + folder + "Data\\TCGA_PRAD\\datamining\\time\\config.conf -train"};
32
            //String s[] = {"-config " + folder + "Projects/loreal/VESPA/datamining//config_vespa.conf -train"};
33
            //String s[] = {"-config " + folder + "/Projects/Benjamin/Collaboration-CHUL-Quebec/1_Prostate/READY_TO_USE_for_Brute_force_X/datamining/2_Genes+clinic/config.conf -train"};
34
35
            //String s[] = {"-config config_example_2class.conf -train"};
36
            String s[] = {"-config " + folder + "Code\\BruteForceML\\benchmark\\CNS_test/config.conf -train"};
37
            //String s[] = {"-config " + folder + "Code/BruteForceML/benchmark/Benjamin_signature/config.conf -train"};
38
            //String s[] = {"-config " + folder + "Projects\\bacteria\\datamining\\config.conf -train"};
39
            Main.main(s);
40
        } catch (Exception e) {
41
            e.printStackTrace();
42
        }
43
    }
44
45
    public static void bestModel() {
46
        Main m = new Main();
47
        //demo Benjamin
48
//        m.wd = folder + "Projects\\Benjamin\\Collaboration - CHUL - Quebec\\1_Prostate\\READY_TO_USE_for_Brute_force_X\\datamining\\";
49
//        m.configFile = m.wd + "config.conf";
50
//        m.setConfiguration();
51
//        m.wd = folder + "Projects\\Benjamin\\Collaboration - CHUL - Quebec\\1_Prostate\\READY_TO_USE_for_Brute_force_X\\datamining\\";
52
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
53
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
54
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
55
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
56
//                "classification");
57
//        //mint
58
//        m.wd = folder + "Code/BruteForceML/benchmark/mint/";
59
//        m.configFile = m.wd + "config.conf";
60
//        m.setConfiguration();
61
//        m.wd = folder + "Code/BruteForceML/benchmark/mint/";
62
//        m.hmTrainingBestModelList.put("trees.RandomForest_AUC_BF_16_0.9571_77", "1");
63
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
64
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
65
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
66
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
67
//                "classification");
68
        //        //mint
69
        m.wd = folder + "Code/BruteForceML/benchmark/CNS_test/";
70
        m.configFile = m.wd + "config.conf";
71
        m.setConfiguration();
72
        m.wd = folder + "Code/BruteForceML/benchmark/CNS_test/";
73
        String CLASSIFICATION_FILE = m.wd + m.project + "a.regression.data_to_train.csv"; // output of Training(), models performances
74
        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.regression.results.csv"; // output of Training(), models performances
75
        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.RELIEFF.csv"; // output of Training(), feature selection result
76
        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
77
                "regression");
78
        //bacteria
79
//        m.wd = folder + "Projects\\bacteria\\datamining\\";
80
//        m.configFile = m.wd + "config.conf";
81
//        m.setConfiguration();
82
//        m.wd = folder + "Projects\\bacteria\\datamining\\";
83
//        m.hmTrainingBestModelList.put("trees.RandomForest_AUC_B_25_0.9531_907", "1");
84
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
85
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
86
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
87
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
88
//                "classification");
89
//        //benjamin
90
//        m.wd = folder + "Code/BruteForceML/benchmark/Benjamin_prostate/";
91
//        m.configFile = m.wd + "config.conf";
92
//        m.setConfiguration();
93
//        m.wd = folder + "Code/BruteForceML/benchmark/Benjamin_prostate/";
94
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
95
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
96
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
97
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
98
//                "classification");
99
//       //golub
100
//        m.wd = folder + "Code/BruteForceML/benchmark/brain/";
101
//        m.configFile = m.wd + "config.conf";
102
//        m.setConfiguration();
103
//        m.wd = folder + "Code/BruteForceML/benchmark/brain/";
104
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
105
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
106
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
107
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
108
//                "classification");
109
//        //demo dreamchallenge
110
//        m.wd = folder + "Projects\\dreamchallenge\\proteogenomics\\SUB2_ML\\";
111
//        m.configFile = m.wd + "config.conf";
112
//        m.setConfiguration();
113
//        m.wd = folder + "Projects\\dreamchallenge\\proteogenomics\\SUB2_ML\\";
114
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.regression.data_to_train.csv"; // output of Training(), models performances
115
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.regression.results.csv"; // output of Training(), models performances
116
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.RELIEFF.csv"; // output of Training(), feature selection result
117
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
118
//                "regression");
119
        //demo vespa
120
//        m.wd = folder + "Projects\\loreal\\VESPA\\datamining\\";
121
//        m.configFile = m.wd + "config_vespa.conf";
122
//        m.setConfiguration();
123
//        m.wd = folder + "Projects\\loreal\\VESPA\\datamining\\";
124
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
125
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
126
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
127
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
128
//                "classification");
129
        //demo DATA
130
//        m.configFile = "config_example_2class.conf";
131
//        m.setConfiguration();
132
//        m.wd = "";
133
//        String CLASSIFICATION_FILE = m.wd + m.project + "a.classification.data_to_train.csv"; // output of Training(), models performances
134
//        String TRAINING_RESULTS_FILE = m.wd + m.project + "c.classification.results.csv"; // output of Training(), models performances
135
//        String FEATURE_SELECTION_FILE = m.wd + m.project + "b.featureSelection.infoGain.csv"; // output of Training(), feature selection result
136
//        BestModelSelectionAndReport b = new BestModelSelectionAndReport(CLASSIFICATION_FILE, FEATURE_SELECTION_FILE, TRAINING_RESULTS_FILE,
137
//                "classification");
138
    }
139
140
    public static void testingExecution() {
141
        try {
142
//            String s[] = {"-test -model gdx_data_.misc.VFI_-B0.6.txt.model "
143
//                + "-testfiles gdx.545patients.clinical.csv gdx.1742patients.expr.csv "
144
//                //+ "-prefixes clin expr "
145
//                + "-mergingID patient -separator \\t -classification -keyword BCR_sensor"};
146
            String s[] = {"-test -model " + folder + "Data\\TCGA_PRAD\\datamining\\TCGA_BCR_.misc.VFI_-B0.6.txt.model "
147
                + "-testfiles " + folder + "Data\\TCGA_PRAD\\datamining\\geneExpression.log2RUVg.csv"
148
                + " " + folder + "Data\\TCGA_PRAD\\datamining\\clinical_test.csv "
149
                + "-mergingID Patient -separator \\t -classification -keyword BCR_sensor"};
150
            for (String s1 : s) {
151
                System.out.print(s1);
152
            }
153
            System.out.println("");
154
            Main.main(s);
155
        } catch (Exception e) {
156
            e.printStackTrace();
157
        }
158
    }
159
160
    private static void benchmark() {
161
        try {
162
            PrintWriter pw = new PrintWriter(new FileWriter("benchmark_3.txt"));
163
            pw.println("FeaturesLimit\tAUC_Train\tAUC_Test");
164
            for (int i = 5; i <= 200; i = i + 5) {
165
                //train
166
                Main.hmTrainFiles = new HashMap<>();
167
                Main.needConfigFile = true;
168
                Main.testing = false;
169
                Main.training = true;
170
                System.out.println("\n-------------\nTRAIN " + i);
171
                String s[] = {"-config " + folder + "Data\\TCGA_PRAD\\datamining\\config_opt.conf -train"};
172
                Main.maxNumberOfFeaturesInModel = i;
173
                Main.main(s);
174
                String train = Main.bench_AUC;
175
                //test
176
                Main.hmTrainFiles = new HashMap<>();
177
                Main.configFile = "";
178
                Main.needConfigFile = false;
179
                Main.testing = true;
180
                Main.training = false;
181
                Main.project = "outfile";
182
                System.out.println("\n-------------\nTEST " + i);
183
                String s2[] = {"-test -model " + folder + "Data\\TCGA_PRAD\\datamining\\bench_.misc.VFI_-B0.6.txt.model "
184
                    + "-testfiles " + folder + "Data\\TCGA_PRAD\\datamining\\geneExpression.log2RUVg.csv"
185
                    + " " + folder + "Data\\TCGA_PRAD\\datamining\\clinical_test.csv "
186
                    + "-mergingID Patient -separator \\t -classification -keyword BCR_sensor"};
187
                Main.main(s2);
188
                String test = Main.bench_AUC;
189
                pw.println(i + "\t" + train + "\t" + test);
190
                pw.flush();
191
            }
192
        } catch (Exception e) {
193
        }
194
    }
195
196
}