All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ai.h2o.automl.leaderboard.MetricScore Maven / Gradle / Ivy

There is a newer version: 3.46.0.6
Show newest version
package ai.h2o.automl.leaderboard;

import hex.Model;
import water.Iced;
import water.Key;

import java.util.HashMap;
import java.util.Map;

/**
 * A cell for a scoring metric column.
 */
public class MetricScore extends Iced implements LeaderboardCell {

    private static final Map COLUMNS = new HashMap<>();

    public static LeaderboardColumn getColumn(String metric) {
        if (!COLUMNS.containsKey(metric)) {
            COLUMNS.put(metric, new LeaderboardColumn(metric, "double", "%.6f"));
        }
        return COLUMNS.get(metric);
    }

    private final Key _modelId;
    private final String _metric;

    private Double _score;

    public MetricScore(Key modelId, String metric, Double score) {
        _modelId = modelId;
        _metric = metric;
        _score = score;
    }

    @Override
    public LeaderboardColumn getColumn() {
        return MetricScore.getColumn(_metric);
    }

    @Override
    public Key getModelId() {
        return _modelId;
    }

    @Override
    public Double getValue() {
        return _score;
    }

    @Override
    public void setValue(Double value) {
        _score = value;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy