使用惰性谓词Am希望将Train和Test集传递给模型



通常,我们有一个数据集,我们执行训练和测试拆分,但现在我已经有两个数据集了,它们是名为(New2(的训练集和名为(New1(的测试集。如何将它们传递给模型!?

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)

这在一定程度上取决于数据的外观,但通常情况下,您自己拆分集合。我将把这个例子写成一个(sample,2(形状的数组,其中第一列是x值,第二列是y值。

X_train = New2[:,0]
Y_train = New2[:,1]
X_test = New1[:,0]
Y_test = New1[:,1]

我的数据内容136的特征最后一个是目标(索引为136(,所以我正在尝试将两组训练和测试组都传递给模型

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)

相关内容

最新更新