RandomForestRegressor rf = new RandomForestRegressor() .setMaxDepth(2) .setMaxBins(10) .setMinInstancesPerNode(5) .setMinInfoGain(0.0) .setMaxMemoryInMB(256) .setCacheNodeIds(false) .setCheckpointInterval(10) .setSubsamplingRate(1.0) .setSeed(1234) .setNumTrees(3) .setMaxDepth(2); // duplicate setMaxDepth to check builder pattern for (String impurity : RandomForestRegressor.supportedImpurities()) { rf.setImpurity(impurity); for (String featureSubsetStrategy : RandomForestRegressor.supportedFeatureSubsetStrategies()) { rf.setFeatureSubsetStrategy(featureSubsetStrategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); Assert.fail("Expected exception to be thrown for invalid strategies"); } catch (Exception e) { RandomForestRegressionModel model = rf.fit(dataFrame);
RandomForestRegressor rf = new RandomForestRegressor() .setMaxDepth(2) .setMaxBins(10) .setMinInstancesPerNode(5) .setMinInfoGain(0.0) .setMaxMemoryInMB(256) .setCacheNodeIds(false) .setCheckpointInterval(10) .setSubsamplingRate(1.0) .setSeed(1234) .setNumTrees(3) .setMaxDepth(2); // duplicate setMaxDepth to check builder pattern for (String impurity : RandomForestRegressor.supportedImpurities()) { rf.setImpurity(impurity); for (String featureSubsetStrategy : RandomForestRegressor.supportedFeatureSubsetStrategies()) { rf.setFeatureSubsetStrategy(featureSubsetStrategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); Assert.fail("Expected exception to be thrown for invalid strategies"); } catch (Exception e) { RandomForestRegressionModel model = rf.fit(dataFrame);
RandomForestRegressor rf = new RandomForestRegressor() .setMaxDepth(2) .setMaxBins(10) .setMinInstancesPerNode(5) .setMinInfoGain(0.0) .setMaxMemoryInMB(256) .setCacheNodeIds(false) .setCheckpointInterval(10) .setSubsamplingRate(1.0) .setSeed(1234) .setNumTrees(3) .setMaxDepth(2); // duplicate setMaxDepth to check builder pattern for (String impurity : RandomForestRegressor.supportedImpurities()) { rf.setImpurity(impurity); for (String featureSubsetStrategy : RandomForestRegressor.supportedFeatureSubsetStrategies()) { rf.setFeatureSubsetStrategy(featureSubsetStrategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); rf.setFeatureSubsetStrategy(strategy); Assert.fail("Expected exception to be thrown for invalid strategies"); } catch (Exception e) { RandomForestRegressionModel model = rf.fit(dataFrame);