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

hex.glm.GLMValidationTsk Maven / Gradle / Ivy

There is a newer version: 3.46.0.6
Show newest version
package hex.glm;

import hex.glm.GLMModel.GLMParameters;
import water.MRTask;
import water.fvec.Chunk;

/**
 * Created by tomasnykodym on 9/12/14.
 */
public class GLMValidationTsk extends MRTask {
  final GLMParameters _params;
  final double _ymu;
  final int _rank;
  GLMValidation _val;

  public GLMValidationTsk(GLMParameters params, double ymu, int rank){
    _params = params;
    _ymu = ymu;
    _rank = rank;
  }
  @Override
  public void map(Chunk actual, Chunk predict){
    GLMValidation val = new GLMValidation(null,_ymu,_params,_rank);
    for(int i = 0; i < actual._len; ++i) {
      double predicted = predict.at0(i);
      double real = actual.at0(i);
      if(!Double.isNaN(real) && !Double.isNaN(predicted))
        val.add(real, predicted);
    }
    _val = val;
  }
  @Override
  public void reduce(GLMValidationTsk gmt){ _val.add(gmt._val); }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy