Holdout prediction with cross validation in K-means modeling

Sometime you may need to combine holdout predictions, while keep_cross_validation_predictions parameter is active in Python, here is the Python code as sample:

import h2o
h2o.init()
from h2o.estimators.kmeans import H2OKMeansEstimator
prostate = h2o.import_file("https://h2o-public-test-data.s3.amazonaws.com/smalldata/prostate/prostate.csv")
predictors = ["AGE", "RACE", "VOL", "GLEASON"]
kmeans_model = H2OKMeansEstimator(k=10, nfolds = 5,
keep_cross_validation_predictions=True,
keep_cross_validation_fold_assignment=True)
kmeans_model.train(predictors, training_frame = prostate)
kmeans_model.cross_validation_predictions()

 

ss

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s