Usually, we have one dataset and we perform train and test split, but now I already have two datasets which are the train set called (New2) and the test set called (New1) . How do I pass them to the model!?
from lazypredict.Supervised import LazyClassifier
from sklearn.model_selection import train_test_split
X = New2
y= New1
X_train, X_test, y_train, y_test = train_test_split(X, y,test_size=.5,random_state =123)
clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
models,predictions = clf.fit(X_train, X_test, y_train, y_test)
print(models)
CodePudding user response:
This depends a little on how your data looks like but generally you split the sets yourself. Ill write the example as a (sample, 2) shaped array where the first column is your x and the second your y value.
X_train = New2[:,0]
Y_train = New2[:,1]
X_test = New1[:,0]
Y_test = New1[:,1]
CodePudding user response:
my data content 136 features the last one is the target (indexed as 136) so I am try to pass both sets train and test sets to the model
New3 = New2.to_numpy()
New4 = New1.to_numpy()
X=New3
Y=New4 // where the shape of the datasets are not the same New3=(40726, 137) and New4=(4639, 137)
X_train = New2[:,0:136]
Y_train = New2[:,136]
X_test = New1[:,0:136]
Y_test = New1[:,136]
from lazypredict.Supervised import LazyClassifier
from sklearn.model_selection import train_test_split
X_train = New3[:,0:136]
Y_train = New3[:,136]
X_test = New4[:,0:136]
Y_test = New4[:,136]
X_train, X_test, Y_train, Y_test = train_test_split(X, Y,test_size=.5,random_state =123)
clf = LazyClassifier(verbose=0,ignore_warnings=True, custom_metric=None)
models,predictions = clf.fit(X_train, X_test, Y_train, Y_test)
print(models)
