From 62a85eb09f3e33d7b8948bb96c67859d712b34e3 Mon Sep 17 00:00:00 2001 From: Liwei Lin Date: Sat, 26 Mar 2016 12:41:34 +0000 Subject: [SPARK-14089][CORE][MLLIB] Remove methods that has been deprecated since 1.1, 1.2, 1.3, 1.4, and 1.5 ## What changes were proposed in this pull request? Removed methods that has been deprecated since 1.1, 1.2, 1.3, 1.4, and 1.5. ## How was this patch tested? - manully checked that no codes in Spark call these methods any more - existing test suits Author: Liwei Lin Author: proflin Closes #11910 from lw-lin/remove-deprecates. --- .../evaluation/BinaryClassificationEvaluator.scala | 8 --- .../apache/spark/mllib/optimization/LBFGS.scala | 9 --- .../org/apache/spark/mllib/rdd/RDDFunctions.scala | 24 -------- .../spark/mllib/tree/configuration/Strategy.scala | 4 -- .../org/apache/spark/mllib/tree/model/Node.scala | 21 ------- .../org/apache/spark/mllib/util/MLUtils.scala | 71 ---------------------- 6 files changed, 137 deletions(-) (limited to 'mllib') diff --git a/mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala b/mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala index 00f3125584..337ffbe90f 100644 --- a/mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala +++ b/mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala @@ -63,14 +63,6 @@ class BinaryClassificationEvaluator @Since("1.4.0") (@Since("1.4.0") override va @Since("1.5.0") def setRawPredictionCol(value: String): this.type = set(rawPredictionCol, value) - /** - * @group setParam - * @deprecated use [[setRawPredictionCol()]] instead - */ - @deprecated("use setRawPredictionCol instead", "1.5.0") - @Since("1.2.0") - def setScoreCol(value: String): this.type = set(rawPredictionCol, value) - /** @group setParam */ @Since("1.2.0") def setLabelCol(value: String): this.type = set(labelCol, value) diff --git a/mllib/src/main/scala/org/apache/spark/mllib/optimization/LBFGS.scala b/mllib/src/main/scala/org/apache/spark/mllib/optimization/LBFGS.scala index 16a3352641..74e2cad76c 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/optimization/LBFGS.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/optimization/LBFGS.scala @@ -78,15 +78,6 @@ class LBFGS(private var gradient: Gradient, private var updater: Updater) this.convergenceTol } - /** - * Set the maximal number of iterations for L-BFGS. Default 100. - * @deprecated use [[LBFGS#setNumIterations]] instead - */ - @deprecated("use setNumIterations instead", "1.1.0") - def setMaxNumIterations(iters: Int): this.type = { - this.setNumIterations(iters) - } - /** * Set the maximal number of iterations for L-BFGS. Default 100. */ diff --git a/mllib/src/main/scala/org/apache/spark/mllib/rdd/RDDFunctions.scala b/mllib/src/main/scala/org/apache/spark/mllib/rdd/RDDFunctions.scala index 19a047ded2..e8a937ffcb 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/rdd/RDDFunctions.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/rdd/RDDFunctions.scala @@ -51,30 +51,6 @@ class RDDFunctions[T: ClassTag](self: RDD[T]) extends Serializable { */ def sliding(windowSize: Int): RDD[Array[T]] = sliding(windowSize, 1) - /** - * Reduces the elements of this RDD in a multi-level tree pattern. - * - * @param depth suggested depth of the tree (default: 2) - * @see [[org.apache.spark.rdd.RDD#treeReduce]] - * @deprecated Use [[org.apache.spark.rdd.RDD#treeReduce]] instead. - */ - @deprecated("Use RDD.treeReduce instead.", "1.3.0") - def treeReduce(f: (T, T) => T, depth: Int = 2): T = self.treeReduce(f, depth) - - /** - * Aggregates the elements of this RDD in a multi-level tree pattern. - * - * @param depth suggested depth of the tree (default: 2) - * @see [[org.apache.spark.rdd.RDD#treeAggregate]] - * @deprecated Use [[org.apache.spark.rdd.RDD#treeAggregate]] instead. - */ - @deprecated("Use RDD.treeAggregate instead.", "1.3.0") - def treeAggregate[U: ClassTag](zeroValue: U)( - seqOp: (U, T) => U, - combOp: (U, U) => U, - depth: Int = 2): U = { - self.treeAggregate(zeroValue)(seqOp, combOp, depth) - } } @DeveloperApi diff --git a/mllib/src/main/scala/org/apache/spark/mllib/tree/configuration/Strategy.scala b/mllib/src/main/scala/org/apache/spark/mllib/tree/configuration/Strategy.scala index 0214db55c1..b34e1b1b56 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/tree/configuration/Strategy.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/tree/configuration/Strategy.scala @@ -202,8 +202,4 @@ object Strategy { numClasses = 0) } - @deprecated("Use Strategy.defaultStrategy instead.", "1.5.0") - @Since("1.2.0") - def defaultStategy(algo: Algo): Strategy = defaultStrategy(algo) - } diff --git a/mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala b/mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala index 114a33a51d..5fd053647a 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/tree/model/Node.scala @@ -56,27 +56,6 @@ class Node @Since("1.2.0") ( s"split = $split, stats = $stats" } - /** - * build the left node and right nodes if not leaf - * @param nodes array of nodes - */ - @Since("1.0.0") - @deprecated("build should no longer be used since trees are constructed on-the-fly in training", - "1.2.0") - def build(nodes: Array[Node]): Unit = { - logDebug("building node " + id + " at level " + Node.indexToLevel(id)) - logDebug("id = " + id + ", split = " + split) - logDebug("stats = " + stats) - logDebug("predict = " + predict) - logDebug("impurity = " + impurity) - if (!isLeaf) { - leftNode = Some(nodes(Node.leftChildIndex(id))) - rightNode = Some(nodes(Node.rightChildIndex(id))) - leftNode.get.build(nodes) - rightNode.get.build(nodes) - } - } - /** * predict value if node is not leaf * @param features feature value diff --git a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala index 74e9271e40..c3b1d5cdd7 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/util/MLUtils.scala @@ -110,18 +110,6 @@ object MLUtils { } } - // Convenient methods for `loadLibSVMFile`. - - @Since("1.0.0") - @deprecated("use method without multiclass argument, which no longer has effect", "1.1.0") - def loadLibSVMFile( - sc: SparkContext, - path: String, - multiclass: Boolean, - numFeatures: Int, - minPartitions: Int): RDD[LabeledPoint] = - loadLibSVMFile(sc, path, numFeatures, minPartitions) - /** * Loads labeled data in the LIBSVM format into an RDD[LabeledPoint], with the default number of * partitions. @@ -133,23 +121,6 @@ object MLUtils { numFeatures: Int): RDD[LabeledPoint] = loadLibSVMFile(sc, path, numFeatures, sc.defaultMinPartitions) - @Since("1.0.0") - @deprecated("use method without multiclass argument, which no longer has effect", "1.1.0") - def loadLibSVMFile( - sc: SparkContext, - path: String, - multiclass: Boolean, - numFeatures: Int): RDD[LabeledPoint] = - loadLibSVMFile(sc, path, numFeatures) - - @Since("1.0.0") - @deprecated("use method without multiclass argument, which no longer has effect", "1.1.0") - def loadLibSVMFile( - sc: SparkContext, - path: String, - multiclass: Boolean): RDD[LabeledPoint] = - loadLibSVMFile(sc, path) - /** * Loads binary labeled data in the LIBSVM format into an RDD[LabeledPoint], with number of * features determined automatically and the default number of partitions. @@ -216,48 +187,6 @@ object MLUtils { def loadLabeledPoints(sc: SparkContext, dir: String): RDD[LabeledPoint] = loadLabeledPoints(sc, dir, sc.defaultMinPartitions) - /** - * Load labeled data from a file. The data format used here is - * L, f1 f2 ... - * where f1, f2 are feature values in Double and L is the corresponding label as Double. - * - * @param sc SparkContext - * @param dir Directory to the input data files. - * @return An RDD of LabeledPoint. Each labeled point has two elements: the first element is - * the label, and the second element represents the feature values (an array of Double). - * - * @deprecated Should use [[org.apache.spark.rdd.RDD#saveAsTextFile]] for saving and - * [[org.apache.spark.mllib.util.MLUtils#loadLabeledPoints]] for loading. - */ - @Since("1.0.0") - @deprecated("Should use MLUtils.loadLabeledPoints instead.", "1.0.1") - def loadLabeledData(sc: SparkContext, dir: String): RDD[LabeledPoint] = { - sc.textFile(dir).map { line => - val parts = line.split(',') - val label = parts(0).toDouble - val features = Vectors.dense(parts(1).trim().split(' ').map(_.toDouble)) - LabeledPoint(label, features) - } - } - - /** - * Save labeled data to a file. The data format used here is - * L, f1 f2 ... - * where f1, f2 are feature values in Double and L is the corresponding label as Double. - * - * @param data An RDD of LabeledPoints containing data to be saved. - * @param dir Directory to save the data. - * - * @deprecated Should use [[org.apache.spark.rdd.RDD#saveAsTextFile]] for saving and - * [[org.apache.spark.mllib.util.MLUtils#loadLabeledPoints]] for loading. - */ - @Since("1.0.0") - @deprecated("Should use RDD[LabeledPoint].saveAsTextFile instead.", "1.0.1") - def saveLabeledData(data: RDD[LabeledPoint], dir: String) { - val dataStr = data.map(x => x.label + "," + x.features.toArray.mkString(" ")) - dataStr.saveAsTextFile(dir) - } - /** * Return a k element array of pairs of RDDs with the first element of each pair * containing the training data, a complement of the validation data and the second -- cgit v1.2.3