# MLJ NuSVM predict function not found

**URL:** https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148
**Category:** General Usage
**Created:** [October 19, 2023, 1:57am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148 "2023-10-19T01:57:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bryaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bryaan/32/36858_2.png) [@bryaan](https://discourse.julialang.org/u/bryaan)
#### Post date: [October 19, 2023, 1:57am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148/1 "2023-10-19T01:57:51Z")

</div>

I’m having an issue using MLJ NuSVR model. From the docs this should be working.

> **[NuSVR · MLJ](https://alan-turing-institute.github.io/MLJ.jl/dev/models/NuSVR_LIBSVM/)**
>
> Documentation for MLJ.

```julia
NuSVR = @load NuSVR pkg=LIBSVM                  
model = NuSVR(kernel=LIBSVM.Kernel.RadialBasis)  

# SVMRegressor = @load SVMRegressor pkg=MLJScikitLearnInterface
# model = SVMRegressor()

mach = machine(model, X, y) 
mach |> fit!

yhat = LIBSVM.predict(mach, Xnew)

```

I get this error:

```julia

MethodError: no method matching predict(::Machine{MLJLIBSVMInterface.NuSVR, true}, ::Vector{Float64})

Closest candidates are:
  predict(::LIBSVM.LinearSVC, ::AbstractArray)
   @ LIBSVM ~/.julia/packages/LIBSVM/IZl0L/src/ScikitLearnAPI.jl:11
  predict(::Union{LIBSVM.AbstractSVC, LIBSVM.AbstractSVR}, ::AbstractArray)
   @ LIBSVM ~/.julia/packages/LIBSVM/IZl0L/src/ScikitLearnAPI.jl:6

```

---

<div class="post-metadata">

### Author: ![math4mad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math4mad/32/49486_2.png) [@math4mad](https://discourse.julialang.org/u/math4mad)
#### Post date: [October 19, 2023, 7:42am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148/2 "2023-10-19T07:42:53Z")

</div>

Checking `Xnew`’s type , should be same with `X`’s type

---

<div class="post-metadata">

### Author: ![math4mad](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/math4mad/32/49486_2.png) [@math4mad](https://discourse.julialang.org/u/math4mad)
#### Post date: [October 19, 2023, 7:48am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148/3 "2023-10-19T07:48:13Z")

</div>

```julia
import LIBSVM
import MLJ:predict
using MLJ

NuSVR = @load NuSVR pkg=LIBSVM ## model type
model = NuSVR(kernel=LIBSVM.Kernel.Polynomial) ## instance

X, y = make_regression(rng=123) ## table, vector
mach = machine(model, X, y) |> fit!

Xnew, _ = make_regression(3, rng=123)
yhat = predict(mach, Xnew)

```

`import MLJ:predict` . so works!

---

<div class="post-metadata">

### Author: ![bryaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bryaan/32/36858_2.png) [@bryaan](https://discourse.julialang.org/u/bryaan)
#### Post date: [October 21, 2023, 3:01am UTC](https://discourse.julialang.org/t/mlj-nusvm-predict-function-not-found/105148/4 "2023-10-21T03:01:02Z")

</div>

Thank you!
