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
Prev Previous commit
Next Next commit
Correct validateAndTransformSchema
  • Loading branch information
sharp-pixel committed Aug 18, 2017
commit b2df776c5f48bfb1c3e5e0cda82b901405f9c6c5
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ private[clustering] trait GaussianMixtureParams extends Params with HasMaxIter w
*/
protected def validateAndTransformSchema(schema: StructType): StructType = {
SchemaUtils.checkColumnType(schema, $(featuresCol), new VectorUDT)
SchemaUtils.appendColumn(schema, $(predictionCol), IntegerType)
SchemaUtils.appendColumn(schema, $(probabilityCol), new VectorUDT)
val schema_temp = SchemaUtils.appendColumn(schema, $(predictionCol), IntegerType)
Copy link
Member

Choose a reason for hiding this comment

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

Tiny nit: Java/Scala use camelCase var names. Maybe call this withPredictionCol or something, as it's more descriptive anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad! Just committed with more descriptive variables in camelCase. Thanks

SchemaUtils.appendColumn(schema_temp, $(probabilityCol), new VectorUDT)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ private[regression] trait AFTSurvivalRegressionParams extends Params
SchemaUtils.checkNumericType(schema, $(censorCol))
SchemaUtils.checkNumericType(schema, $(labelCol))
}
if (hasQuantilesCol) {

val temp_schema = if (hasQuantilesCol) {
SchemaUtils.appendColumn(schema, $(quantilesCol), new VectorUDT)
}
SchemaUtils.appendColumn(schema, $(predictionCol), DoubleType)
} else schema

SchemaUtils.appendColumn(temp_schema, $(predictionCol), DoubleType)
}
}

Expand Down