srowen commented on a change in pull request #28413:
URL: https://github.com/apache/spark/pull/28413#discussion_r418974144
##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/HashingTF.scala
##########
@@ -42,14 +42,23 @@ import org.apache.spark.util.VersionUtils.majorMinorVersion
* otherwise the features will not be mapped evenly to the columns.
*/
@Since("1.2.0")
-class HashingTF @Since("1.4.0") (@Since("1.4.0") override val uid: String)
+class HashingTF @Since("3.0.0") (
+ @Since("1.4.0") override val uid: String,
+ private[ml] val hashFuncVersion: Int)
extends Transformer with HasInputCol with HasOutputCol with HasNumFeatures
with DefaultParamsWritable {
- private var hashFunc: Any => Int = FeatureHasher.murmur3Hash
+ @transient lazy val hashFunc = hashFuncVersion match {
Review comment:
This is just an int parameter; can it not be a potentially private
parameter like other things? just seemed odd to put it in the constructor when
other params are not.
This doesn't need to be lazy or transient I think.
##########
File path: mllib/src/main/scala/org/apache/spark/ml/feature/HashingTF.scala
##########
@@ -137,22 +146,27 @@ class HashingTF @Since("1.4.0") (@Since("1.4.0") override
val uid: String)
@Since("1.6.0")
object HashingTF extends DefaultParamsReadable[HashingTF] {
+ private[ml] val HASH_FUNC_VERSION_1 = 1
+ private[ml] val HASH_FUNC_VERSION_2 = 2
Review comment:
Seems redundant to declare these if they're just ints.
I was thinking strings might be more descriptive, but this is OK.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]