chiphuyen / python-is-cool Goto Github PK
View Code? Open in Web Editor NEWCool Python features for machine learning that I used to be too afraid to use. Will be updated as I have more time / learn more.
Home Page: https://huyenchip.com
Cool Python features for machine learning that I used to be too afraid to use. Will be updated as I have more time / learn more.
Home Page: https://huyenchip.com
Hi! Super useful compilation - some of these took me years to discover. I'll certainly be directing people here, so thanks for taking the time.
I believe there may be a small issue with the text in section 2.2, this bit:
The syntax [x:y:z] means "take every zth element of a list from index x to index y", with 0 being the default value of x and -1 being the default value of y. When z is negative, it means going backwards. So if we want to take every 2th element of a list, we use [::2], which is the same as
[0:-1:2]
.
My understanding is that -1 isn't the default value of y, and [::2]
is different to [0:-1:2]
. Specifically, [x:y]
means 'start at index x, stop before index y'. The default value of y is kind-of -0 (although that would be bad syntax), and using [:-1]
will drop the last element.
Concretely (I tried it with python 3.6):
k = [0, 1, 2, 3, 4, 5, 6, 7, 8] # odd number of elements
a = k[::2] # a <- [0, 2, 4, 6, 8]
b = k[0:-1:2] # b <- [0, 2, 4, 6]
In the second case the indexing starts at 0, ends before 8, and strides by 2.
Hope this is a useful contribution!
Will it be cool to add forced-named arguments to this list?
def foo(pos, *, forcenamed):
print(pos, forcenamed)
>>> foo(pos=10, forcenamed=20)
10 20
>>> foo(10, forcenamed=20)
10 20
Thank you for this guide.
In section 5 I think:
If we intend that only Endoer, Decoder, and Loss are ever to be imported and used in another module, we should specify that in parts.py using the all keyword.
was intended to be:
If we intend that only Encoder, Decoder, and Loss are ever to be imported and used in another module, we should specify that in parts.py using the all keyword.
In block [5] of the notebook, you accidentally took the square root of the total square error, converting it into mean absolute error.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.