How can I apply already trained classifier on the new dataset?

Wenn du dir nicht sicher bist, in welchem der anderen Foren du die Frage stellen sollst, dann bist du hier im Forum für allgemeine Fragen sicher richtig.
Antworten
Kathi94
User
Beiträge: 4
Registriert: Donnerstag 27. Februar 2020, 23:19

Hey, I am new to machine learning and it is my first project, so I would be grateful if someone can give me some advice.
I have already trained the classifier on the labelled dataset using a SVC model and got the accuracy with the train-test-split method. So it looks something like this:
X_train, X_test, y_train, y_test = train_test_split(features, y, test_size=0.2, random_state=2)
scaler = StandardScaler()
scaler.fit(X_train)
X_train_std = sc.transform(X_train)
X_test_std = sc.transform(X_test)
svc=SVC(C=1.0, random_state=1, kernel='sigmoid')
svc.fit(X_train_std, y_train)
prediction = svc.predict(X_test_std)

And now I want to apply this classifier to another dataset, which is not labelled. I did already preprocess steps with the new dataset, just as I did it with the first one, but I don't understand how can I apply this classifier to the new dataset and also get the labels from this classifier for the new dataset.
Benutzeravatar
ThomasL
User
Beiträge: 1379
Registriert: Montag 14. Mai 2018, 14:44
Wohnort: Kreis Unna NRW

As simple as this:

Code: Alles auswählen

another_dataset_std = scaler.transform(another_dataset)
new_prediction = svc.predict(another_dataset_std)
Ich bin Pazifist und greife niemanden an, auch nicht mit Worten.
Für alle meine Code Beispiele gilt: "There is always a better way."
https://projecteuler.net/profile/Brotherluii.png
Antworten