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

Function get_scaler

tf2.0/keras_trader.py:73–87  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

71
72
73def get_scaler(env):
74 # return scikit-learn scaler object to scale the states
75 # Note: you could also populate the replay buffer here
76
77 states = []
78 for _ in range(env.n_step):
79 action = np.random.choice(env.action_space)
80 state, reward, done, info = env.step(action)
81 states.append(state)
82 if done:
83 break
84
85 scaler = StandardScaler()
86 scaler.fit(states)
87 return scaler
88
89
90

Callers 1

keras_trader.pyFile · 0.70

Calls 2

stepMethod · 0.45
fitMethod · 0.45

Tested by

no test coverage detected