KMeansModel predict¶
-
predict
(self, frame, observation_columns=None)¶ [BETA] Predict the cluster assignments for the data points.
Parameters: frame : <bound method AtkEntityType.__name__ of <trustedanalytics.rest.jsonschema.AtkEntityType object at 0x7f9e686f3fd0>>
A frame whose labels are to be predicted. By default, predict is run on the same columns over which the model is trained.
observation_columns : list (default=None)
Column(s) containing the observations whose clusters are to be predicted. Default is to predict the clusters over columns the KMeans model was trained on. The columns are scaled using the same values used when training the model.
Returns: : <bound method AtkEntityType.__name__ of <trustedanalytics.rest.jsonschema.AtkEntityType object at 0x7f9e686f3fd0>>
A new frame consisting of the existing columns of the frame and new columns. The data returned is composed of multiple components:
double : ‘k’ columnsSquared distance of each point to every cluster center.int : predicted_clusterThe cluster assignment.Examples
>>> my_model = ta.KMeansModel(name='MyKmeansModel') >>> my_model.train(my_frame, ['name_of_observation_column1', 'name_of_observation_column2'],[2.0, 5.0] 3, 10, 0.0002, "random") >>> new_frame = my_model.predict(my_frame)