Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Reinforcement Learning

Discussion in 'General Discussion' started by jwh244, Mar 17, 2016.

  1. jwh244

    jwh244

    Joined:
    Aug 28, 2015
    Posts:
    1
    Has anyone used unity for a reinforcement learning DeepQ type model?

    I have some machine learning code in tensorflow (python) and for each training step I want to manipulate the simulation, and return sensor data to train my AI.

    RL-Glue gets very very close to what I need, but there currently is no javascript or c# codec for it.

    I am currently contemplating whether or not it would be possible to write a c++ library to import to my project, but i'm thinking that is not possible since I need a way to communicate data to my simulation from the python program.

    Does anyone have any experience with this that could offer some insight?
     
  2. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    I have a deep neural net in python (using Theano), I use it from Java (it is not a game, so no Unity). I just send the data I need using TCP/IP from one end to the other during training of the net.

    So serialize your info in Unity and send it to python.

    However, for the final product (so when using the trained network) I needed more performance, the TCP/IP became the bottleneck. So I translate the final net to C++ code and load that dyn lib on Java side (use manual loop unrolling, you get better performance than what the C++ compiler will give you). That part is just about 20 lines of python code (generate C++ code from given net, create Java stub class, trigger compilations, done).
     
    Last edited: Mar 17, 2016