New answers tagged

0 votes

Find 1s in almost all 0 array using comparisons only

Your current code has the following issues: for i in range(0, len(data), 2): This is where you need to put the optimization to (conditionally) avoid comparing ...
Douglas's user avatar
  • 201
2 votes

Find 1s in almost all 0 array using comparisons only

Start by splitting the 100 elements in 50 pairs of two, and use a comparison on each pair. If a comparison returns -1 or 1, then you've found one of the elements which is 1 (and the other one must be ...
orlp's user avatar
  • 13k
0 votes

Python Scikit-Learn transformation

You can build a model from either untransformed data or from transformed data. The only requirement is that, at test time, you must apply the model to the same sort of data. Which will perform better?...
D.W.'s user avatar
  • 158k
0 votes

A floating-point rounding problem

Python float corresponds to C++ double. According to Institute of Electrical and Electronics Engineers Standard for Floating-...
Kenneth Kho's user avatar
3 votes

How does numpy.linalg.inv calculate the inverse of a matrix?

The source code of this function is here, which is a wrapper for a C++ function here, which is calling some BLAS/LAPACK library functions. Specifically, in order to compute the inverse of a matrix $A$,...
Discrete lizard's user avatar
  • 8,128

Top 50 recent answers are included