-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Implement UpliftDRF MOJO.
- Loading branch information
Showing
30 changed files
with
617 additions
and
167 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
23 changes: 23 additions & 0 deletions
23
h2o-algos/src/main/java/hex/tree/uplift/UpliftDrfMojoWriter.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package hex.tree.uplift; | ||
|
||
import hex.tree.SharedTreeMojoWriter; | ||
|
||
import java.io.IOException; | ||
|
||
public class UpliftDrfMojoWriter extends SharedTreeMojoWriter<UpliftDRFModel, UpliftDRFModel.UpliftDRFParameters, UpliftDRFModel.UpliftDRFOutput> { | ||
|
||
@SuppressWarnings("unused") // Called through reflection in ModelBuildersHandler | ||
public UpliftDrfMojoWriter() {} | ||
|
||
public UpliftDrfMojoWriter(UpliftDRFModel model) { super(model); } | ||
|
||
@Override public String mojoVersion() { | ||
return "1.40"; | ||
} | ||
|
||
@Override | ||
protected void writeModelData() throws IOException { | ||
super.writeModelData(); | ||
writekv("default_auuc_thresholds", model._output._defaultAuucThresholds); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
h2o-algos/src/main/java/hex/tree/uplift/UpliftDrfPojoWriter.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hex.tree.uplift; | ||
|
||
import hex.Model; | ||
import hex.genmodel.CategoricalEncoding; | ||
import hex.tree.CompressedTree; | ||
import hex.tree.SharedTreePojoWriter; | ||
import water.util.SBPrintStream; | ||
|
||
public class UpliftDrfPojoWriter extends SharedTreePojoWriter { | ||
|
||
UpliftDrfPojoWriter(UpliftDRFModel model, CompressedTree[][] trees) { | ||
super(model._key, model._output, model.getGenModelEncoding(), model.binomialOpt(), | ||
trees, model._output._treeStats); | ||
} | ||
|
||
UpliftDrfPojoWriter(Model<?, ?, ?> model, CategoricalEncoding encoding, | ||
boolean binomialOpt, CompressedTree[][] trees, | ||
boolean balanceClasses) { | ||
super(model._key, model._output, encoding, binomialOpt, trees, null); | ||
} | ||
|
||
@Override | ||
protected void toJavaUnifyPreds(SBPrintStream body) { | ||
body.ip("preds[1] /= " + _trees.length + ";").nl(); | ||
body.ip("preds[2] /= " + _trees.length + ";").nl(); | ||
body.ip("preds[0] = preds[1] - preds[2]"); | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.