(Just one of the things I'm learning. https://github.com/hchiam/learning)
(even more ML stuff: https://github.com/hchiam/learning-ml)
Simple test code for machine learning / neural networks / artificial intelligence (ML/NN/AI) in the Python programming language. And some live JavaScript examples too, like this one: https://codepen.io/hchiam/full/QGOyaE (for best results, open in Chrome).
No need to install a ton of things to import (more sophisticated code further down do need installations). Just read some commented code and get it running quickly to gather some intuitions.
You can have it even simpler and just run code in your browser without installing anything: here.
neuralNet1.py
: version 1 example of a very simplified neural network, using sensitivity parameter.neuralNet2.py
: version 2 example of a very simplified neural network, with weighting based on "responsibilities" of different inputs. (This one seems really fast but may be unstable or naive because it's basically using learning sensitivity = 1.)neuralNet3.py
: version 3 example of a very simplified neural network that combines version 1 and version 2, combining sensitivity parameter and "responsibilities" of different inputs.
neuralNet4_Layered.py
: version 4 example of a neural network that kinda combines version 2 and version 3, with learning error sensitivity, but also with a hidden layer. It also has a transformed version of the sigmoid function that goes from -1 to 1.
predatorSim1D.py
andpredatorSim2D.py
: animated simulations of a "predator" learning to move towards a target. Based on my turtle code and also a mix of my neural nets above: sensitivity parameter, weightings, inputs, but no hidden layer. See it run here or here.
You can try out the following web app live on CodePen: https://codepen.io/hchiam/full/rrwQRa.
Under "webApp_MachineLearning_Gesture" folder:
gestures.html
: the "structure" of the presentation of the web page.gestures.js
: the "brains" of the web page. Tries to detect a mouse gesture when the mouse runs over the "pad".
https://github.com/hchiam/word_gen
https://github.com/hchiam/ai_for_robotics
https://github.com/hchiam/cogLang-geneticAlgo
neuralNet_iamtrask.py
: "11 lines of code" for a 2-layer neural net code from http://iamtrask.github.io/2015/07/12/basic-python-network. Requires NumPy installed to run.
The next few code samples are based on "Machine Learning Recipes with Josh Gordon" at: https://www.youtube.com/playlist?list=PLOU2XLYxmsIIuiBfYad6rFYQU_jL2ryal, which is also listed in the Google Developers YouTube channel.
-
googleExample.py
: machine learning in 6 lines of code, from https://youtu.be/cKxRvEZd3Mw, listed under the Google Developers channel on YouTube. Requires scikit-learn (sklearn) installed to run. Decision tree classifier. Supervised learning. -
googleExample2.py
: decision tree classifier applied to Fisher's Iris flower data set, from https://www.youtube.com/watch?v=tNa99PG8hR8, listed under the Google Developers channel on YouTube. Requires scikit-learn and NumPy installed to run. You can also get a visualization (watch the video for how). -
googleExample3.py
: a higher-level take on the decision tree classifier ingoogleExample2.py
. Requires scikit-learn installed to run. -
googleExample4.py
: building your our classifier.randomGuessClassifier()
andKNearestNeighbours_barebones()
. -
googleExample5.py
andgoogleExample6.md
: image classification examples.
https://github.com/hchiam/machineLearning/blob/main/machinelearningmastery
nes.py
. See https://blog.openai.com/evolution-strategies/
https://github.com/hchiam/learning-keras
A JavaScript neural network library. My example codepen:
https://codepen.io/hchiam/pen/gWydZd?editors=1010
https://codepen.io/hchiam/pen/LrJVPQ
https://github.com/hchiam/nlp_spacy_textacy
For example, here's a video I found helpful for understanding RNNs and LSTM: https://www.freecodecamp.org/learn/machine-learning-with-python/how-neural-networks-work/recurrent-neural-networks-rnn-and-long-short-term-memory-lstm
Then later reading up on attention and Transformers makes more sense.
https://github.com/hchiam/crash-course-ai-labs
https://github.com/hchiam/learning-automl
https://www.youtube.com/@statquest - like this clear explanation of ROC and AUC or of transformers
https://www.youtube.com/@TwoMinutePapers
https://www.youtube.com/@twimlai - hear about things like AI-GAs, Quality-Diversity algorithms, jailbreaking, filters, adversarial training, pre-training, and more.