Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change age feature to Real #24

Merged
merged 1 commit into from
Jun 20, 2018
Merged
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 @@ -107,7 +107,7 @@ object OpTitanicSimple {

val sex = FeatureBuilder.PickList[Passenger].extract(_.sex.map(_.toString).toPickList).asPredictor

val age = FeatureBuilder.RealNN[Passenger].extract(_.age.toRealNN(Double.NaN)).asPredictor
val age = FeatureBuilder.Real[Passenger].extract(_.age.toReal).asPredictor

val sibSp = FeatureBuilder.Integral[Passenger].extract(_.sibSp.toIntegral).asPredictor

Expand All @@ -130,7 +130,7 @@ object OpTitanicSimple {
val estimatedCostOfTickets = familySize * fare
// val pivotedSex = sex.map[PickList](v => v).pivot()
val pivotedSex = sex.pivot()
val normedAge = age.zNormalize()
val normedAge = age.fillMissingWithMean().zNormalize()
val ageGroup = age.map[PickList](_.value.map(v => if (v > 18) "adult" else "child").toPickList)

// Define a feature of type vector containing all the predictors you'd like to use
Expand All @@ -154,6 +154,7 @@ object OpTitanicSimple {
.setLabelCol(survived)
.setRawPredictionCol(rawPrediction)
.setPredictionCol(prediction)
.setProbabilityCol(prob)

////////////////////////////////////////////////////////////////////////////////
// WORKFLOW
Expand Down