Skip to content
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