Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-20533][SparkR]:SparkR Wrappers Model should be private and value should be lazy #17808

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ private[r] class LogisticRegressionWrapper private (
private val lrModel: LogisticRegressionModel =
pipeline.stages(1).asInstanceOf[LogisticRegressionModel]

val rFeatures: Array[String] = if (lrModel.getFitIntercept) {
lazy val rFeatures: Array[String] = if (lrModel.getFitIntercept) {
Array("(Intercept)") ++ features
} else {
features
}

val rCoefficients: Array[Double] = {
lazy val rCoefficients: Array[Double] = {
val numRows = lrModel.coefficientMatrix.numRows
val numCols = lrModel.coefficientMatrix.numCols
val numColsWithIntercept = if (lrModel.getFitIntercept) numCols + 1 else numCols
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ private[r] class MultilayerPerceptronClassifierWrapper private (

import MultilayerPerceptronClassifierWrapper._

val mlpModel: MultilayerPerceptronClassificationModel =
private val mlpModel: MultilayerPerceptronClassificationModel =
pipeline.stages(1).asInstanceOf[MultilayerPerceptronClassificationModel]

val weights: Array[Double] = mlpModel.weights.toArray
val layers: Array[Int] = mlpModel.layers
lazy val weights: Array[Double] = mlpModel.weights.toArray
lazy val layers: Array[Int] = mlpModel.layers

def transform(dataset: Dataset[_]): DataFrame = {
pipeline.transform(dataset)
Expand Down