public class Leaderboard extends Lockable<Leaderboard> implements ModelContainer<Model>
Note that if a new Leaderboard is made for the same project_name it'll keep using the old model list, which allows us to run AutoML multiple times and keep adding to the leaderboard.
The models are returned sorted by either an appropriate default metric for the model category (auc, mean per class error, or mean residual deviance), or by a metric that's set via #setMetricAndDirection.
TODO: make this robust against removal of models from the DKV.
Modifier and Type | Class and Description |
---|---|
static class |
Leaderboard.ScoreData
What data should be used to generate leaderboard metrics.
|
Constructor and Description |
---|
Leaderboard(java.lang.String projectName,
water.logging.Logger logger,
Frame leaderboardFrame,
java.lang.String sortMetric,
Leaderboard.ScoreData scoreData)
Constructs a new leaderboard (doesn't put it in DKV).
|
Modifier and Type | Method and Description |
---|---|
<M extends Model> |
addModel(Key<M> key) |
void |
addModels(Key<Model>[] modelKeys)
Add the given models to the leaderboard.
|
void |
ensureSorted() |
java.util.Map<Key<Model>,LeaderboardCell[]> |
getExtensionsAsMap() |
static Leaderboard |
getInstance(Key leaderboardKey,
water.logging.Logger logger)
Retrieves a leaderboard from DKV
|
static Leaderboard |
getInstance(java.lang.String projectName,
water.logging.Logger logger,
Frame leaderboardFrame,
java.lang.String sortMetric,
Leaderboard.ScoreData scoreData)
Retrieves a leaderboard from DKV
|
Model |
getLeader() |
java.lang.String[] |
getMetrics()
The sort metric is always the first element in the list of metrics.
|
double[] |
getMetricValues(java.lang.String metricName) |
int |
getModelCount()
Return the number of models in this Leaderboard.
|
Key<Model>[] |
getModelKeys() |
int |
getModelRank(Key<Model> modelKey) |
Model[] |
getModels() |
Model[] |
getModelsSortedByMetric(java.lang.String metric) |
ModelMetrics |
getOrCreateModelMetrics(Key<Model> modelKey) |
static Leaderboard |
getOrMake(java.lang.String projectName,
water.logging.Logger logger,
Frame leaderboardFrame,
java.lang.String sortMetric) |
static Leaderboard |
getOrMake(java.lang.String projectName,
water.logging.Logger logger,
Frame leaderboardFrame,
java.lang.String sortMetric,
Leaderboard.ScoreData scoreData)
Retrieves a leaderboard from DKV or creates a fresh one and add it to DKV.
|
java.lang.String |
getProject() |
java.lang.String |
getSortMetric()
If no sort metric is provided when creating the leaderboard,
then a default sort metric will be automatically chosen based on the problem type:
binomial classification: auc
multinomial classification: logloss
regression: mean_residual_deviance
|
double[] |
getSortMetricValues() |
static java.lang.String |
idForProject(java.lang.String project_name) |
static java.lang.String |
idForProject(java.lang.String project_name,
Leaderboard.ScoreData score_data) |
static boolean |
isLossFunction(java.lang.String metric) |
Frame |
leaderboardFrame()
Note: If no leaderboard was provided, then the models are sorted according to metrics obtained during training
in the following priority order depending on availability:
cross-validation metrics
validation metrics
training metrics
|
java.lang.String |
rankTsv() |
protected Futures |
remove_impl(Futures fs,
boolean cascade)
Delete object and its dependencies from DKV, including models.
|
<M extends Model> |
removeModel(Key<M> key,
boolean cascade) |
void |
removeModels(Key<Model>[] modelKeys,
boolean cascade) |
void |
setExtensionsProvider(LeaderboardExtensionsProvider provider)
Assign a
LeaderboardExtensionsProvider to this leaderboard instance. |
java.lang.String |
toLogString() |
java.lang.String |
toString() |
TwoDimTable |
toTwoDimTable(java.lang.String... extensions)
Creates a
TwoDimTable representation of the leaderboard. |
delete_and_lock, delete_and_lock, delete_and_lock, delete, delete, delete, delete, read_lock, read_lock, read_lock, unlock_all, unlock, unlock, unlock, unlock, update, update, update, write_lock_to_read_lock, write_lock, write_lock, write_lock
checksum_impl, checksum_impl, checksum, checksum, getKey, makeSchema, readAll_impl, readAll, 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 Leaderboard(java.lang.String projectName, water.logging.Logger logger, Frame leaderboardFrame, java.lang.String sortMetric, Leaderboard.ScoreData scoreData)
projectName
- logger
- leaderboardFrame
- sortMetric
- scoreData
- public static java.lang.String idForProject(java.lang.String project_name)
project_name
- public static java.lang.String idForProject(java.lang.String project_name, Leaderboard.ScoreData score_data)
project_name
- score_data
- what metrics should be reportedpublic static boolean isLossFunction(java.lang.String metric)
metric
- public static Leaderboard getInstance(Key leaderboardKey, water.logging.Logger logger)
leaderboardKey
- logger
- public static Leaderboard getInstance(java.lang.String projectName, water.logging.Logger logger, Frame leaderboardFrame, java.lang.String sortMetric, Leaderboard.ScoreData scoreData)
projectName
- logger
- leaderboardFrame
- sortMetric
- scoreData
- public static Leaderboard getOrMake(java.lang.String projectName, water.logging.Logger logger, Frame leaderboardFrame, java.lang.String sortMetric, Leaderboard.ScoreData scoreData)
projectName
- logger
- leaderboardFrame
- sortMetric
- scoreData
- public static Leaderboard getOrMake(java.lang.String projectName, water.logging.Logger logger, Frame leaderboardFrame, java.lang.String sortMetric)
public void setExtensionsProvider(LeaderboardExtensionsProvider provider)
LeaderboardExtensionsProvider
to this leaderboard instance.provider
- the provider used to generate the optional extension columns from the leaderboard.LeaderboardExtensionsProvider
public java.lang.String getProject()
public java.lang.String getSortMetric()
public java.lang.String[] getMetrics()
public Frame leaderboardFrame()
public Key<Model>[] getModelKeys()
getModelKeys
in interface ModelContainer<Model>
public int getModelCount()
getModelCount
in interface ModelContainer<Model>
public Model[] getModels()
getModels
in interface ModelContainer<Model>
public Model[] getModelsSortedByMetric(java.lang.String metric)
public Model getLeader()
getSortMetric()
public int getModelRank(Key<Model> modelKey)
modelKey
- public double[] getSortMetricValues()
getSortMetric()
,
isLossFunction(String)
public double[] getMetricValues(java.lang.String metricName)
metricName
- getModels()
public ModelMetrics getOrCreateModelMetrics(Key<Model> modelKey)
public void addModels(Key<Model>[] modelKeys)
modelKeys
- public void removeModels(Key<Model>[] modelKeys, boolean cascade)
modelKeys
- the keys of the models to be removed from this leaderboard.cascade
- if true, the model itself and its dependencies will be completely removed from the backend.public void ensureSorted()
public <M extends Model> void addModel(Key<M> key)
addModels(Key[])
public <M extends Model> void removeModel(Key<M> key, boolean cascade)
key
- the key of the model to be removed from the leaderboard.cascade
- if true, the model itself and it's dependencies will be completely removed from the backend.public java.util.Map<Key<Model>,LeaderboardCell[]> getExtensionsAsMap()
protected Futures remove_impl(Futures fs, boolean cascade)
remove_impl
in class Keyed<Leaderboard>
public java.lang.String rankTsv()
public TwoDimTable toTwoDimTable(java.lang.String... extensions)
TwoDimTable
representation of the leaderboard.
If no extensions are provided, then the representation will only contain the model ids and the scoring metrics.
Each extension name will be represented in the table
if and only if it was also made available to the leaderboard by the LeaderboardExtensionsProvider
,
otherwise it will just be ignored.extensions
- optional columns for the leaderboard representation.TwoDimTable
representation of the current leaderboard.LeaderboardExtensionsProvider
,
LeaderboardColumn
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toLogString()