# Njit-ing an sklearn function

**URL:** https://numba.discourse.group/t/njit-ing-an-sklearn-function/360
**Category:** Support: What is this error message?
**Created:** [November 24, 2020, 7:42pm UTC](https://numba.discourse.group/t/njit-ing-an-sklearn-function/360 "2020-11-24T19:42:58Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![wilky\_way](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/wilky_way/32/130_2.png) [@wilky\_way](https://numba.discourse.group/u/wilky_way)
#### Post date: [November 24, 2020, 7:42pm UTC](https://numba.discourse.group/t/njit-ing-an-sklearn-function/360/1 "2020-11-24T19:42:58Z")

</div>

Hi,

I’m getting this error message:  
“untyped global name ‘matthews\_corrcoef’: cannot determine numba type of \<class ‘function’\>”

from the following code:

```
from sklearn.metrics import matthews_corrcoef

@njit
def wrapped_matthews(df):
    return matthews_corrcoef(df[:,0],df[:,1])

```

the code of the matthews\_corrcoef function is mostly array operations with numpy - is there any way to leverage this in numba without re-writing the code?

thanks!

---

<div class="post-metadata">

### Author: ![luk-f-a](https://yyz2.discourse-cdn.com/free1/user_avatar/numba.discourse.group/luk-f-a/32/56_2.png) [@luk-f-a](https://numba.discourse.group/u/luk-f-a)
#### Post date: [November 25, 2020, 8:37am UTC](https://numba.discourse.group/t/njit-ing-an-sklearn-function/360/2 "2020-11-25T08:37:33Z")

</div>

hi @wilky_way

assuming that everything inside `matthews_corrcoef` is compatible with Numba (including not calling any other non-jitted function), you could do

```auto
from sklearn.metrics import matthews_corrcoef

wrapped_matthews = njit(matthews_corrcoef)

```

However, even one single non-compatible feature will make the compilation fail. The general way to tackle this problem is using `@overload`, [https://numba.pydata.org/numba-doc/dev/extending/overloading-guide.html](https://numba.pydata.org/numba-doc/dev/extending/overloading-guide.html)

You would have to take the code of `matthews_corrcoef` and adapt any non-compatible code until the compilation succeeds.

Cheers,  
Luk
