Github user sethah commented on a diff in the pull request:
https://github.com/apache/spark/pull/16002#discussion_r89854110
--- Diff:
mllib/src/main/scala/org/apache/spark/ml/optim/NormalEquationSolver.scala ---
@@ -33,11 +33,16 @@ import
org.apache.spark.mllib.linalg.CholeskyDecomposition
* format. None when an optimization program is used to solve
the normal equations.
* @param objectiveHistory Option containing the objective history when an
optimization program is
* used to solve the normal equations. None when
an analytic solver is used.
+ * @param status Status of the solution. If the solution was produced by
[[CholeskySolver]], status
+ * value greater than 0 indicates singular matrix error;
status value less than 0
+ * indicates illegal input; status == 0 indicates success.
If the solution was
+ * produced by [[QuasiNewtonSolver]], status always return 0
which means success.
*/
private[ml] class NormalEquationSolution(
val coefficients: Array[Double],
val aaInv: Option[Array[Double]],
- val objectiveHistory: Option[Array[Double]])
+ val objectiveHistory: Option[Array[Double]],
--- End diff --
We have a bunch of fields that mean something in one case, and nothing in
another (hence the options). What would you think about the following
abstraction (not sure about the names though)?:
````scala
sealed trait NormalEquationSolution {
def coefficients: Array[Double]
}
case class DirectNormalEquationSolution(
coefficients: Array[Double],
aaInv: Array[Double],
status: Int) extends NormalEquationSolution
case class OptimizerNormalEquationSolution(
coefficients: Array[Double],
objectiveHistory: Array[Double]) extends NormalEquationSolution
````
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]