Skip to content

Commit

Permalink
Merge pull request #113 from sanity/classifiers
Browse files Browse the repository at this point in the history
sped up optimizer
  • Loading branch information
athawk81 committed Mar 30, 2015
2 parents a572f38 + 82c2b99 commit 79d39ce
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
be accompanied by a bump in version number, regardless of how minor the change.
-->

<version>0.7.8</version>
<version>0.7.9</version>
<repositories>
<repository>
<id>sanity-maven-repo</id>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static <T extends ClassifierInstance> Pair<Map<String, Object>, Downsampl
.dataCycler(outOfTimeData)
.lossChecker(classifierInstanceClassifierLossChecker)
.valuesToTest(config)
.iterations(4).build();
.iterations(3).build();
Map<String, Object> bestParams = optimizer.determineOptimalConfig();

RandomForestBuilder<T> randomForestBuilder = new RandomForestBuilder<T>(new TreeBuilder<T>().attributeIgnoringStrategy(new IgnoreAttributesWithConstantProbability(0.7))).numTrees(24);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ private void updateBestConfig() {
private void findBestValueForField(String field) {
FieldLosses losses = new FieldLosses();
FieldValueRecommender fieldValueRecommender = valuesToTest.get(field);
if (fieldValueRecommender.getValues().size() == 1) {
return;
}
//bestConfig is not actually bestConfig inth for loop
for (Object value : fieldValueRecommender.getValues()) {
//TODO: make so it does not repeat a conf already seen in present iteration (e.g. keep a set of configs)
if (bestConfig.get(field).equals(value)) {
continue;
}
bestConfig.put(field, value);
losses.addFieldLoss(value, crossValidator.getLossForModel(bestConfig));
if (!fieldValueRecommender.shouldContinue(losses.getLosses()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.beust.jcommander.internal.Sets;
import com.google.common.collect.Maps;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import quickml.data.ClassifierInstance;
import quickml.data.OnespotDateTimeExtractor;
Expand Down Expand Up @@ -44,7 +45,7 @@ public void setUp() throws Exception {
.build();
}


@Ignore
@Test
public void testOptimizer() throws Exception {
System.out.println("optimalConfig = " + optimizer.determineOptimalConfig());
Expand Down

0 comments on commit 79d39ce

Please sign in to comment.