Skip to content
Closed
Changes from all commits
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 @@ -223,12 +223,12 @@ class KMeans private (

// Compute squared norms and cache them.
val norms = data.map(Vectors.norm(_, 2.0))
Copy link
Contributor Author

@amanomer amanomer Nov 12, 2019

Choose a reason for hiding this comment

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

norms have only one child zippedData so all actions that rely on norms also rely on zippedData and in runAlgorithm(), multiple actions have been applied on zippedData.

norms.persist()
val zippedData = data.zip(norms).map { case (v, norm) =>
new VectorWithNorm(v, norm)
}
zippedData.persist()
val model = runAlgorithm(zippedData, instr)
norms.unpersist()
zippedData.unpersist()

// Warn at the end of the run as well, for increased visibility.
if (data.getStorageLevel == StorageLevel.NONE) {
Expand Down