Discuss@GL4L

Qudratic Discriminant Analysis


#1

Hi
I am getting the below error when i am building a QDA model. Anyone aware of how to fix it

_Error in qda.default(x, grouping, …) : _
_ some group is too small for ‘qda’_

I have tried building a model on weather dataset (https://www.biz.uiowa.edu/faculty/jledolter/DataMining/dataexercises.html).

mydata=read.csv(“weather.csv”)

####Missing value Imputation using kNN

library(VIM)

#Which variables have missing values
colnames(mydata)[colSums(is.na(mydata)) > 0]
mydata_imputed=kNN(mydata,variable = colnames(mydata)[colSums(is.na(mydata)) > 0],k=5)
colSums(is.na(mydata_imputed))

mydata_imputed=mydata_imputed[,1:24]

#Building model

library(caret)
set.seed(1234)
Index=createDataPartition(mydata_imputed$RainTomorrow,p=0.75,list = FALSE)
Train=mydata_imputed[Index,]
Test=mydata_imputed[-Index,]

Train=droplevels(Train)
QDAModel1=qda(RainTomorrow~., data = Train[,-c(1:2)])