# 5/5000 Why is the error reported? UndefVarError: fit! not defined

**URL:** https://discourse.julialang.org/t/5-5000-why-is-the-error-reported-undefvarerror-fit-not-defined/55118
**Category:** General Usage
**Tags:** question
**Created:** [February 12, 2021, 4:04am UTC](https://discourse.julialang.org/t/5-5000-why-is-the-error-reported-undefvarerror-fit-not-defined/55118 "2021-02-12T04:04:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Jianqing001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jianqing001/32/21911_2.png) [@Jianqing001](https://discourse.julialang.org/u/Jianqing001)
#### Post date: [February 12, 2021, 4:04am UTC](https://discourse.julialang.org/t/5-5000-why-is-the-error-reported-undefvarerror-fit-not-defined/55118/1 "2021-02-12T04:04:07Z")

</div>

julia\> using RDatasets: dataset

julia\> iris = dataset(“datasets”, “iris”);

julia\> first(iris, 5)  
…  
julia\> X = convert(Array, iris[!, [:SepalLength, :SepalWidth, :PetalLength, :PetalWidth]])  
…  
julia\> y = convert(Array, iris[!, :Species])  
…  
julia\> using ScikitLearn

julia\> @sk\_import linear\_model: LogisticRegression  
PyObject \<class ‘sklearn.linear\_model.\_logistic.LogisticRegression’\>

julia\> model = LogisticRegression(fit\_intercept=true, max\_iter = 200)  
PyObject LogisticRegression(max\_iter=200)  
julia\> fit!(model, X, y);  
UndefVarError: fit! not defined

Stacktrace:  
[1] top-level scope at In[48]:1  
[2] include\_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

why
