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, or "norm_euclidean", which causes normalized 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. Model names cannot have more than 64 characters and
cannot contain white spaces. They need to be quoted like table names, otherwise they will be treated upper case by default. Only one
model with a given name is allowed in the database at a time. If a model with modelname already exists, you need to drop it with idaDropModel
first before you can create another one with the same name. The model name can be used to retrieve the model later (idaRetrieveModel).
The output of the print function for a idaKMeans object is:
idaRetrieveModel, 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