![]() Where y is the value we want to predict, a 0 or 1 in this case, and Y is the value output by the equation above, the sum adds over all the data (or batches in a NN). Our loss equation would look something like: So that the binary_crossentropy (what you picked) is minimized, I will use B for the sum of the logs. A dense layer from 3 to 1 and a sigmoid activation is the attempt to optimize the variables a,b,c,d in the equation:į(x,y,z) = 1/(1+e^(-D(x,y,z)) D(x,y,z) = ax+by+cz+d If you want to keep the sigmoid, then you need to map your linear neuron through this activation (hence it won't look like a plane anymore). You may have to train longer to get convergence (assuming it can converge without an activation). If you train with no activation (activation='linear'), you should get the visualization you are looking for. It looks like you applied a sigmoid activation. #visualize 3d scatterplot with hyperplaneįig = plt.figure(num=None, figsize=(9, 9), dpi=100, facecolor='w', edgecolor='k')Īx.scatter(ds.BMI, ds.DiabetesPedigreeFunction, ds.Glucose, c=ds.Outcome)Īx.set_ylabel('DiabetesPedigreeFunction')īest guess without reading all the code in detail. Y_max = ds.DiabetesPedigreeFunction.max() Y_min = ds.DiabetesPedigreeFunction.min() History = model.fit(x=X, y=Y, epochs=EPOCHS) Layer1 = layers.Dense(1, activation='sigmoid', input_shape=(3,)) #construct perceptron with 3 inputs and a single output %matplotlib notebookĭs = pd.read_csv('diabetes.csv', sep=',', header=0) The goal here is to classify individuals into two groups (diabetes or no diabetes), based on 3 predictor variables using a public dataset ( ). Z = (d - ax - by) / c for a hyperplane defined as ax + by + cz = dĬould somebody assist me with correctly constructing and displaying a hyperplane based on the NN weights? ![]() I am calculating the z-axis of the hyperplane using the equation Unfortunately, the hyperplane is not appearing between the points on the scatter plot, but instead is displaying underneath all the data points (see output image). I'm extracting the weights from a Keras NN model and then attempting to draw the surface plane using matplotlib. I would like to visualize the decision boundary for a simple neural network with only one neuron (3 inputs, binary output). ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |