Created
February 26, 2023 12:28
-
-
Save a-agmon/8bd32a296ba7b2b5adb12051d9f375d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class DMatrixConverter(seq: Seq[FeaturesRecord]) { | |
def toDMatrix: DMatrix = { | |
val labeledPoints = seq.map { case FeaturesRecord(_, _, features, label) => | |
LabeledPoint(label, features.size, null, features.toArray) | |
} | |
new DMatrix(labeledPoints.iterator) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment