-
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
* eif - scoring of train dataset is working and its ready to test * eif - test final scoring output in java * eif scoring history - implement scoring history and java API for _score_tree_interval * eif scoring history - always add final scoring to the history * eif scoring history - test score_each_iteration and score_tree_interval in java * add posibility to disable training metrics * test that metrics are empty
- Loading branch information
Showing
4 changed files
with
297 additions
and
8 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
36 changes: 36 additions & 0 deletions
36
h2o-algos/src/main/java/hex/tree/isoforextended/ScoreExtendedIsolationForest.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,36 @@ | ||
package hex.tree.isoforextended; | ||
|
||
import hex.tree.isofor.ModelMetricsAnomaly; | ||
import water.MRTask; | ||
import water.fvec.Chunk; | ||
|
||
class ScoreExtendedIsolationForestTask extends MRTask<ScoreExtendedIsolationForestTask> { | ||
private ExtendedIsolationForestModel _model; | ||
|
||
// output | ||
private ModelMetricsAnomaly.MetricBuilderAnomaly _metricsBuilder; | ||
|
||
public ScoreExtendedIsolationForestTask(ExtendedIsolationForestModel _model) { | ||
this._model = _model; | ||
} | ||
|
||
@Override | ||
public void map(Chunk[] cs) { | ||
_metricsBuilder = (ModelMetricsAnomaly.MetricBuilderAnomaly) _model.makeMetricBuilder(null); | ||
double [] preds = new double[2]; | ||
double [] tmp = new double[cs.length]; | ||
for (int row = 0; row < cs[0]._len; row++) { | ||
preds = _model.score0(cs, 0, row, tmp, preds); | ||
_metricsBuilder.perRow(preds, null, _model); | ||
} | ||
} | ||
|
||
@Override | ||
public void reduce(ScoreExtendedIsolationForestTask other) { | ||
_metricsBuilder.reduce(other._metricsBuilder); | ||
} | ||
|
||
public ModelMetricsAnomaly.MetricBuilderAnomaly getMetricsBuilder() { | ||
return _metricsBuilder; | ||
} | ||
} |
Oops, something went wrong.