# Applying Machine learning models to Diabetes dataset using MLJ.jl packages

**URL:** https://discourse.julialang.org/t/applying-machine-learning-models-to-diabetes-dataset-using-mlj-jl-packages/64047
**Category:** General Usage
**Created:** [July 4, 2021, 5:38pm UTC](https://discourse.julialang.org/t/applying-machine-learning-models-to-diabetes-dataset-using-mlj-jl-packages/64047 "2021-07-04T17:38:37Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Maria\_Brown](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maria_brown/32/26680_2.png) [@Maria\_Brown](https://discourse.julialang.org/u/Maria_Brown)
#### Post date: [July 4, 2021, 5:38pm UTC](https://discourse.julialang.org/t/applying-machine-learning-models-to-diabetes-dataset-using-mlj-jl-packages/64047/1 "2021-07-04T17:38:37Z")

</div>

\*\*Hello, \*\*  
**Please I have this diabetes dataset which i have cleaned using Altery designer, and I would love to build ML models(Random Forest tree, Logistic regression, KNN, Support Vector Machine and Naive Baye algorithms on it.). I am new to Julia and the MLJ package. Please how can I go about to build my models(and evaluate its accuracy and performance)**  
**-Showing me how to do it with just one or two chosen algorithms will go a long way to help please**.

```julia
using Pkg
Pkg.add("CSV")
Pkg.add("DataFrames")
using DataFrames
using CSV
diabetes= CSV.read("diabetes.csv", DataFrame)
using Pkg
using Pkg; Pkg.activate("my_MLJ_env", shared=true)
Pkg.add("MLJ")
using MLJ
models()
Pkg.add("MLJDecisionTreeInterface")
diabetes_x= Matrix(diabetes[:,[1,2,3,4,5,6,7,8]]);
diabetes_y=diabetes[:, 9];
tree_model = @load RandomForestClassifier pkg=DecisionTree

```

Please how do I apply that to my dataset? I would have loved to include the dataset

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [July 4, 2021, 6:08pm UTC](https://discourse.julialang.org/t/applying-machine-learning-models-to-diabetes-dataset-using-mlj-jl-packages/64047/2 "2021-07-04T18:08:05Z")

</div>

Did you look at the MLJ tutorials here? [https://alan-turing-institute.github.io/DataScienceTutorials.jl/#end\_to\_end\_examples\_with\_mlj](https://alan-turing-institute.github.io/DataScienceTutorials.jl/#end_to_end_examples_with_mlj)

They are pretty detailed and include a bunch of end to end examples that go from data cleaning via model selection and training to validation

---

<div class="post-metadata">

### Author: ![Maria\_Brown](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maria_brown/32/26680_2.png) [@Maria\_Brown](https://discourse.julialang.org/u/Maria_Brown)
#### Post date: [July 4, 2021, 8:45pm UTC](https://discourse.julialang.org/t/applying-machine-learning-models-to-diabetes-dataset-using-mlj-jl-packages/64047/3 "2021-07-04T20:45:56Z")

</div>

Thank you very much for your reply. I have read through the documentation(including what you sent). But i still have some issues occurring within my code:  
For example:

```julia
using Pkg
Pkg.add("MLJLinearModels")
@load LogisticClassifier pkg=MLJLinearModels
X2 = select(diabetes_x)
clf = machine(LogisticClassifier(), X2, diabetes_y)

```

When I run the above code i get the error:

**UndefVarError: LogisticClassifier not defined**
