Machine Learning & Unity
Andre Odendaal
http://omgsoftware.co.za
@Fengol
What I’m going to cover
As non-technical as possible
• What can Machine Learning do
• How does Unity fit in
• The technical stuff
• Where to get started
• Questions
• Goal: What is machine learning
What can Machine Learning do?
Data Science!
Real Life Example
OpenAI Gym
• OpenAI Gym is a toolkit for
developing and comparing
reinforcement learning
algorithms
• http://gym.openai.com/envs
Reinforcement Learning
How does Unity fit in
1. Unity is an environment we can observe
• Its runs the physics engine and outputs the observation or state and reward
• Its accepts our action
• The internal state developed in Python and UnityEnvironment is a
library for hosting games, retrieving observations and submitting
actions
2. Unity can run a trained model
• Unity uses TensorFlowSharp to run trained models
Demo UnityEnvironment
Recreating OpenAI’s FrozenLake in Unity (with Santa!)
Brain Neurons & Dial Boards
Neural Network
Technical Stuff
• A neuron is a number
between 0 and 1
• A neural layer is an array of
neurons (called a tensor)
• A neural network is an array
of arrays of arrays of … (also
called a tensor)
• Machine Learning is tuning
the values of the neurons
(tensor computation)
Underpants Gnomes Explanation
Technical Stuff cont.
• Tuning is done with
Regression, modelling the
relationship between
independent data (input) and
dependent data (output)
• We compare the output of
the neural network with an
expected value (called a loss
function) and use the
difference to update the
neurons.
Demo Model Training
Let the machine play instead of the humans
Where to get started
• Watch 3Blue1Brown’s videos on the subject
• https://www.youtube.com/watch?v=aircAruvnKk
• Install Python and TensorFlow
• https://www.python.org
• https://www.tensorflow.org
• Experiment using OpenAI Gym
• http://gym.openai.com/envs
• Create custom environments in Unity
• https://unity3d.ai
Further Reading
• Master Machine Learning Algorithms
• Jason Brownlee
• http://machinelearningmastery.com
• Data Science from Scratch
• Joel Grus
• http://joelgrus.com
• Simple Reinforcement Learning with Tensorflow series
• Arthur Juliani
• https://medium.com/emergent-future/simple-reinforcement-
learning-with-tensorflow-part-0-q-learning-with-tables-and-neural-
networks-d195264329d0
Questions
and thank you for listening!

Machine Learning & Unity

  • 1.
    Machine Learning &Unity Andre Odendaal http://omgsoftware.co.za @Fengol
  • 2.
    What I’m goingto cover As non-technical as possible • What can Machine Learning do • How does Unity fit in • The technical stuff • Where to get started • Questions • Goal: What is machine learning
  • 3.
    What can MachineLearning do? Data Science!
  • 4.
  • 5.
    OpenAI Gym • OpenAIGym is a toolkit for developing and comparing reinforcement learning algorithms • http://gym.openai.com/envs
  • 6.
  • 7.
    How does Unityfit in 1. Unity is an environment we can observe • Its runs the physics engine and outputs the observation or state and reward • Its accepts our action • The internal state developed in Python and UnityEnvironment is a library for hosting games, retrieving observations and submitting actions 2. Unity can run a trained model • Unity uses TensorFlowSharp to run trained models
  • 8.
    Demo UnityEnvironment Recreating OpenAI’sFrozenLake in Unity (with Santa!)
  • 9.
    Brain Neurons &Dial Boards
  • 10.
  • 12.
    Technical Stuff • Aneuron is a number between 0 and 1 • A neural layer is an array of neurons (called a tensor) • A neural network is an array of arrays of arrays of … (also called a tensor) • Machine Learning is tuning the values of the neurons (tensor computation)
  • 13.
  • 14.
    Technical Stuff cont. •Tuning is done with Regression, modelling the relationship between independent data (input) and dependent data (output) • We compare the output of the neural network with an expected value (called a loss function) and use the difference to update the neurons.
  • 15.
    Demo Model Training Letthe machine play instead of the humans
  • 16.
    Where to getstarted • Watch 3Blue1Brown’s videos on the subject • https://www.youtube.com/watch?v=aircAruvnKk • Install Python and TensorFlow • https://www.python.org • https://www.tensorflow.org • Experiment using OpenAI Gym • http://gym.openai.com/envs • Create custom environments in Unity • https://unity3d.ai
  • 17.
    Further Reading • MasterMachine Learning Algorithms • Jason Brownlee • http://machinelearningmastery.com • Data Science from Scratch • Joel Grus • http://joelgrus.com • Simple Reinforcement Learning with Tensorflow series • Arthur Juliani • https://medium.com/emergent-future/simple-reinforcement- learning-with-tensorflow-part-0-q-learning-with-tables-and-neural- networks-d195264329d0
  • 18.