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

Function get_scaler

tf2.0/mlp_trader.py:58–72  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

56
57
58def 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

Callers 1

mlp_trader.pyFile · 0.70

Calls 2

stepMethod · 0.45
fitMethod · 0.45

Tested by

no test coverage detected