Perceptron Logic Gates Project

while doing the perceptron logic gates project
https://www.codecademy.com/paths/data-science/tracks/perceptrons-and-neural-nets-skill-path/modules/perceptrons-skill-path/projects/perceptron-logic-gates

At step 14, for creating a heat map, we have to reshape the distances to a matrix of 2x2.
the distances represents points which can be expressed in coordinates. The distances were found using a mathematical equation and while reshaping the 1000 number of distances in 2x2 format, the coordinates that form this data isn’t representative of the actual distances that we found out using the classifier’s .decision_function() method!
wouldn’t that mean that the heat map we created is wrong ?
shouldn’t we find the actual co-ordinates for the distances containing those 1000 points and put them in the plt.pcolormesh() method ?
if yes, how do we that ?

Not sure if you still need help with this but just in case you do…

The 2x2 format was just an example for the numpy code. The actual step is the last bit of step 14:

Turn abs_distances into a 100 by 100 list and name it distances_matrix .

The code to do this is:

distances_matrix = np.reshape(abs_distances, (100, 100))

I noticed that one of the questions/answers is not quite right, when it says " A decision boundary is the line that determines whether the output should be a 1 or a 0 . Points that fall on one side of the line will be a 0 and points on the other side will be a 1 .

If your data is representing an AND gate, you should see that the point [1, 1] is closer to the decision boundary than [0, 0] . The point at [0.5, 0.5] is pretty close to the decision boundary as well."

The decision_function gives the values -2 and 2 for the points [0,0] and [1,1], which have the same absolute value of 2, so they are actually the same distance away from the decision boundary, while the point [0.5,0.5] gives the value 0, so it lies exactly on the decision boundary. You can see this when you plot the heatmap: the first two points come out as yellow (distance =2) and the last one is blue (distance=0).

Someone should correct this, but I don’t know how to go about contacting the person who wrote the course…