54 karma · joined Jan 25, 2017 (9y ago) · 13 submissions
comment 4y ago · link · parent
I don't think UK people are inheritantly less ambitious than anywhere else, but the very low social mobility here has always dragged down potential for some, while the punishing austerity and lack of investment over the past decade has limited other people's opportunities further.
comment 4y ago · link · parent
Sure, there'll be a subset of users of these libraries that have read ML/textbooks and are familiar with what η means in this context.
Today, many (most?) users of ML libraries will probably not know what η means without looking it up. Adhering to mathematical notation puts up an unnecessary barrier to using the API/code and ultimately limits wider engagement/collaboration.
To attract a bigger slice of the ML community, choosing names that the ML hobbyyist can read, understand and use without pause is the better path forward.
comment 6y ago · link · parent
In the example given above the 3D array and 2D array have shape (lengths of dimensions):
(2, 3, 4)
(2, 3)
That is - the suffixes do not agree (4 != 3 and 3 != 2) and NumPy raises an error.However, for the same operation in J the prefixes agree:
(2, 3, 4)
(2, 3)
and the addition gives the expected result.To add the arrays with these shapes in NumPy, one method is transpose each array (reverse order of the dimensions), add these arrays, and then transpose back:
(a.T + b.T).Tcomment 8y ago · link · parent
comment 8y ago · link · parent
There's also a great guide to cleaning bones from animals (in various states of decay) on the blog Jake's Bones that I've referred to a couple of times: http://www.jakes-bones.com/p/how-to-clean-animal-bones.html
comment 8y ago · link · parent
There's also pandas_exercises by Guilherme Samora (https://github.com/guipsamora/pandas_exercises) which is very good - it's split across multiple notebooks and is more extensive than my repo.
comment 8y ago · link · parent
For question 48 it might be simpler to just write
np.sort(a)[-5:]
instead of using argsort() and then using fancy indexing. Better yet, use np.partition(a, kth=-5)[-5:]
which scales linearly with the size of the array.Also, the one-hot encoding puzzle (51) would be more efficiently solved using
(arr[:, None] == np.unique(arr)).view(np.int8)
In general, `for` loops over NumPy arrays should be avoided where at all possible.comment 9y ago · link · parent
You are making the flattened list by continually concatenating the smaller lists. Each concatenation creates the new bigger list from scratch; the flattened list does not grow dynamically. This is quadratic-performance bad.
Use `list(itertools.chain.from_iterable(...))` instead.