Search in sources :

Example 1 with GLMOutput

use of hex.glm.GLMModel.GLMOutput in project h2o-3 by h2oai.

the class MakeGLMModelHandler method make_model.

public GLMModelV3 make_model(int version, MakeGLMModelV3 args) {
    GLMModel model = DKV.getGet(args.model.key());
    if (model == null)
        throw new IllegalArgumentException("missing source model " + args.model);
    String[] names = model._output.coefficientNames();
    Map<String, Double> coefs = model.coefficients();
    for (int i = 0; i < args.names.length; ++i) coefs.put(args.names[i], args.beta[i]);
    double[] beta = model.beta().clone();
    for (int i = 0; i < beta.length; ++i) beta[i] = coefs.get(names[i]);
    GLMModel m = new GLMModel(args.dest != null ? args.dest.key() : Key.make(), model._parms, null, model._ymu, Double.NaN, Double.NaN, -1);
    DataInfo dinfo = model.dinfo();
    dinfo.setPredictorTransform(TransformType.NONE);
    // GLMOutput(DataInfo dinfo, String[] column_names, String[][] domains, String[] coefficient_names, boolean binomial) {
    m._output = new GLMOutput(model.dinfo(), model._output._names, model._output._domains, model._output.coefficientNames(), model._output._binomial, beta);
    DKV.put(m._key, m);
    GLMModelV3 res = new GLMModelV3();
    res.fillFromImpl(m);
    return res;
}
Also used : DataInfo(hex.DataInfo) GLMOutput(hex.glm.GLMModel.GLMOutput) GLMModel(hex.glm.GLMModel)

Aggregations

DataInfo (hex.DataInfo)1 GLMModel (hex.glm.GLMModel)1 GLMOutput (hex.glm.GLMModel.GLMOutput)1