Description
Is your feature request related to a problem? Please describe.
I have models at work that are build in C# and VB.NET, that I'm using for reinforcement learning.
Currently I have an unpleasant and nonperformant mechanism for connecting the VB.NET models to python so that I can use openai gym for RL. If I could use modelbuilder/ML.NET for RL, it would improve my life considerably. [The model is ~35k SLOC in VB.NET]
Describe the solution you'd like
Something akin to the current "Limited Scenarios" of anomaly detection, forecasting, clustering.
It would be nice if it largely involved my model implementing an interface something like OpenAI's Gym, and then a basic demonstration of PPO/TRPO/some policy gradient descent/etc in C#, built using ML.NET.
Describe alternatives you've considered
I already have a solution using Python, where I've implemented the OpenAI Gym interface. It opens a pipe onto my model's stdin/stdout, then has to re-parse all the models inputs. I've reimplemented pretty much the entire parsing part of the main model, in Python, and then use Python to build the observation space, because shuttling the entire observation space along a pipe.
The performance of this house of cards is terrible [and in RL, faster performance==more learning]. The observation is relatively slow to create in general; it's expensive to create in VB.NET then shuttle over the pipe; and it's expensive to create in python, where threading isn't an option due to the GIL, and the raw performance of many sin/cos/tan operations is also poor. It's not robust because now I'm trying to maintain two separate codebases that do the same thing [parsing all the inputs and reimplementing small parts of the model].
Additional context
I'm finding ML.NET great for most tasks, but RL is a central task in my daily work, and currently I have to go to python to achieve that. We are also looking at Unity for some projects, and AI in Unity would very clearly be better run using C#+ML.NET.
Activity
beccamc commentedon Oct 1, 2020
@briacht for visibility
JakeRadMSFT commentedon Nov 2, 2020
Thanks for the recommendation! We'll investigate what options we have ... Do you have any example code you could share?
Were you able to find any .NET ways to do RL?
JakeRadMSFT commentedon Nov 2, 2020
Related: dotnet/machinelearning#181 (comment)
chunky commentedon Nov 3, 2020
I'm afraid all the code I use in this space is off-the-shelf python. The main things I used are openai baselines and Ray RLLib. I was much more focused on developing a useful model to do RL in, than on the RL algorithms themselves.
By extension, I simply gave up trying to do RL in ML.NET. :-(
johnwc commentedon May 31, 2021
@JakeRadMSFT @briacht @beccamc Any updates on RL? It seems that this is a bit of popular want/need in ML.net. In our scenario, we are looking to use it to control temperature/humidity in a warehouse by controlling fans, monitoring several temperature/humidity devices inside along with outside temperature/humidity.
luisquintanilla commentedon Jun 13, 2022
Hi @chunky & @johnwc
Reinforcement learning is currently not part of our roadmap mainly because it's not natively supported in the framework. However, as we hear more from the community we can take a look at this at a later time. In the meantime, there is a project that shows how to use RL models with ML.NET that you might be interested in:
https://github.com/JimFFM/ml-hackathon-2021/tree/main/Godot_NET-Server/godot_net_server
johnwc commentedon Jun 14, 2022
Should we open a request for RL in the framework's repo?
luisquintanilla commentedon Jun 15, 2022
@johnwc That would be great. Thanks!
luisquintanilla commentedon Sep 22, 2022
Thanks @johnwc @chunky for the discussion.
Issue dotnet/machinelearning#181 has been reopened to track feedback. Closing this issue for now since it's currently not possible without framework support in Model Builder / ML.NET CLI.
Viir commentedon Sep 22, 2022
Thank you for the update Luis,
however, it looks like dotnet/machinelearning#181 is not yet completely reopened, as comments are still disabled there:
The UI says:
luisquintanilla commentedon Sep 22, 2022
@Viir thanks for the heads up. It should be fixed now. Thanks.