Search in sources :

Example 1 with DRF

use of hex.drf.DRF in project h2o-2 by h2oai.

the class DHistTest method testDBinom.

@Test
public void testDBinom() {
    DRF drf = new DRF();
    Key destTrain = Key.make("data.hex");
    DRFModel model = null;
    try {
        // Configure DRF
        drf.source = parseFrame(destTrain, "../smalldata/histogram_test/alphabet_cattest.csv");
        drf.response = drf.source.vecs()[1];
        drf.classification = true;
        drf.ntrees = 100;
        // = interaction.depth
        drf.max_depth = 5;
        // = nodesize
        drf.min_rows = 10;
        drf.nbins = 100;
        drf.destination_key = Key.make("DRF_model_dhist.hex");
        // Invoke DRF and block till the end
        drf.invoke();
        // Get the model
        model = UKV.get(drf.dest());
    } finally {
        drf.source.delete();
        drf.remove();
        // Remove the model
        if (model != null)
            model.delete();
    }
}
Also used : DRFModel(hex.drf.DRF.DRFModel) DRF(hex.drf.DRF) Test(org.junit.Test)

Example 2 with DRF

use of hex.drf.DRF in project h2o-2 by h2oai.

the class ModelSerializationTest method prepareDRFModel.

private DRFModel prepareDRFModel(String dataset, int[] ignores, int response, boolean classification, int ntrees) {
    Frame f = parseFrame(dataset);
    try {
        DRF drf = new DRF();
        Vec respVec = f.vec(response);
        drf.source = f;
        drf.response = respVec;
        drf.classification = classification;
        drf.ntrees = ntrees;
        drf.score_each_iteration = true;
        drf.invoke();
        return UKV.get(drf.dest());
    } finally {
        if (f != null)
            f.delete();
    }
}
Also used : Frame(water.fvec.Frame) Vec(water.fvec.Vec) DRF(hex.drf.DRF)

Aggregations

DRF (hex.drf.DRF)2 DRFModel (hex.drf.DRF.DRFModel)1 Test (org.junit.Test)1 Frame (water.fvec.Frame)1 Vec (water.fvec.Vec)1