(env)
| 27 | |
| 28 | |
| 29 | def get_scaler(env): |
| 30 | # return scikit-learn scaler object to scale the states |
| 31 | # Note: you could also populate the replay buffer here |
| 32 | |
| 33 | states = [] |
| 34 | for _ in range(env.n_step): |
| 35 | action = np.random.choice(env.action_space) |
| 36 | state, reward, done, info = env.step(action) |
| 37 | states.append(state) |
| 38 | if done: |
| 39 | break |
| 40 | |
| 41 | scaler = StandardScaler() |
| 42 | scaler.fit(states) |
| 43 | return scaler |
| 44 | |
| 45 | |
| 46 |
no test coverage detected