Skip to content

Commit fa61502

Browse files
committed
missed Since tages added
1 parent beaa3aa commit fa61502

File tree

5 files changed

+32
-1
lines changed

5 files changed

+32
-1
lines changed

mllib/src/main/scala/org/apache/spark/ml/regression/DecisionTreeRegressor.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ object DecisionTreeRegressor {
104104
* It supports both continuous and categorical features.
105105
* @param rootNode Root of the decision tree
106106
*/
107+
@Since("1.4.0")
107108
@Experimental
108109
final class DecisionTreeRegressionModel private[ml] (
109110
override val uid: String,
@@ -126,10 +127,12 @@ final class DecisionTreeRegressionModel private[ml] (
126127
rootNode.predictImpl(features).prediction
127128
}
128129

130+
@Since("1.4.0")
129131
override def copy(extra: ParamMap): DecisionTreeRegressionModel = {
130132
copyValues(new DecisionTreeRegressionModel(uid, rootNode, numFeatures), extra).setParent(parent)
131133
}
132134

135+
@Since("1.4.0")
133136
override def toString: String = {
134137
s"DecisionTreeRegressionModel (uid=$uid) of depth $depth with $numNodes nodes"
135138
}

mllib/src/main/scala/org/apache/spark/ml/regression/GBTRegressor.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ object GBTRegressor {
169169
* @param _trees Decision trees in the ensemble.
170170
* @param _treeWeights Weights for the decision trees in the ensemble.
171171
*/
172+
@Since("1.4.0")
172173
@Experimental
173174
final class GBTRegressionModel private[ml](
174175
override val uid: String,
@@ -187,11 +188,14 @@ final class GBTRegressionModel private[ml](
187188
* @param _trees Decision trees in the ensemble.
188189
* @param _treeWeights Weights for the decision trees in the ensemble.
189190
*/
191+
@Since("1.4.0")
190192
def this(uid: String, _trees: Array[DecisionTreeRegressionModel], _treeWeights: Array[Double]) =
191193
this(uid, _trees, _treeWeights, -1)
192194

195+
@Since("1.4.0")
193196
override def trees: Array[DecisionTreeModel] = _trees.asInstanceOf[Array[DecisionTreeModel]]
194197

198+
@Since("1.4.0")
195199
override def treeWeights: Array[Double] = _treeWeights
196200

197201
override protected def transformImpl(dataset: DataFrame): DataFrame = {
@@ -209,11 +213,13 @@ final class GBTRegressionModel private[ml](
209213
blas.ddot(numTrees, treePredictions, 1, _treeWeights, 1)
210214
}
211215

216+
@Since("1.4.0")
212217
override def copy(extra: ParamMap): GBTRegressionModel = {
213218
copyValues(new GBTRegressionModel(uid, _trees, _treeWeights, numFeatures),
214219
extra).setParent(parent)
215220
}
216221

222+
@Since("1.4.0")
217223
override def toString: String = {
218224
s"GBTRegressionModel (uid=$uid) with $numTrees trees"
219225
}

mllib/src/main/scala/org/apache/spark/ml/regression/IsotonicRegression.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,34 +189,42 @@ class IsotonicRegression @Since("1.5.0") (@Since("1.5.0") override val uid: Stri
189189
* @param oldModel A [[org.apache.spark.mllib.regression.IsotonicRegressionModel]]
190190
* model trained by [[org.apache.spark.mllib.regression.IsotonicRegression]].
191191
*/
192+
@Since("1.5.0")
192193
@Experimental
193194
class IsotonicRegressionModel private[ml] (
194195
override val uid: String,
195196
private val oldModel: MLlibIsotonicRegressionModel)
196197
extends Model[IsotonicRegressionModel] with IsotonicRegressionBase {
197198

198199
/** @group setParam */
200+
@Since("1.5.0")
199201
def setFeaturesCol(value: String): this.type = set(featuresCol, value)
200202

201203
/** @group setParam */
204+
@Since("1.5.0")
202205
def setPredictionCol(value: String): this.type = set(predictionCol, value)
203206

204207
/** @group setParam */
208+
@Since("1.5.0")
205209
def setFeatureIndex(value: Int): this.type = set(featureIndex, value)
206210

207211
/** Boundaries in increasing order for which predictions are known. */
212+
@Since("1.5.0")
208213
def boundaries: Vector = Vectors.dense(oldModel.boundaries)
209214

210215
/**
211216
* Predictions associated with the boundaries at the same index, monotone because of isotonic
212217
* regression.
213218
*/
219+
@Since("1.5.0")
214220
def predictions: Vector = Vectors.dense(oldModel.predictions)
215221

222+
@Since("1.5.0")
216223
override def copy(extra: ParamMap): IsotonicRegressionModel = {
217224
copyValues(new IsotonicRegressionModel(uid, oldModel), extra).setParent(parent)
218225
}
219226

227+
@Since("1.5.0")
220228
override def transform(dataset: DataFrame): DataFrame = {
221229
val predict = dataset.schema($(featuresCol)).dataType match {
222230
case DoubleType =>
@@ -228,6 +236,7 @@ class IsotonicRegressionModel private[ml] (
228236
dataset.withColumn($(predictionCol), predict(col($(featuresCol))))
229237
}
230238

239+
@Since("1.5.0")
231240
override def transformSchema(schema: StructType): StructType = {
232241
validateAndTransformSchema(schema, fitting = false)
233242
}

mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
136136
* Default is empty, so all instances have weight one.
137137
* @group setParam
138138
*/
139+
@Since("1.6.0")
139140
def setWeightCol(value: String): this.type = set(weightCol, value)
140141
setDefault(weightCol -> "")
141142

@@ -146,6 +147,7 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
146147
* selected automatically.
147148
* @group setParam
148149
*/
150+
@Since("1.6.0")
149151
def setSolver(value: String): this.type = set(solver, value)
150152
setDefault(solver -> "auto")
151153

@@ -329,14 +331,15 @@ class LinearRegression @Since("1.3.0") (@Since("1.3.0") override val uid: String
329331
model.setSummary(trainingSummary)
330332
}
331333

332-
@Since("1.3.0")
334+
@Since("1.4.0")
333335
override def copy(extra: ParamMap): LinearRegression = defaultCopy(extra)
334336
}
335337

336338
/**
337339
* :: Experimental ::
338340
* Model produced by [[LinearRegression]].
339341
*/
342+
@Since("1.3.0")
340343
@Experimental
341344
class LinearRegressionModel private[ml] (
342345
override val uid: String,
@@ -353,6 +356,7 @@ class LinearRegressionModel private[ml] (
353356
* Gets summary (e.g. residuals, mse, r-squared ) of model on training set. An exception is
354357
* thrown if `trainingSummary == None`.
355358
*/
359+
@Since("1.5.0")
356360
def summary: LinearRegressionTrainingSummary = trainingSummary match {
357361
case Some(summ) => summ
358362
case None =>
@@ -367,6 +371,7 @@ class LinearRegressionModel private[ml] (
367371
}
368372

369373
/** Indicates whether a training summary exists for this model instance. */
374+
@Since("1.5.0")
370375
def hasSummary: Boolean = trainingSummary.isDefined
371376

372377
/**
@@ -399,6 +404,7 @@ class LinearRegressionModel private[ml] (
399404
dot(features, weights) + intercept
400405
}
401406

407+
@Since("1.4.0")
402408
override def copy(extra: ParamMap): LinearRegressionModel = {
403409
val newModel = copyValues(new LinearRegressionModel(uid, weights, intercept), extra)
404410
if (trainingSummary.isDefined) newModel.setSummary(trainingSummary.get)
@@ -413,6 +419,7 @@ class LinearRegressionModel private[ml] (
413419
* @param predictions predictions outputted by the model's `transform` method.
414420
* @param objectiveHistory objective function (scaled loss + regularization) at each iteration.
415421
*/
422+
@Since("1.5.0")
416423
@Experimental
417424
class LinearRegressionTrainingSummary private[regression] (
418425
predictions: DataFrame,
@@ -432,6 +439,7 @@ class LinearRegressionTrainingSummary private[regression] (
432439
* Linear regression results evaluated on a dataset.
433440
* @param predictions predictions outputted by the model's `transform` method.
434441
*/
442+
@Since("1.5.0")
435443
@Experimental
436444
class LinearRegressionSummary private[regression] (
437445
@transient val predictions: DataFrame,

mllib/src/main/scala/org/apache/spark/ml/regression/RandomForestRegressor.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ object RandomForestRegressor {
124124
* @param _trees Decision trees in the ensemble.
125125
* @param numFeatures Number of features used by this model
126126
*/
127+
@Since("1.4.0")
127128
@Experimental
128129
final class RandomForestRegressionModel private[ml] (
129130
override val uid: String,
@@ -141,11 +142,13 @@ final class RandomForestRegressionModel private[ml] (
141142
private[ml] def this(trees: Array[DecisionTreeRegressionModel], numFeatures: Int) =
142143
this(Identifiable.randomUID("rfr"), trees, numFeatures)
143144

145+
@Since("1.4.0")
144146
override def trees: Array[DecisionTreeModel] = _trees.asInstanceOf[Array[DecisionTreeModel]]
145147

146148
// Note: We may add support for weights (based on tree performance) later on.
147149
private lazy val _treeWeights: Array[Double] = Array.fill[Double](numTrees)(1.0)
148150

151+
@Since("1.4.0")
149152
override def treeWeights: Array[Double] = _treeWeights
150153

151154
override protected def transformImpl(dataset: DataFrame): DataFrame = {
@@ -163,10 +166,12 @@ final class RandomForestRegressionModel private[ml] (
163166
_trees.map(_.rootNode.predictImpl(features).prediction).sum / numTrees
164167
}
165168

169+
@Since("1.4.0")
166170
override def copy(extra: ParamMap): RandomForestRegressionModel = {
167171
copyValues(new RandomForestRegressionModel(uid, _trees, numFeatures), extra).setParent(parent)
168172
}
169173

174+
@Since("1.4.0")
170175
override def toString: String = {
171176
s"RandomForestRegressionModel (uid=$uid) with $numTrees trees"
172177
}

0 commit comments

Comments
 (0)