Read data from csv file into a reward function for Reinforcement Learning
4 ビュー (過去 30 日間)
古いコメントを表示
M Abhijith Bhuvandas
2021 年 3 月 15 日
回答済み: jeyasheelarakkini joseph
2021 年 10 月 12 日
I have a list of coordinates (in a CSV file) that I want my RL model to imitate.
To do that, I wanted to compare the current coordinates of the model with the coordiantes from the csv file and set the reward based on the distance.
I tried readtable in the reward function itself but I got the error 'function not supported for code generation'. I tried moving that out and evalin the coordinates but evalin function was also not supported.
So how can I get the coordinates into the Reward function?
This is probably very simple but I am not familar with matlab.
The reward function is a MATLAB Function from Simulink/Used-Defined Functions.
I am using the Reinforcement Learning toolbox, in R2020b.
0 件のコメント
採用された回答
Emmanouil Tzorakoleftherakis
2021 年 3 月 18 日
It seems like you were trying to read the file from within the MATLAB Fcn block (this block assumes that anything you write in it supports code generation). One workaround is to use 'coder.extrinsic' on readtable. That should remove the codegen error although I am not sure if it makes sense to read the file every time the block is executed. Maybe reading the file from a script beforehand and using blocks like this would be more efficient.
0 件のコメント
その他の回答 (1 件)
jeyasheelarakkini joseph
2021 年 10 月 12 日
i have a csv file where some of the attributes i need to give to a q learning agent(ephilson greedy), if the next row attribute value is greater than i can switch to that state or else stay in the same state.The state space can be formed at random from the CSV file with n number of rows and columns
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Environments についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!