with single-layer perceptron it's easy to find the equation of the "separating line" (I don't know the professional term), the line that separate between 2 types of points, based on the perceptron's weights, after it was trained. How can I find in a similar way the equation of the curve (not straight line) that separate between 2 types of points, in a multi-layer perceptron?
thanks.
This is only an attempt to get an approximation to the separating boundary or curve.
Dataset
Below I plotted the separating curve between the two types of the example dataset. The dataset is borrowed from coursera - Andrew Ng's machine learning course. Also the code snippet below borrows the ideas from
Ex6
of Andrew's ML course.Boundary Plot
To plot the separating curve,
Matlab
, this is something like:If your goal is only to get the exact mathematical representation of the boundary curve, this method won't work. This method can only give you an approximation of the curve up to the granularity you set up in your grid.
If you do want a precise description of the boundary, SVM might be a good alternative since the whole set of support vectors could serve as the boundary descriptive.
Approximate boundary using contour points
I took a look at
octave
's documentation aboutcontour
. Basically,contour
uses the contour matrixC
computed bycontourc
from the same arguments. Here is the signature ofcontourc
:This function computes contour lines of the matrix
Z
. ParametersX
,Y
andVN
are optional.So if you do want to get an analytical description of the curve, matrix
C
should contain enough information about it. In my sample plot, after parsing ofC
, I get 30 levels. The coordinates of the first 6 points in the first level are listed below:Please notice that they are exactly the points on the contour starting from (0.23677, 0.40263). Using these contour points, it's straightforward to approximate the curve using multiple line segments (because each line segment can be determined by two end points).
Hope it helps.