MCPcopy Index your code
hub / github.com/lazyprogrammer/machine_learning_examples / get_scaler

Function get_scaler

tf2.0/rl_trader.py:66–80  ·  view source on GitHub ↗
(env)

Source from the content-addressed store, hash-verified

64
65
66def 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

Callers 1

rl_trader.pyFile · 0.70

Calls 2

stepMethod · 0.45
fitMethod · 0.45

Tested by

no test coverage detected