本文整理了Java中water.fvec.Frame.lastVecName()
方法的一些代码示例,展示了Frame.lastVecName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frame.lastVecName()
方法的具体详情如下:
包路径:water.fvec.Frame
类名称:Frame
方法名:lastVecName
暂无
代码示例来源:origin: h2oai/h2o-3
@Test
public void testMiniBatch50() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._mini_batch_size = 50;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(12.938076268040659,dl._output._training_metrics._MSE,1e-6);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testCatEncodingCV() {
for (Model.Parameters.CategoricalEncodingScheme c : Model.Parameters.CategoricalEncodingScheme.values()) {
if (c != Model.Parameters.CategoricalEncodingScheme.AUTO) continue;
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/junit/weather.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._ntrees = 5;
parms._categorical_encoding = c;
parms._nfolds = 3;
gbm = new GBM(parms).trainModel().get();
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testMiniBatch1() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._mini_batch_size = 1;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(12.938076268040659,dl._output._training_metrics._MSE,1e-6);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuber() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._distribution = huber;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(6.4964976811,((ModelMetricsRegression)dl._output._training_metrics)._mean_residual_deviance,1e-5);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testGaussian() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = gaussian;
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(2.9423857564,((ModelMetricsRegression) gbm._output._training_metrics)._MSE,1e-5);
Assert.assertEquals(2.9423857564,((ModelMetricsRegression) gbm._output._training_metrics)._mean_residual_deviance,1e-5);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testGaussian() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._distribution = gaussian;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(12.93808 /*MSE*/,((ModelMetricsRegression)dl._output._training_metrics)._mean_residual_deviance,1e-5);
Assert.assertEquals(12.93808 /*MSE*/,((ModelMetricsRegression)dl._output._training_metrics)._MSE,1e-5);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testLaplace() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = laplace;
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(8.05716257,((ModelMetricsRegression)gbm._output._training_metrics)._MSE,1e-5);
Assert.assertEquals(1.42298/*MAE*/,((ModelMetricsRegression)gbm._output._training_metrics)._mean_residual_deviance,1e-5);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuberNoise() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 0.9; //that's the default
parms._pred_noise_bandwidth = 0.2;
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(4.8056900203,((ModelMetricsRegression)gbm._output._training_metrics)._MSE,1e-5);
Assert.assertEquals(2.0080997,((ModelMetricsRegression) gbm._output._training_metrics)._mean_residual_deviance,1e-4);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuber() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 0.9; //that's the default
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(4.447062185,((ModelMetricsRegression)gbm._output._training_metrics)._MSE,1e-5);
Assert.assertEquals(1.962926332,((ModelMetricsRegression) gbm._output._training_metrics)._mean_residual_deviance,1e-4);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testCrossValidation() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._nfolds = 4;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(12.959355363801334,dl._output._training_metrics._MSE,1e-6);
Assert.assertEquals(17.296871012606317,dl._output._cross_validation_metrics._MSE,1e-6);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuberDeltaLarge() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 1; // nothing is an outlier - same as gaussian
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(2.9423857564,((ModelMetricsRegression) gbm._output._training_metrics)._MSE,1e-2);
// huber loss with delta -> max(error) goes to MSE
Assert.assertEquals(2.9423857564,((ModelMetricsRegression) gbm._output._training_metrics)._mean_residual_deviance,1e-2);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testLaplace() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._distribution = laplace;
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(2.31398/*MAE*/,((ModelMetricsRegression)dl._output._training_metrics)._mean_residual_deviance,1e-5);
Assert.assertEquals(14.889,((ModelMetricsRegression)dl._output._training_metrics)._MSE,1e-3);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuberDeltaLarge() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 1; //just like gaussian
dl = new DeepLearning(parms).trainModel().get();
Assert.assertEquals(12.93808 /*MSE*/,((ModelMetricsRegression)dl._output._training_metrics)._mean_residual_deviance,0.7);
Assert.assertEquals(12.93808 /*MSE*/,((ModelMetricsRegression)dl._output._training_metrics)._MSE,0.7);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuberDeltaTiny() {
Frame tfr = null;
GBMModel gbm = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 1e-2; //everything is an outlier and we should get laplace loss
gbm = new GBM(parms).trainModel().get();
Assert.assertEquals(8.05716257,((ModelMetricsRegression)gbm._output._training_metrics)._MSE,0.3);
// Huber loss can be derived from MAE since no obs weights
double delta = 0.0047234; //hardcoded from output
double MAE = 1.42298; //see laplace above
Assert.assertEquals((2*MAE-delta)*delta,((ModelMetricsRegression)gbm._output._training_metrics)._mean_residual_deviance,1e-1);
} finally {
if (tfr != null) tfr.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
parms._response_column = tfr.lastVecName();
parms._activation = DeepLearningParameters.Activation.Tanh;
parms._reproducible = true;
parms._response_column = tfr.lastVecName();
parms._activation = DeepLearningParameters.Activation.Tanh;
parms._reproducible = true;
代码示例来源:origin: h2oai/h2o-3
@Test
public void testHuberDeltaTiny() {
Frame tfr = null;
DeepLearningModel dl = null;
try {
tfr = parse_test_file("./smalldata/gbm_test/BostonHousing.csv");
DeepLearningParameters parms = new DeepLearningParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._reproducible = true;
parms._hidden = new int[]{20,20};
parms._seed = 0xdecaf;
parms._distribution = huber;
parms._huber_alpha = 1e-2;
// more like Laplace, but different slope and different prefactor -> so can't compare deviance 1:1
dl = new DeepLearning(parms).trainModel().get();
double delta = 0.011996;
// can compute huber loss from MAE since no obs weights
Assert.assertEquals((2*2.31398/*MAE*/-delta)*delta,((ModelMetricsRegression)dl._output._training_metrics)._mean_residual_deviance,2e-2);
Assert.assertEquals(19.856,((ModelMetricsRegression)dl._output._training_metrics)._MSE,1e-3);
} finally {
if (tfr != null) tfr.delete();
if (dl != null) dl.deleteCrossValidationModels();
if (dl != null) dl.delete();
}
}
代码示例来源:origin: h2oai/h2o-3
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
String resp = tfr.lastVecName();
if (dist==modified_huber || dist==bernoulli || dist==multinomial) {
resp = dist==multinomial?"rad":"chas";
代码示例来源:origin: h2oai/h2o-3
GLMModel.GLMParameters parms = new GLMModel.GLMParameters();
parms._train = tfr._key;
String resp = tfr.lastVecName();
if (fam==Family.binomial || fam==Family.multinomial) {
resp = fam==Family.multinomial?"rad":"chas";
代码示例来源:origin: h2oai/h2o-3
@Test
public void testCatEncoding() {
for (Model.Parameters.CategoricalEncodingScheme c : Model.Parameters.CategoricalEncodingScheme.values()) {
if (c != Model.Parameters.CategoricalEncodingScheme.AUTO) continue;
Frame tfr = null;
GBMModel gbm = null;
Frame fr2 = null;
try {
tfr = parse_test_file("./smalldata/junit/weather.csv");
GBMModel.GBMParameters parms = new GBMModel.GBMParameters();
parms._train = tfr._key;
parms._response_column = tfr.lastVecName();
parms._ntrees = 5;
parms._categorical_encoding = c;
gbm = new GBM(parms).trainModel().get();
// Done building model; produce a score column with predictions
fr2 = gbm.score(tfr);
// Build a POJO, validate same results
Assert.assertTrue(gbm.testJavaScoring(tfr,fr2,1e-15));
} finally {
if (tfr != null) tfr.delete();
if (fr2 != null) fr2.delete();
if (gbm != null) gbm.deleteCrossValidationModels();
if (gbm != null) gbm.delete();
}
}
}
代码示例来源:origin: h2oai/h2o-3
parms._response_column = tfr.lastVecName();
parms._activation = DeepLearningParameters.Activation.Tanh;
parms._reproducible = true;
parms._response_column = tfr.lastVecName();
parms._activation = DeepLearningParameters.Activation.Tanh;
parms._reproducible = true;
内容来源于网络,如有侵权,请联系作者删除!