verticapy.machine_learning.memmodel.cluster.NearestCentroid.predict_proba#
- NearestCentroid.predict_proba(X: list | ndarray) ndarray #
Predicts the probability of each input to belong to the model clusters.
Parameters#
- X: ArrayLike
The data on which to make the prediction.
Returns#
- numpy.array
Probabilities.
Examples#
Import the required module.
from verticapy.machine_learning.memmodel.cluster import KMeans
We will use the following attributes:
clusters = [[0.5, 0.6], [1, 2], [100, 200]] p = 2
Let’s create a model.
model_km = KMeans(clusters, p)
Create a dataset.
data = [[2, 3]]
Compute the predictions.
model_km.predict_proba(data)[0] Out[30]: array([0.33177263, 0.66395985, 0.00426752])
Important
For this example, a specific model is utilized, and it may not correspond exactly to the model you are working with. To see a comprehensive example specific to your class of interest, please refer to that particular class.