Github user jkbradley commented on a diff in the pull request:
https://github.com/apache/spark/pull/10327#discussion_r48502942
--- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/PCA.scala ---
@@ -167,14 +167,37 @@ object PCAModel extends MLReadable[PCAModel] {
private val className = classOf[PCAModel].getName
+ /**
+ * Loads a [[PCAModel]] from data located at the input path. Note that
the model includes an
+ * `explainedVariance` member that is not recorded by Spark 1.6 and
earlier. A model
+ * can be loaded from such older data but will have an empty vector for
+ * `explainedVariance`.
+ *
+ * @param path path to serialized model data
+ * @return a [[PCAModel]]
+ */
override def load(path: String): PCAModel = {
val metadata = DefaultParamsReader.loadMetadata(path, sc, className)
+
+ // explainedVariance field is not present in Spark <= 1.6
+ val versionRegex = "([0-9]+)\\.([0-9])+.*".r
--- End diff --
Sorry for the late comment (just getting back from traveling), but the
regex is a little off: The second "+" should be inside the parentheses (though
this will probably never be needed).
---
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]