Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/lazyprogrammer/machine_learning_examples
/ sample_action
Method
sample_action
rl2/cartpole/pg_tf.py:113–115 ·
view source on GitHub ↗
(self, X)
Source
from the content-addressed store, hash-verified
111
return
self.session.run(self.predict_op, feed_dict={self.X: X})
112
113
def
sample_action(self, X):
114
p = self.predict(X)[0]
115
return
np.random.choice(len(p), p=p)
116
117
118
# approximates V(s)
Callers
2
play_one_td
Function · 0.45
play_one_mc
Function · 0.45
Calls
1
predict
Method · 0.95
Tested by
no test coverage detected