Deep Learning Custom Training Loop
1 回表示 (過去 30 日間)
古いコメントを表示
If I want to use matlab to strengthen learning and interact with the experimental environment, can I get data with sim function?
out=sim(agent, env);
for stepCt = 1:maxSteps
% Append experience to replay memory buffer.
myBuffer.observations=out.Observation.observations.Data(:,:,1:myBuffer.bufferSize-1);
myBuffer. nextObservation=out.Observation.observations.Data(:,:,2:myBuffer.bufferSize);
myBuffer.action =out.Action.force.Data;
myBuffer.reward = out.Reward.Data;
myBuffer.isDone = out.IsDone.Data;
0 件のコメント
回答 (1 件)
Omega
2024 年 10 月 22 日
Hi Jiayi,
Yes, you can use the "sim" function in MATLAB to interact with an experimental environment when you're working on reinforcement learning or custom training loops. The "sim" function allows you to simulate the agent's interaction with the environment and collect data like "observations", "actions", "rewards", and terminal states ("isDone").
Your code snippet looks good for storing experiences in a replay buffer:
out = sim(agent, env); % Runs the sim.
% Store observations, actions, rewards, and isDone flags in myBuffer.
Make sure your buffer size and indexing (1:myBuffer.bufferSize-1 and 2:myBuffer.bufferSize) are set correctly to avoid indexing errors. Also, ensure that your environment and agent are properly defined to provide the expected data structure.
To learn more about the "sim" function, you can refer to the following documentation link:
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!