use of water.api.FrameSplitPage in project h2o-2 by h2oai.
the class LoadDatasets method testTrainSplitFrames.
public void testTrainSplitFrames() {
final Key[] keySet = H2O.KeySnapshot.globalSnapshot().keys();
for (Key key : keySet) {
final Value val = DKV.get(key);
if (val == null || !val.isFrame())
continue;
final Frame fr = val.get();
if (!fr._key.toString().contains("_part")) {
try {
FrameSplitPage fsp = new FrameSplitPage();
fsp.source = fr;
long seed = new Random().nextLong();
Log.info("seed: " + seed);
fsp.ratios = new float[] { 0.001f + new Random(seed).nextFloat() * 0.99f };
Log.info("Splitting frame under key '" + fr._key.toString() + "' into " + fsp.ratios[0] + ".");
fsp.split_keys = new Key[] { Key.make(), Key.make() };
fsp.split_rows = null;
fsp.split_ratios = null;
fsp.invoke();
} catch (Exception ex) {
Log.err(ex.getMessage());
}
}
}
}
Aggregations