pos = np.where(Y == 1) #vector with index of the Y = 1 plt.scatter(X[pos, 0], X[pos, 1], marker='*', c='y') pos = np.where(Y == 0) #vector with index of the Y = 1 plt.scatter(X[pos, 0], X[pos, 1], marker='$F$', c='r') def draw_decision_boundary(theta, X, Y, poly): x0_min, x0_max = X[:,0].min(), X[:,0].max() x1_min, x1_max = X[:,1].min(), X[:,1].max() xx1, xx2 = np.meshgrid(np.linspace(x0_min, x0_max), np.linspace(x1_min, x1_max)) sigm = g(poly.fit_transform(np.c_[ xx1.ravel(), xx2.ravel()]).dot(theta)) sigm = sigm.reshape(xx1.shape) plt.contour(xx1, xx2, sigm, [0.5], linewidths = 1, colors = 'g') def draw(theta, X, Y, poly): plt.figure() draw_data(X, Y) draw_decision_boundary(theta, X, Y, poly) plt.show() data = Data_Management.load_csv(sys.argv[1]) #sys.argv[1]) X, Y, m, n = Data_Management.get_parameters_from_training_examples(data) poly, X_poly = polinomial_features(X, int(sys.argv[2])) theta = np.zeros([1, np.shape(X_poly)[1]], dtype=float) theta = tnc(func=J, x0=theta, fprime=gradient, args=(X_poly,Y))[0] draw(theta, X, Y, poly)
from ML_UtilsModule import Data_Management X, y = Data_Management.load_csv("pokemon.csv") #no vale #print(X[:, 0])