Math_machine_learning.zip (3133Bytes)
Whenever I observe my daughter, I find that she likes to collect things. The more, the better. Usually as much as she can carry. As she can not count, how can she distinguish, what are more things and what are less things?
My daughter with objects in both hands
The human being has two hands, and every hand has 5 fingers. The binary and decimal system -- as if to the manner born. Two hands to grasp things. Fingers are at that stage already useful but there is no obvious advantage to have 2 or 6 fingers, it is just more preferable to have a toy on every hand than on one. So at the beginning we have following situation: no toy on both hands - worst case, a toy on one hand - good, a toy on every hand - better, more than one toy on every hand - best. This is already a kind of math, a simplified description of the Peano axioms as we can transform this into a simple inequality, replacing the term 'is worse than' and 'is better than' by the relational operators '<' and '>'.
or even simpler
In the end the child only needs to be able to distinguish between one and more than one objects, only the comparison operators '=" and '≠' are necessary. Everything else can be learned and then unknown substituted by learned. If the child has for instance already learned that 1+1=2 and 1+2=3, '2' can be replaced by '1+1'. It isn't necessary to know anything about the arithmetic operator '+'. '1+1' can just be seen as a set of objects which is equal to '2'. Now '2' can be substituted by '1+1' and the second equation becomes 1+1+1=3.
Based on this assumption I started to develop a program in Arduino C that should learn to add two integers a and b, where 1 ≤ a;b ≤ 5. The program contans following parts:
- Supervised learning algorithm. A teacher tags randomly generated equations as true or false via keyboard. False equations will be not repeated. If an equation a+b=c (e.g. 1+5=6) was tagged as true, the randomly generated values for the variables a and b (e.g. 1 and 5) will be not repeated as well to speed up the learning progress.
- Substitution. All integers are substituted by additions of ones, e.g. if 1+1=2 and 1+2=3 then 1+1+1=3.
- Random example generator. Generates 5 times random numbers for the summands a and b, after the substituation of the integers 1 to 10 is completed.
- Adder. Stores the two randomly generated summands in an array, e.g. 5 and 3: sum array={1,1,1,1,1,1,1,1,0,0}.
- Comparator. Compares the sum array via if statements with all substituted integers and ouputs the result via serial monitor.
I have attached the code as a ZIP file. If you want to watch the video, please chose video quality 480p.
Next step is to replace the keyboard by two push buttons and the serial monitor by the Parallax Emic 2 Text-to-Speech Module, which I should get in the mail when I am returning from Thailand, Phuket.
https://www.youtube.com/watch?v=zowkOtA6fkc