Changeset 42
- Timestamp:
- 11/13/15 18:09:46 (9 years ago)
- Location:
- trunk/CrossPare/src/de/ugoe/cs/cpdp
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaBaseTraining.java
r41 r42 56 56 classifierParams = Arrays.copyOfRange(params, 2, params.length); 57 57 58 classifier = setupClassifier();58 //classifier = setupClassifier(); 59 59 } 60 60 … … 64 64 } 65 65 66 p ublicClassifier setupClassifier() {66 protected Classifier setupClassifier() { 67 67 Classifier cl = null; 68 68 try { -
trunk/CrossPare/src/de/ugoe/cs/cpdp/training/WekaTraining.java
r41 r42 21 21 22 22 import de.ugoe.cs.util.console.Console; 23 import weka.classifiers.rules.ZeroR; 23 24 import weka.core.Instances; 24 25 … … 46 47 @Override 47 48 public void apply(Instances traindata) { 49 classifier = setupClassifier(); 48 50 PrintStream errStr = System.err; 49 51 System.setErr(new PrintStream(new NullOutputStream())); … … 55 57 } 56 58 catch (Exception e) { 57 throw new RuntimeException(e); 59 if (e.getMessage().contains("Not enough training instances with class labels")) { 60 Console.traceln(Level.SEVERE, 61 "failure due to lack of instances: " + e.getMessage()); 62 Console.traceln(Level.SEVERE, "training ZeroR classifier instead"); 63 classifier = new ZeroR(); 64 try { 65 classifier.buildClassifier(traindata); 66 } 67 catch (Exception e2) { 68 throw new RuntimeException(e2); 69 } 70 } 71 else { 72 throw new RuntimeException(e); 73 } 58 74 } 59 75 finally {
Note: See TracChangeset
for help on using the changeset viewer.