srowen commented on a change in pull request #25303: [SPARK-23469][ML]
HashingTF should use corrected MurmurHash3 implementation
URL: https://github.com/apache/spark/pull/25303#discussion_r309260342
##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/HashingTF.scala
##########
@@ -142,6 +143,29 @@ class HashingTF @Since("1.4.0") (@Since("1.4.0") override
val uid: String)
@Since("1.6.0")
object HashingTF extends DefaultParamsReadable[HashingTF] {
+ private class HashingTFReader extends MLReader[HashingTF] {
+
+ private val className = classOf[HashingTF].getName
+
+ override def load(path: String): HashingTF = {
+ val metadata = DefaultParamsReader.loadMetadata(path, sc, className)
+ val hashingTF = new HashingTF(metadata.uid)
+ metadata.getAndSetParams(hashingTF)
+
+ // We support loading old `HashingTF` saved by previous Spark versions.
+ // Previous `HashingTF` uses `mllib.feature.HashingTF.murmur3Hash`, but
new `HashingTF` uses
+ // `ml.Feature.FeatureHasher.murmur3Hash`.
+ val (majorVersion, minorVersion) =
majorMinorVersion(metadata.sparkVersion)
Review comment:
Oh good catch here.
Nit: you can replace minorVersion with _ just for tidiness
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]