Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to give multiple inputs to the training model in sklearn library?

X_train,X_test,Y_train,Y_test = train_test_split(T,Yout,test_size = 0.20)
clf.fit(X_train,Y_train)

I need to train the model using 3 arguments ie,clf.fit(X_train,X_train[3], Y_train).but it shows error fit (X.shape[0], y.shape[0])). Want to make training as dependent on X_train[3]. Suggest if there are any other commands in python for training(ie apart from fit and train_test_split).

like image 704
Archana V S Avatar asked Oct 31 '22 08:10

Archana V S


1 Answers

If you want to train a model using multiple features, Here's an example below:

FEATURES_ARR = ['feature1', 'feature2', 'feature3']
lrModel = LinearRegression(normalize=True)
lrModel.fit(X_train[FEATURES_ARR], Y_train)
like image 169
Nikita Jain Avatar answered Nov 15 '22 03:11

Nikita Jain