MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_scaler

Function get_scaler

pytorch/rl_trader.py:61–75  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

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

Callers 1

rl_trader.pyFile · 0.70

Calls 2

stepMethod · 0.45
fitMethod · 0.45

Tested by

no test coverage detected