Comments (2)
Thanks for catching that! This specific example is fixed (in #179); we'll do an editing pass through all the code examples at some point, which should help catch the rest. In the meantime, feedback like this is really helpful.
I recall that, in older versions of Python, i
would have been in scope outside the list comprehension
An alternative would be to have a named function:
def laguerre(i):
return lambda s: (np.log(1 + np.exp(-s.state / 2 * strike)) * \
lagval(s.state / strike), ident[i])
ffs += [laguerre(i) for i in range(num_laguerre)]
(I haven't tested this exact code, so there might be some typos.)
Which version seems clearer? I don't have a feel for which approach would be more pythonic.
from rl-book.
Fixed
from rl-book.
Related Issues (20)
- rl.distribution, etc. HOT 2
- requirements.txt issues on Windows HOT 6
- requests package conflict HOT 2
- typo LSPI HOT 2
- typo HOT 1
- Code example not properly indented p.55 HOT 1
- Book feature Request -- keep indentation when copying code from pdf HOT 1
- typing or rl.distribution? HOT 1
- chapter numbering in pdf and rl folder HOT 1
- Typo in codes RL-book/rl/chapter2/simple_inventory_mrp.py/ HOT 1
- Code example missing statement p 50
- Mistake in summation for Stationary Distribution HOT 1
- Dynamic Programming convergence control
- About the code in simple_inventory_mdp_nocap.py in chapter3
- Coin() returns str, but mean() expects a list of numbers HOT 1
- State-Reward Sequence HOT 1
- Inconsistent code snippet imports HOT 2
- typo pg. 125 HOT 1
- typo pg. 200 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rl-book.