(env)
| 71 | |
| 72 | |
| 73 | def get_scaler(env): |
| 74 | # return scikit-learn scaler object to scale the states |
| 75 | # Note: you could also populate the replay buffer here |
| 76 | |
| 77 | states = [] |
| 78 | for _ in range(env.n_step): |
| 79 | action = np.random.choice(env.action_space) |
| 80 | state, reward, done, info = env.step(action) |
| 81 | states.append(state) |
| 82 | if done: |
| 83 | break |
| 84 | |
| 85 | scaler = StandardScaler() |
| 86 | scaler.fit(states) |
| 87 | return scaler |
| 88 | |
| 89 | |
| 90 |
no test coverage detected