paint-brush
Technology Fridays: Why Bonsai is a Great Addition to Microsoft’s AI Stackby@jrodthoughts
1,391 reads
1,391 reads

Technology Fridays: Why Bonsai is a Great Addition to Microsoft’s AI Stack

by Jesus RodriguezJune 22nd, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Earlier this week, Microsoft announced that is continuing its acquisition spree by <a href="https://www.zdnet.com/article/microsoft-buys-machine-learning-startup-bonsai/" target="_blank">purchasing machine learning startup Bonsai</a>. The should not be completely surprising as Microsoft had already indicated its interest in Bonsai by <a href="http://www.businessinsider.com/microsoft-and-nea-invest-76-million-in-bonsai-ai-2017-5" target="_blank">leading a $7.6M investment round in the startup last year</a>. I’ve written about Bonsai extensively before but today I would like to dig deeper into the elements that make this platform unique in the deep learning space.

Company Mentioned

Mention Thumbnail
featured image - Technology Fridays: Why Bonsai is a Great Addition to Microsoft’s AI Stack
Jesus Rodriguez HackerNoon profile picture

Earlier this week, Microsoft announced that is continuing its acquisition spree by purchasing machine learning startup Bonsai. The should not be completely surprising as Microsoft had already indicated its interest in Bonsai by leading a $7.6M investment round in the startup last year. I’ve written about Bonsai extensively before but today I would like to dig deeper into the elements that make this platform unique in the deep learning space.

At a high level, you can think of Bonsai as a platform that provides a simpler way to build, train and execute deep learning models without dealing with the low level constructs of frameworks such as TensorFlow, MxNet or Microsoft’s own Cognitive Toolkit. However, the Bonsai platform is much more. Bonsai focuses on an area that they like to call machine teaching and that can be seen as a variation of reinforcement learning. In the Bonsai world, the goal of machine teaching models is to program a BRAIN to solve problems in complex environments by following the action-reward model of reinforcement learning algorithms. Specifically, Bonsai’s describes machine teaching in three easy steps.

The BRAIN

The Bonsai platforms abstracts BRAINs using four simple concepts known as STAR (State, Terminal, Action, Reward).

Typically, the implementation of a BRAIN is divided between a model written in a domain specific language known as Inkling and a simulator which is typically authored in Python.

The Inkling Language

Reinforcement learning problems in the Bonsai platform are modeled using Inkling, a functional, domain-specific language specialized on representing learning scenarios. Examples of learning scenarios could be:

  • Learning to play a game
  • Learning to recognize what a handwritten digit is
  • Learning to tell if something is red or what color something is
  • Learning to save electricity in your home
  • Learning to manage a process to specific guidelines

Inkling is based on three fundamental constructs: Concepts, Schemas, Curriculums and Lessons.

The following example, from the Bonsai documentation, represents an Inkling program used to keep the internal temperature of a house. You can see how the language combines the aforementioned constructs.

schema HouseheatState    Float32 heat_cost,    Float32 temperature_difference,    Float32 temperature_difference_t1,    Float32 temperature_difference_t2,    Float32 temperature_difference_t3,    Float32 temperature_difference_t4,    Float32 temperature_difference_t5,    Float32 outside_temp_changeendschema HouseheatAction    Float32{ 0.0:1:1.0 } heater_onendschema HouseheatConfig    Float32 outside_phaseendconcept thermostat is classifier   predicts (HouseheatAction)   follows input(HouseheatState)   feeds outputendsimulator simulink_sim(HouseheatConfig)    action (HouseheatAction)    state (HouseheatState)endcurriculum my_curriculum    train thermostat    with simulator simulink_sim    objective match_set_temp        lesson my_first_lesson            configure            constrain outside_phase with Float32{0.0:12.0}            until                maximize match_set_temp        lesson my_second_lesson            configure            constrain outside_phase with Float32{0.0:24.0}            until                maximize match_set_temp        lesson my_third_lesson            configure            constrain outside_phase with Float32{0.0:48.0}            until                maximize match_set_tempend

Using Bonsai

Developers can start using Bonsai by downloading the platforms into their local environment. Depending on the project, the platforms might include dependencies on other technologies such as Anaconda or OpenAI Gym.

Using the Bonsai CLI, we can create a BRAIN by using the following command line.

bonsai create myMountainCarBrain

At that point, its just a matter of starting the Python simulator and process the Inkling model. Bonsai can also be used in Jupyter notebooks. The Bonsai platform provides tools to visualize the monitor the status of the BRAIN.

What Microsoft Get with Bonsai?

By acquiring Bonsai, Microsoft gets leading platform in the reinforcement learning space. We can expect Microsoft to integrate the Bonsai platform with the rest of its artificial intelligence(AI) stack such as Azure Machine Learning or the Cognitive Toolkit.