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

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

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

import hex.Model;
import hex.leaderboard.LeaderboardCell;
import hex.leaderboard.LeaderboardColumn;
import water.Iced;
import water.Key;

/**
 * A cell computing lazily the size of a model.
 */
public class ModelSize extends Iced implements LeaderboardCell {

    public static final LeaderboardColumn COLUMN = new LeaderboardColumn("model_size_bytes", "long", "%s");

    private final Key _modelId;

    private Long _model_size;

    public ModelSize(Key modelId) {
        _modelId = modelId;
    }

    @Override
    public LeaderboardColumn getColumn() {
        return COLUMN;
    }

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

    @Override
    public Long getValue() {
        return _model_size;
    }

    @Override
    public void setValue(Long value) {
        _model_size = value;
    }

    @Override
    public boolean isNA() {
        return getValue() == null || getValue() < 0;
    }

    @Override
    public Long fetch() {
        if (getValue() == null) {
            try {
                // PUBDEV-7124:
//                Model model = _modelId.get();
                // export binary model to temp folder
                // read size
                // delete saved model
            } catch (Exception e) {
                setValue(-1L);
            }
        }
        return getValue();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy