Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,8 @@ class FMClassifier @Since("3.0.0") (
instr.logNumFeatures(numFeatures)

val handlePersistence = dataset.storageLevel == StorageLevel.NONE
val data: RDD[(Double, OldVector)] =
dataset.select(col($(labelCol)), col($(featuresCol))).rdd.map {
case Row(label: Double, features: Vector) =>
require(label == 0 || label == 1, s"FMClassifier was given" +
s" dataset with invalid label $label. Labels must be in {0,1}; note that" +
s" FMClassifier currently only supports binary classification.")
(label, features)
}
val labeledPoint = extractLabeledPoints (dataset, numClasses)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove extra space before method call

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. Thanks!

val data: RDD[(Double, OldVector)] = labeledPoint.map(x => (x.label, x.features))

if (handlePersistence) data.persist(StorageLevel.MEMORY_AND_DISK)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,8 @@ class FMRegressor @Since("3.0.0") (
instr.logNumFeatures(numFeatures)

val handlePersistence = dataset.storageLevel == StorageLevel.NONE
val data: RDD[(Double, OldVector)] =
dataset.select(col($(labelCol)), col($(featuresCol))).rdd.map {
case Row(label: Double, features: Vector) =>
(label, features)
}
val labeledPoint = extractLabeledPoints (dataset)
val data: RDD[(Double, OldVector)] = labeledPoint.map(x => (x.label, x.features))

if (handlePersistence) data.persist(StorageLevel.MEMORY_AND_DISK)

Expand Down