Neural networks are mathematical models of the biological neuron. They have the ability to appoximate functional mappings from sample data (to put them mildy).
Ruby is an object oriented, functionally inspired, beautiful programming language. I used it to build the models because it's so simple to read, not because it's a practical choice for production.
The first thing you need for machine learning is a data set. The data set I used can be found here on the popular UCI machine learning repository. The data consists of a set of measurements of digital images of various peoples breast tissue. A digital image is taken of an FNA (fine needle aspirate) and various measurements taken of the cells. Once you have the data, you split it into a training set (~60%) and a generalization set (~40%).
The data consists of real medical readings taken from a digital image of a piece of sample tissue (a fine needle aspirate, "FNA"). Each number in the comma separated lists below correspond to a specific attribute of the tissue measured from the image of this small piece of sample tissue.
The attributes consist of 10 measurements made on 3 cells, resulting in 30 attributes.
Here are some examples of measurements from the data set:
The training set is used along with a training algorithm in order to correct the neural networks classification during training. By doing so, teaching it to classify the mass as either malignant or benign. I'm training the neural network with a particle swarm optimizer, a clever global search algorithm.
Let us train the network now...
Once the training is complete it will show the trained networks average classification accuracy. This may vary greatly because I have not tweaked the algorithms parameters (train again if the accuracy is not sufficient).
Let us test the trained network by giving it 2 data patterns from the generalization set (the trained network never encountered these) and see if it classifies them as expected.
We expect the following unseen data to classify as Malignant.
We expect the following unseen data to classify as Benign.
You can submit your readings here to be classified with the pretrained neural network.
(try to copy some of the example measurements here from step 1)
To tell the truth, this is a very easy problem for AI to solve. In fact, it can be solved with statistical methods alone! With that being said, cancer is a destructive disease that has affected many people I hold dear. If we can solve the problem of cancer diagnosis that affects so many people, what other problems can be solved with machine learning? I hope you were inspired by this demonstration, and I hope you will share it and spread the love. Who knows what we can do with machine learning if we have the right data!