Search in sources :

Example 6 with QuantileModel

use of hex.quantile.QuantileModel in project h2o-3 by h2oai.

the class DeepLearningModel method calcOutlierThreshold.

/**
   * Compute quantile-based threshold (in reconstruction error) to find outliers
   * @param mse Vector containing reconstruction errors
   * @param quantile Quantile for cut-off
   * @return Threshold in MSE value for a point to be above the quantile
   */
public double calcOutlierThreshold(Vec mse, double quantile) {
    Frame mse_frame = new Frame(Key.<Frame>make(), new String[] { "Reconstruction.MSE" }, new Vec[] { mse });
    DKV.put(mse_frame._key, mse_frame);
    QuantileModel.QuantileParameters parms = new QuantileModel.QuantileParameters();
    parms._train = mse_frame._key;
    parms._probs = new double[] { quantile };
    Job<QuantileModel> job = new Quantile(parms).trainModel();
    QuantileModel kmm = job.get();
    job.remove();
    double q = kmm._output._quantiles[0][0];
    kmm.delete();
    DKV.remove(mse_frame._key);
    return q;
}
Also used : Frame(water.fvec.Frame) Quantile(hex.quantile.Quantile) QuantileModel(hex.quantile.QuantileModel)

Aggregations

Quantile (hex.quantile.Quantile)6 QuantileModel (hex.quantile.QuantileModel)6 Frame (water.fvec.Frame)5 Vec (water.fvec.Vec)3 GLM (hex.glm.GLM)1 GLMModel (hex.glm.GLMModel)1 ShuffleSplitFrame (hex.splitframe.ShuffleSplitFrame)1 GBM (hex.tree.gbm.GBM)1 GBMModel (hex.tree.gbm.GBMModel)1 TreeSet (java.util.TreeSet)1 Job (water.Job)1 Key (water.Key)1 ValFrame (water.rapids.vals.ValFrame)1 PrettyPrint (water.util.PrettyPrint)1