A simple neural network to classify points generated using a sine function.
The model is trained using gradient descent algorithm with backpropagation for calculating gradients.
Graphics are generated using WinBGI graphics library in C++ language.
Random points are generated for train and test set and are saved in training_set.txt
and test_set.txt
.
-
Train data:
- Label 1 (RED) : Points on and above the sine graph.
- Label 0 (GREEN): Points below the sine graph.
-
Test data:
- Shown in YELLOW.
- Input Layer: 2 nodes with two coordinates of a point.
- Hidden Layer1: 20 nodes with sigmoid activation function.
- Hidden Layer2: 20 nodes with sigmoid activation function.
- Output Layer: 1 node with sigmoid activation function.
Mean Squared Error (MSE)
Some good resources:-
- Test data:
- Points in PINK are classified into Label 1 (RED).
- Points in BLUE are classified into Label 0 (GREEN).
Apart from this neural network classification which is more general, I tried classification using regression also.
I assumed a general sine curve : y = Amplitude * sin(freq * x + Phase) + Offset
And then based on these 4 parameters, tried to fit this graph according to the points given.
-
Graph in WHITE is the fitted graph with the predicted 4 parameters.
-
Test data:
- Points in PINK are classified into Label 1 (RED).
- Points in BLUE are classified into Label 0 (GREEN).