ValueError: Found input variables with inconsistent numbers of sample - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: ValueError: Found input variables with inconsistent numbers of sample (/thread-25271.html) |
ValueError: Found input variables with inconsistent numbers of sample - robert2joe - Mar-25-2020 Dear all, I am new to Python and I am trying to complete a piece of coursework that involves Support Vector Machines, Principal Component Analysis and Cost-Support Vector Classifiers. Firstly I have made a scatter plot from two sets of data that were provided. I have normalised the data and believed i have split the data into smaller datasets using train_test_spilt. The issue occurs when I am using the C-SVC SVM to achieve the highest classification rate of the data I have collected from the scatter plot, by imputing two values in the parameters C(cost) and γ(gamma). The code is as follows: svc1 = SVC(kernel ='rbf', class_weight='balanced', C=50, gamma=0.1) model1 = svc1.fit(scaled_tester, Sytrain) """The fitted model should be validated on the scaled validation set. """ vyfit1 = model1.predict(scaled_valX) """Performance measurements""" from sklearn import metrics print('Accuracy:', metrics.accuracy_score(vtest, vyfit1)) from sklearn.metrics import classification_report print(classification_report(vtest, vyfit1, target_names=faces.target_names))The error message is as follows: Is there anyone who is able to understand this error message and tell me where it is going wrong?Many Thanks any questions please let me know. |