3 ms·
I had a look though this and was confused by this line: ratings[ratings<1.0] = 1.0 in https://github.com/alexbw/Netflix-Prize/blob/master/src/predict.py http
by tlocke 14y ago
I had a look though this and was confused by this line:
ratings[ratings<1.0] = 1.0
in
https://github.com/alexbw/Netflix-Prize/blob/master/src/predict.py https://github.com/alexbw/Netflix-Prize/blob/master/src/pred...
Is it specific to NumPy? Or perhaps a Python trick I haven't seen before?
- jdleesmiller 14y agoI believe that's an example of 'logical indexing', which is a useful feature in many vector-oriented languages / packages: http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/ http://blogs.mathworks.com/steve/2008/01/28/logical-indexing...
- malkarouri 14y agoSpecific to NumPy. Boolean indexing. http://www.scipy.org/Cookbook/Indexing#head-86055279f6592d36b8956f3400e3716c6491ae95 http://www.scipy.org/Cookbook/Indexing#head-86055279f6592d36...