from sklearn.neighbors import KNeighborsClassifier knn =KNeighborsClassifier(n_neighbors=5) X = trainfile[['WS48M','WS100M','WS152M',]] #Features y = (trainfile['wind_Energy_Kwh'])#Target variable knn.fit(X_train, y_train) print("Response for test dataset:") y_pred = knn.predict(X_test) print(y_pred) X=X.values y=y.values # Plotting decision region plot_decision_regions(X, y, clf=trainfile, legend=2) # Adding axes annotations plt.xlabel('wind_Energy_Kwh') plt.ylabel('Windspeed') plt.title('Knn with K='+ str(k)) plt.show()
1.4m articles
1.4m replys
5 comments
57.0k users