Model.fit

In [ ]:
Model.fit(input_relation: (str, vDataFrame), 
          X: list = [])

Trains the model.

Parameters

Name Type Optional Description
input_relation
str
❌
Training relation.
X
list
✓
List of the predictors. If empty, all the numerical vcolumns will be used.

Returns

object : self

Example

In [70]:
from verticapy.learn.cluster import KMeans
model = KMeans(name = "public.KMeans_iris",
               n_cluster = 3)
model.fit("public.iris", 
          ["PetalLengthCm", "PetalWidthCm"])
Out[70]:

=======
centers
=======
petallengthcm|petalwidthcm
-------------+------------
   1.46400   |   0.24400  
   5.62609   |   2.04783  
   4.29259   |   1.35926  


=======
metrics
=======
Evaluation metrics:
     Total Sum of Squares: 550.64347
     Within-Cluster Sum of Squares: 
         Cluster 0: 2.0384
         Cluster 1: 15.163478
         Cluster 2: 14.227407
     Total Within-Cluster Sum of Squares: 31.429286
     Between-Cluster Sum of Squares: 519.21418
     Between-Cluster SS / Total SS: 94.29%
 Number of iterations performed: 7
 Converged: True
 Call:
kmeans('public.KMeans_iris', 'public.iris', '"PetalLengthCm", "PetalWidthCm"', 3
USING PARAMETERS max_iterations=300, epsilon=0.0001, init_method='kmeanspp', distance_method='euclidean')