ida.data.frame).idaKMeans(
data,
id,
k=3,
maxiter=5,
distance="euclidean",
outtable=NULL,
randseed=12345,
statistics=NULL,
modelname=NULL
)
## S3 method for class 'idaKMeans':
print(x,...)
## S3 method for class 'idaKMeans':
predict(object, newdata, id,...)"euclidean", which
causes the squared Euclidean distance to be used."none","columns" and "all". If NULL, the default of the database system will be used.idaRetrieveModel or idaDropModidaKMeans to be predicted.idaKMeans to be printed.idaKMeans and kmeans.modelname can be used to decide under which name the model is stored in the database.
This name can be used to retrieve or drop the model later (idaRetrieveModel,idaDropModel).
The output of the print function for a idaKMeans object is:
- A vector containing a list of centers
- A vector containing a list of cluster sizes
- A vector containing a list of the number of elements in each cluster
- A data frame or the name of the table containing the calculated cluster assignments
- The within-cluster sum of squares (which indicates cluster density)
- The names of the slots that are available in the idaKMeans objectidaRetrieveModel, idaDropModel, idaListModels#Create ida data frame
idf <- ida.data.frame("IRIS")
#Create a kmeans model stored in the database as KMEANSMODEL
km <- idaKMeans(idf, id="ID",modelname="KMEANSMODEL")
#Print the model
print(km)
#Predict the model
pred <- predict(km,idf,id="ID")
#Inspect the predictions
head(pred)Run the code above in your browser using DataLab