I am trying to implement machine learning for a dataset with 1059 rows and 4 columns but I am getting the following error when trying to fit the model with:
knn.fit(myData['RAB'], myData['ETAPE'])
ValueError: Found input variables with inconsistent numbers of samples: [1, 1059]
DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19. Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1) if it contains a single sample. Also how can I define multiple predictor variables?
The output of shape is:
(1059, 4)
How can I define more than one predictor variables?
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
plt.style.use('ggplot')
myData=pd.read_csv('sabmin.csv', sep=';')
print(myData.shape)
knn = KNeighborsClassifier(n_neighbors=6)
knn.fit(myData['RAB'], myData['ETAPE'])