Suppose I have been given the following diagram
I need to design a neural network to separate the points or classes. How can I do that?
Artificial Intelligence Stack Exchange is a question and answer site for people interested in conceptual questions about life and challenges in a world where "cognitive" functions can be mimicked in purely digital environment. It only takes a minute to sign up.Sign up to join this community
From the diagram you have given, it's quite clear that you have to design a supervised network. Also, it's clear that you are dealing with a problem that's not linearly separable i.e. you can't separate two classes using a single line. Particularly, it will require three lines to separate these two classes.
From the above observations, what you can do is:
Make training data sets of form
[(x,y), o] where
(x,y) are the co-ordinates on the plot and
o is the class that point belongs to.
Note: You can actually divide your data set into training data and test data. Just, extract the data, randomly shuffle it and take first 80% of data to train and rest 20% of data to test.
Design a 2-2-2-1 neural network with bias units and some random initial weight values. This is because we will require minimum three lines to separate two classes, so 2 hidden layers (each consisting of 2 nodes and bias nodes) and 1 output layer (with bias node). The first layer is input layer with 2 nodes (no bias) as we have x-coordinate and y-coordinate.
Train your training data using this network using the Error Back Propagation algorithm i.e. update the weights between the layers and the bias weights too. Run the EBP algorithm for 100-2000 epochs.
Then, use the test data to see, if you get the desired output.
Note: I am NOT quite sure how to obtain the coordinates from the diagram. You can either manually note all points or research for some methods to get those points automatically from the image (some image processing algorithms).
Edit: I found a good video which explains neural networks. In the video, there is non-linear data like the one in your image which is separable using multiple lines and the network is designed to try to find curves such that data can be separated and the output resembles to that when used straight lines.