(env)
| 56 | |
| 57 | |
| 58 | def get_scaler(env): |
| 59 | # return scikit-learn scaler object to scale the states |
| 60 | # Note: you could also populate the replay buffer here |
| 61 | |
| 62 | states = [] |
| 63 | for _ in range(env.n_step): |
| 64 | action = np.random.choice(env.action_space) |
| 65 | state, reward, done, info = env.step(action) |
| 66 | states.append(state) |
| 67 | if done: |
| 68 | break |
| 69 | |
| 70 | scaler = StandardScaler() |
| 71 | scaler.fit(states) |
| 72 | return scaler |
| 73 | |
| 74 | |
| 75 |
no test coverage detected