Last active
          December 10, 2015 04:26 
        
      - 
      
- 
        Save furkantektas/c5308b2a7cf82a004d40 to your computer and use it in GitHub Desktop. 
    Batch classification for Weka 3.7+
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/sh | |
| # This script assumes that the working directory contains 20 training and test arff files | |
| # with prefix training- and test-, respectively. It trains a model using RotationForest (with | |
| # default parameters) and saves the statistical data to results-n.arff where n is the number of | |
| # trainig file. | |
| # Then it prints out the correctly classified instances information to all-results.txt | |
| for i in {1..20}; do | |
| trainingf=(training-$i*) | |
| testf=(test-$i*) | |
| resultsf="results-$i.arff" | |
| if [ -e "$trainingf" ] && [ -e "$testf" ]; then | |
| echo "Test $i" | |
| java -cp $WEKA_HOME/weka.jar weka.Run InputMappedClassifier -I -trim -o -v -t $trainingf -T $testf -W weka.classifiers.meta.RotationForest -- -G 3 -H 3 -P 50 -F "weka.filters.unsupervised.attribute.PrincipalComponents -R 1.0 -A 5 -M -1" -S 1 -num-slots 1 -I 10 -W weka.classifiers.trees.J48 -- -C 0.25 -M 2 > $resultsf 2> $resultsf | |
| echo "Test $i\t" >> all-results.txt | |
| grep "Correct.*\d\(.*\)\s%$" $resultsf >> all-results.txt | |
| fi | |
| done | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment