You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Dong Wang (Jira)" <ji...@apache.org> on 2019/11/09 09:49:00 UTC
[jira] [Created] (SPARK-29811) Missing persist on oldDataset in
ml.RandomForestRegressor.train()
Dong Wang created SPARK-29811:
---------------------------------
Summary: Missing persist on oldDataset in ml.RandomForestRegressor.train()
Key: SPARK-29811
URL: https://issues.apache.org/jira/browse/SPARK-29811
Project: Spark
Issue Type: Improvement
Components: ML
Affects Versions: 2.4.3
Reporter: Dong Wang
The rdd oldDataset in ml.regression.RandomForestRegressor.train() needs to be persisted, because it used in two actions in RandomForest.run() and oldDataset.first().
{code:scala}
override protected def train(
dataset: Dataset[_]): RandomForestRegressionModel = instrumented { instr =>
val categoricalFeatures: Map[Int, Int] =
MetadataUtils.getCategoricalFeatures(dataset.schema($(featuresCol)))
val oldDataset: RDD[LabeledPoint] = extractLabeledPoints(dataset) // Needs to persist
val strategy =
super.getOldStrategy(categoricalFeatures, numClasses = 0, OldAlgo.Regression, getOldImpurity)
instr.logPipelineStage(this)
instr.logDataset(dataset)
instr.logParams(this, labelCol, featuresCol, predictionCol, impurity, numTrees,
featureSubsetStrategy, maxDepth, maxBins, maxMemoryInMB, minInfoGain,
minInstancesPerNode, seed, subsamplingRate, cacheNodeIds, checkpointInterval)
// First use oldDataset
val trees = RandomForest
.run(oldDataset, strategy, getNumTrees, getFeatureSubsetStrategy, getSeed, Some(instr))
.map(_.asInstanceOf[DecisionTreeRegressionModel])
// Second use oldDataset
val numFeatures = oldDataset.first().features.size
instr.logNamedValue(Instrumentation.loggerTags.numFeatures, numFeatures)
new RandomForestRegressionModel(uid, trees, numFeatures)
}
{code}
This issue is reported by our tool CacheCheck, which is used to dynamically detecting persist()/unpersist() api misuses.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org