public class ModelMetrics extends Keyed<ModelMetrics>
Modifier and Type | Class and Description |
---|---|
static class |
ModelMetrics.MetricBuilder<T extends ModelMetrics.MetricBuilder<T>>
Class used to compute AUCs, CMs & HRs "on the fly" during other passes
over Big Data.
|
Modifier and Type | Field and Description |
---|---|
CustomMetric |
_custom_metric |
java.lang.String |
_description |
double |
_MSE |
long |
_nobs |
long |
_scoring_time |
Constructor and Description |
---|
ModelMetrics(Model model,
Frame frame,
long nobs,
double MSE,
java.lang.String desc,
CustomMetric customMetric) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.StringBuilder |
appendToStringMetrics(java.lang.StringBuilder sb) |
AUC2 |
auc_obj() |
static Key<ModelMetrics> |
buildKey(Key model_key,
long model_checksum,
Key frame_key,
long frame_checksum) |
static Key<ModelMetrics> |
buildKey(Model model,
Frame frame) |
static TwoDimTable |
calcVarImp(double[] rel_imp,
java.lang.String[] coef_names) |
static TwoDimTable |
calcVarImp(double[] rel_imp,
java.lang.String[] coef_names,
java.lang.String table_header,
java.lang.String[] col_headers) |
static TwoDimTable |
calcVarImp(float[] rel_imp,
java.lang.String[] coef_names) |
static TwoDimTable |
calcVarImp(VarImp vi) |
protected long |
checksum_impl()
High-quality 64-bit checksum of the content of the object.
|
ConfusionMatrix |
cm() |
ModelMetrics |
deepCloneWithDifferentModelAndFrame(Model model,
Frame frame)
Utility used by code which creates metrics on a different frame and model than
the ones that we want the metrics object to be accessible for.
|
static ModelMetrics |
defaultModelMetrics(Model model) |
Frame |
frame() |
static java.util.Set<java.lang.String> |
getAllowedMetrics(Key<Model> key) |
static ModelMetrics |
getFromDKV(Model model,
Frame frame) |
static double |
getMetricFromModel(Key<Model> key,
java.lang.String criterion) |
static double |
getMetricFromModelMetric(ModelMetrics mm,
java.lang.String criterion) |
float[] |
hr() |
boolean |
isForFrame(Frame f) |
boolean |
isForModel(Model m) |
Model |
model() |
double |
mse() |
long |
residual_degrees_of_freedom() |
double |
rmse() |
void |
setModelKey(Key modelKey) |
static java.util.List<Key<Model>> |
sortModelsByMetric(Frame frame,
java.lang.String sort_by,
boolean decreasing,
java.util.List<Key<Model>> modelKeys)
Return a new list of models sorted on metrics computed on the given frame, by the named criterion.
|
static java.util.List<Key<Model>> |
sortModelsByMetric(java.lang.String sort_by,
boolean decreasing,
java.util.List<Key<Model>> modelKeys)
Return a new list of models sorted on their xval, validation or training metrics, by the named criterion.
|
java.lang.String |
toString() |
ModelMetrics |
withDescription(java.lang.String desc) |
ModelMetrics |
withModelAndFrame(Model model,
Frame frame) |
checksum_impl, checksum, checksum, getKey, makeSchema, readAll_impl, readAll, remove_impl, remove_impl, remove_self_key_impl, remove, remove, remove, remove, remove, remove, removeQuietly, writeAll_impl, writeAll
asBytes, clone, copyOver, frozenType, read, readExternal, readJSON, reloadFromBytes, toJsonBytes, toJsonString, write, writeExternal, writeJSON
public java.lang.String _description
public final long _scoring_time
public final CustomMetric _custom_metric
public final double _MSE
public final long _nobs
public ModelMetrics(Model model, Frame frame, long nobs, double MSE, java.lang.String desc, CustomMetric customMetric)
public final void setModelKey(Key modelKey)
public final ModelMetrics withModelAndFrame(Model model, Frame frame)
public ModelMetrics withDescription(java.lang.String desc)
public ModelMetrics deepCloneWithDifferentModelAndFrame(Model model, Frame frame)
model
- frame
- public long residual_degrees_of_freedom()
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.StringBuilder appendToStringMetrics(java.lang.StringBuilder sb)
public final Model model()
public final Frame frame()
public double mse()
public double rmse()
public ConfusionMatrix cm()
public float[] hr()
public AUC2 auc_obj()
public static ModelMetrics defaultModelMetrics(Model model)
public static double getMetricFromModel(Key<Model> key, java.lang.String criterion)
public static double getMetricFromModelMetric(ModelMetrics mm, java.lang.String criterion)
public static java.util.List<Key<Model>> sortModelsByMetric(java.lang.String sort_by, boolean decreasing, java.util.List<Key<Model>> modelKeys)
sort_by
- criterion by which we should sortdecreasing
- sort by decreasing metrics or notmodelKeys
- keys of models to sortmpublic static java.util.List<Key<Model>> sortModelsByMetric(Frame frame, java.lang.String sort_by, boolean decreasing, java.util.List<Key<Model>> modelKeys)
frame
- frame on which to compute the metrics; looked up in the DKV first to see if it was previously computedsort_by
- criterion by which we should sortdecreasing
- sort by decreasing metrics or notmodelKeys
- keys of models to sortmpublic static TwoDimTable calcVarImp(VarImp vi)
public static TwoDimTable calcVarImp(float[] rel_imp, java.lang.String[] coef_names)
public static TwoDimTable calcVarImp(double[] rel_imp, java.lang.String[] coef_names)
public static TwoDimTable calcVarImp(double[] rel_imp, java.lang.String[] coef_names, java.lang.String table_header, java.lang.String[] col_headers)
public static Key<ModelMetrics> buildKey(Key model_key, long model_checksum, Key frame_key, long frame_checksum)
public static Key<ModelMetrics> buildKey(Model model, Frame frame)
public boolean isForModel(Model m)
public boolean isForFrame(Frame f)
public static ModelMetrics getFromDKV(Model model, Frame frame)
protected long checksum_impl()
Keyed
checksum_impl
in class Keyed<ModelMetrics>