Изменения
Нет описания правки
===Линейная регрессия===
Sbt зависимость:
libraryDependencies += "org.apache.spark" %% "spark-core" % "2.4.0"
libraryDependencies += "org.apache.spark" %% "spark-mllib" % "2.4.0" % "runtime"
Пример линейной регрессии c применением org.apache.spark.ml.regression.LinearRegression<ref>[https://spark.apache.org/docs/latest/ml-classification-regression.html#linear-regression Spark ML, LinearRegression]</ref>:
println(trainingSummary.rootMeanSquaredError)
println(trainingSummary.r2)
===Вариации регрессии===
Sbt зависимость:
libraryDependencies += "com.github.haifengl" %% "smile-scala" % "1.5.2"
Пример ридж и лассо регрессии c применением smile.regression<ref>[https://haifengl.github.io/smile/regression.html Smile, Regression]</ref>:
val data: AttributeDataset = read.table("regression.txt", delimiter = " ", response = Some((new NumericAttribute("class"), 0)))
val x: Array[Array[Double]] = data.x()
val y: Array[Double] = data.y()
val ridgeRegression: RidgeRegression = ridge(x, y, 0.0057)
val lassoRegression: LASSO = lasso(x, y, 10)
println(ridgeRegression)
println(lassoRegression)
== Примечания ==
<references/>