from sklearn.preprocessing import LabelEncoder from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers import Dense import pandas as pd data = pd.read_csv(r"Book_updated.csv") target = data["Prakruti type"] train = data.drop(['Prakruti type'],axis = 1) classes = train.columns encoders = [] unique_output=[] for col in train.columns: le = LabelEncoder() unique_output.append((train[col].unique()).tolist()) train[col] = le.fit_transform(train[col]) encoders.append(le) target2 = pd.get_dummies(target) model = Sequential([ Dense(64,activation='relu',input_shape=(18,)), Dense(32,activation='relu'), Dense(7,activation='softmax') ]) model.compile(optimizer='adam',metrics='categorical_crossentropy',loss='mean_squared_error') x_tr,x_te,y_tr,y_te=train_test_split(train,target2,random_state=123,test_size=0.2) model.fit(x_tr,y_tr,epochs = 1000,batch_size=12,verbose= 1)