Skip to content

Instantly share code, notes, and snippets.

@anirudhev
anirudhev / userscorecomputation.txt
Created May 22, 2019 16:03
User Score Computation
// Spark : Train the model and save features, weights in PMML format
saveModelToS3(model.toPMML(), // PMML string
"miles_away_from_store", // Feature names
"trips_past_year",
"rewards_card_holder",
"lives_in_rural_area")
// Inside user-scoring microservice : Compute the user score
features = Map("miles_away_from_store" -> miles_away_from_store,
"card_holder" -> card_holder,
log_it = -0.20 +
0.44*miles_away_from_store +
0.14*trips_past_year +
0.34*rewards_card_holder +
0.35*lives_in_rural_area
and user_score = 1/(1+e^(-log_it))