Code Monkey home page Code Monkey logo

Comments (1)

jni avatar jni commented on August 26, 2024

Hey! Glad to hear it is useful! 😊 (Still — I haven't revisited this package anywhere near as much as I'd like to.)

Anyway, it seems you've hit a numba issue. Numba has support for many NumPy functions inside JITted functions, but if you look closely at this part of the error:

numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
No implementation of function Function(<function nanstd at 0x000001BA5B414F70>) found for signature:
 
 >>> nanstd(array(float64, 1d, C), ddof=Literal[int](1))
 
There are 2 candidate implementations:
  - Of which 2 did not match due to:
  Overload in function 'np_nanstd': File: numba\np\arraymath.py: Line 1231.
    With argument(s): '(array(float64, 1d, C), ddof=int64)':
   Rejected as the implementation raised a specific error:
     TypingError: got an unexpected keyword argument 'ddof'
  raised from C:\Users\jbrown\AppData\Local\Programs\Python\Python38\lib\site-packages\numba\core\typing\templates.py:791

it's not expecting the ddof argument, and if you look at their NumPy support page:

https://numba.readthedocs.io/en/stable/reference/numpysupported.html#reductions

indeed it says that only the first argument of nanstd is supported.

You could raise an issue with numba, or you can code up your own nanstd (or nnzstd since you're apparently just looking to get rid of zeros?) and jit-compile it with Numba. Something like:

@numba.njit
def nnzstd(arr):
    nz = arr[arr != 0]
    n = len(nz)
    if n <= 1:
        return np.nan
    mu = np.mean(nz)
    var = np.sum((nz - mu) ** 2) / n - 1
    std = np.sqrt(var)
    return std

Since this is not an llc issue I'm going to close it, but please feel free to continue discussing this issue here if you have more questions!

from llc-tools.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.