public abstract class Model<M extends Model<M,P,O>,P extends Model.Parameters,O extends Model.Output> extends Lockable<M>
| Modifier and Type | Class and Description |
|---|---|
static class |
Model.ModelCategory |
static class |
Model.Output
Model-specific output class.
|
static class |
Model.Parameters
Model-specific parameter class.
|
| Modifier and Type | Field and Description |
|---|---|
O |
_output |
P |
_parms |
java.lang.String[] |
_warnings |
long |
training_duration_in_ms
The duration in mS for model training.
|
long |
training_start_time
The start time in mS since the epoch for model training.
|
| Constructor and Description |
|---|
Model(Key selfKey,
P parms,
O output)
Full constructor
|
| Modifier and Type | Method and Description |
|---|---|
Frame[] |
adapt(Frame fr,
boolean exact)
Build an adapted Frame from the given Frame.
|
Frame[] |
adapt(Frame fr,
boolean exact,
boolean haveResponse) |
protected int[][][] |
adapt(java.lang.String[] names,
java.lang.String[][] domains,
boolean exact)
Build an adaption array.
|
void |
addWarning(java.lang.String s) |
long |
checksum()
High-quality 64-bit checksum of the content of the
object.
|
protected ModelMetrics |
computeModelMetrics(long start_time,
Frame frame,
Frame predictions) |
static int[][] |
getDomainMapping(java.lang.String[] modelDom,
java.lang.String[] colDom,
boolean exact)
Returns a mapping between values of model domains (
modelDom) and given column domain. |
static int[][] |
getDomainMapping(java.lang.String colName,
java.lang.String[] modelDom,
java.lang.String[] colDom,
boolean logNonExactMapping)
Returns a mapping for given column according to given
modelDom. |
boolean |
isSupervised()
Needs to be set correctly otherwise eg scoring does not work.
|
protected double |
missingColumnsType()
Type of missing columns during adaptation between train/test datasets
Overload this method for models that have sparse data handling.
|
protected Futures |
remove_impl(Futures fs)
Override to remove subparts, but not self, of composite Keyed objects.
|
abstract ModelSchema |
schema()
Externally visible default schema
TODO: this is in the wrong layer: the internals should not know anything about the schemas!!!
This puts a reverse edge into the dependency graph.
|
double |
score(double[] data) |
Frame |
score(Frame fr)
Bulk score for given
fr frame. |
Frame |
score(Frame fr,
boolean adapt)
Bulk score the frame
fr, producing a Frame result; the 1st Vec is the
predicted class, the remaining Vecs are the probability distributions. |
float[] |
score(Frame fr,
boolean exact,
int row)
Single row scoring, on a compatible Frame.
|
float[] |
score(int[][][] map,
double[] row,
float[] preds)
Single row scoring, on a compatible set of data, given an adaption vector
|
float[] |
score(java.lang.String[] names,
java.lang.String[][] domains,
boolean exact,
double[] row)
Single row scoring, on a compatible set of data.
|
protected float[] |
score0(Chunk[] chks,
int row_in_chunk,
double[] tmp,
float[] preds)
Bulk scoring API for one row.
|
protected abstract float[] |
score0(double[] data,
float[] preds)
Subclasses implement the scoring logic.
|
void |
start_training(long training_start_time) |
void |
start_training(Model previous) |
void |
stop_training() |
delete_and_lock, delete, delete, delete, read_lock, read_lock, unlock_all, unlock, update, write_lockclone, frozenType, read_impl, read, readExternal, readJSON_impl, readJSON, write_impl, write, writeExternal, writeHTML_impl, writeHTML, writeJSON_impl, writeJSONpublic P extends Model.Parameters _parms
public java.lang.String[] _warnings
public O extends Model.Output _output
public long training_start_time
public long training_duration_in_ms
public boolean isSupervised()
public void addWarning(java.lang.String s)
public abstract ModelSchema schema()
public void start_training(long training_start_time)
public void start_training(Model previous)
public void stop_training()
public Frame score(Frame fr)
fr frame.
The frame is always adapted to this model.fr - frame to be scoredscore(Frame, boolean)public final Frame score(Frame fr, boolean adapt)
fr, producing a Frame result; the 1st Vec is the
predicted class, the remaining Vecs are the probability distributions.
For Regression (single-class) models, the 1st and only Vec is the
prediction value.
The flat adaptfr - frame which should be scoredadapt - a flag enforcing an adaptation of fr to this model. If flag
is false scoring code expect that fr is already adapted.public final float[] score(Frame fr, boolean exact, int row)
public final float[] score(java.lang.String[] names,
java.lang.String[][] domains,
boolean exact,
double[] row)
public final float[] score(int[][][] map,
double[] row,
float[] preds)
protected int[][][] adapt(java.lang.String[] names,
java.lang.String[][] domains,
boolean exact)
protected ModelMetrics computeModelMetrics(long start_time, Frame frame, Frame predictions)
protected double missingColumnsType()
public Frame[] adapt(Frame fr, boolean exact)
public static int[][] getDomainMapping(java.lang.String[] modelDom,
java.lang.String[] colDom,
boolean exact)
modelDom) and given column domain.public static int[][] getDomainMapping(java.lang.String colName,
java.lang.String[] modelDom,
java.lang.String[] colDom,
boolean logNonExactMapping)
modelDom.
In this case, modelDom iscolName - name of column which is mapped, can be null.modelDom - logNonExactMapping - modelDom.protected float[] score0(Chunk[] chks, int row_in_chunk, double[] tmp, float[] preds)
protected abstract float[] score0(double[] data,
float[] preds)
public double score(double[] data)
protected Futures remove_impl(Futures fs)
KeyedVec (removing associated Chunk keys)
and Frame (removing associated Vec keys.)remove_impl in class Keyedpublic long checksum()
Keyed