I need to evaluate the ML model on another dataset but i don't know what it fully means. I have an idea but i am not sure. Let's say we have:
After training both model with model.fit
, how do i test them on the other database? Is it:
from sklearn.svm import SVC
#training on the first model
svm.fit(X, Y)
#test on the 2nd model
y_pred = svm.predict(X_test_2)
#evaluate accuracy
print(accuracy_score(y_test, y_pred))
It seems simple but i am really confused, i would appreciate some explanations.
Testing on another dataset, say X2, y2
, does not mean you need to split this second dataset into training & test subsets, as you have done for your original X
& y
. Once you have fitted your model, say svm
, in X
as you show, you simply predict on X2
and compare with the labels in y2
:
# predict on the 2nd dataset X2
y_pred = svm.predict(X2)
# evaluate accuracy
print(accuracy_score(y2, y_pred))