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