Changeset 34797
- Timestamp:
- 2021-02-02T22:28:26+13:00 (3 years ago)
- Location:
- main/trunk/model-sites-dev/mars
- Files:
-
- 3 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/mars/RUN-APPLY-VALENCE-MODEL.sh
r34788 r34797 2 2 3 3 input_data_filename=${1:-collect/deam/etc/deam-essentia-features-arousal-valence.arff} 4 output_data_filename=${2:-predicted-val ance.csv}4 output_data_filename=${2:-predicted-valence.csv} 5 5 6 6 . ./_set_weka_classpath.bash 7 7 8 java -cp "$cp_args" org.greenstone.mars.WekaApplyVal anceModel \9 "reptree-val ance-serialized.model" \8 java -cp "$cp_args" org.greenstone.mars.WekaApplyValenceModel \ 9 "reptree-valence-serialized.model" \ 10 10 "$input_data_filename" \ 11 11 "$output_data_filename" -
main/trunk/model-sites-dev/mars/RUN-TRAIN-VALENCE-MODEL.sh
r34788 r34797 3 3 . ./_set_weka_classpath.bash 4 4 5 java -cp "$cp_args" org.greenstone.mars.WekaTrainVal anceModel \5 java -cp "$cp_args" org.greenstone.mars.WekaTrainValenceModel \ 6 6 "collect/deam/etc/deam-essentia-features-arousal-valence.arff" \ 7 "reptree-val ance-serialized.model"7 "reptree-valence-serialized.model" 8 8 9 9 -
main/trunk/model-sites-dev/mars/src/java/org/greenstone/mars/WekaApplyArousalModel.java
r34788 r34797 87 87 // Dealing with ground-truth data: 88 88 // => already has 'arousal' attribute 89 // => in fact has 'val ance' attribute too, which we want to remove89 // => in fact has 'valence' attribute too, which we want to remove 90 90 91 unlabeled_instances = WekaUtil.applyFilter(unlabeled_instances,"472"); // top-up with removal of 'val ance'91 unlabeled_instances = WekaUtil.applyFilter(unlabeled_instances,"472"); // top-up with removal of 'valence' 92 92 93 93 // reference share this as 'groundtruth_instances' to trigger error calculation and output -
main/trunk/model-sites-dev/mars/src/java/org/greenstone/mars/WekaApplyValenceModel.java
r34788 r34797 26 26 // https://waikato.github.io/weka-wiki/use_weka_in_your_java_code/ 27 27 28 class WekaApplyVal anceModel28 class WekaApplyValenceModel 29 29 { 30 30 … … 47 47 // to trigger calculating the error on the predicted vaues 48 48 49 boolean has_groundtruth_data = WekaUtil.instancesHavePredictAttribute(unlabeled_instances,WekaUtil.VAL ANCE_ATTRIBUTE_NAME);49 boolean has_groundtruth_data = WekaUtil.instancesHavePredictAttribute(unlabeled_instances,WekaUtil.VALENCE_ATTRIBUTE_NAME); 50 50 51 51 // The following deals with (i) internally, ensuring that what is returned is suitable for making predictions on 52 52 Instances filtered_unlabeled_instances 53 53 = WekaUtil.filterInstancesForApplying(unlabeled_instances,has_groundtruth_data, 54 WekaUtil.VAL ANCE_ATTRIBUTE_NAME,"471");54 WekaUtil.VALENCE_ATTRIBUTE_NAME,"471"); 55 55 56 56 // The following deals with (ii) -
main/trunk/model-sites-dev/mars/src/java/org/greenstone/mars/WekaTrainArousalModel.java
r34788 r34797 48 48 String output_model_filename = args[1]; 49 49 50 // knock out 472 (val ance) from dataset50 // knock out 472 (valence) from dataset 51 51 Instances filtered_data_instances = WekaUtil.loadAndFilterDataInstances(input_data_filename, "472"); 52 52 Classifier classifier = WekaUtil.trainREPTree(filtered_data_instances); … … 73 73 74 74 // ********* 75 Instances filtered_data_instances = WekaUtil.applyFilter(data_instances,"472"); // top-up with removal of 'val ance'75 Instances filtered_data_instances = WekaUtil.applyFilter(data_instances,"472"); // top-up with removal of 'valence' 76 76 77 77 -
main/trunk/model-sites-dev/mars/src/java/org/greenstone/mars/WekaTrainValenceModel.java
r34788 r34797 15 15 16 16 17 class WekaTrainVal anceModel17 class WekaTrainValenceModel 18 18 { 19 19 // Scheme: weka.classifiers.trees.REPTree -M 2 -V 0.001 -N 3 -S 1 -L -1 -I 0.0 -- (i.e., default vals) -
main/trunk/model-sites-dev/mars/src/java/org/greenstone/mars/WekaUtil.java
r34788 r34797 31 31 { 32 32 public final static String AROUSAL_ATTRIBUTE_NAME = "arousal_sample_26500ms"; 33 public final static String VAL ANCE_ATTRIBUTE_NAME = "valence_sample_26500ms";33 public final static String VALENCE_ATTRIBUTE_NAME = "valence_sample_26500ms"; 34 34 35 35 … … 76 76 // top up, 77 77 // e.g. '471' representing arousal in ground-truth files 78 // e.g. '472' representing val ance in ground-truth files78 // e.g. '472' representing valence in ground-truth files 79 79 remove_option_args += "," + additional_remove; 80 80 } … … 84 84 try { 85 85 // remove ordinal attributes and any additional topups, 86 // such as 'val ance' (when predicting 'arousal') and vice versa86 // such as 'valence' (when predicting 'arousal') and vice versa 87 87 88 88 String[] filter_options = weka.core.Utils.splitOptions(remove_option_args); … … 109 109 DataSource gt_data_source = new DataSource(gt_datasource_filename); 110 110 Instances gt_instances = gt_data_source.getDataSet(); 111 gt_instances = applyFilter(gt_instances,additional_remove); // remove 'val ance' or 'arousal'111 gt_instances = applyFilter(gt_instances,additional_remove); // remove 'valence' or 'arousal' 112 112 113 113 gt_instances.setClassIndex(gt_instances.numAttributes() - 1); … … 138 138 Instances data_instances = data_source.getDataSet(); 139 139 140 // Training dataset has two ground-truth attributes: 'arousal' and 'val ance'.140 // Training dataset has two ground-truth attributes: 'arousal' and 'valence'. 141 141 // When training for one, need to knock out the other. This is the purpose 142 142 // of 'additional_attribute_remove' … … 265 265 else { 266 266 // Dealing with ground-truth data: 267 // => already has 'arousal' and 'val ance' attributes267 // => already has 'arousal' and 'valence' attributes 268 268 // => need to keep the 'predict_attribute_name' and remove the other one 269 269 // => (its -R value of which is specified in 'additional_attribute_remove')
Note:
See TracChangeset
for help on using the changeset viewer.