Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 35 additions & 34 deletions docs/src/notebooks/UsingMLJ/01_basics/notebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EditURL = "notebook.jl"

Notebook supporting the video series "Using MLJ".

[Video](https://www.youtube.com/watch?v=6ILPGhuse4o&list=PLHwT4lR4GIv8&index=1).
[Slides](slides.pdf) from the video.

To run the code in this tutorial in a live Julia session, first follow the instructions
Expand Down Expand Up @@ -198,8 +199,8 @@ fitted_params(mach)
````
(forest = Ensemble of Decision Trees
Trees: 100
Avg Leaves: 146.19
Avg Depth: 14.53,)
Avg Leaves: 146.95
Avg Depth: 14.69,)
````

````@julia
Expand All @@ -218,9 +219,9 @@ predict(mach, X)[1:3]

````
3-element Vector{Float64}:
26.528000000000002
22.439
34.312
26.984999999999996
22.76
34.504
````

Predict in the `test` rows:
Expand All @@ -236,7 +237,7 @@ mae(ypred, y[test])
````

````
4.458702970297029
4.639163366336634
````

`mae` is actually just an alias:
Expand Down Expand Up @@ -283,14 +284,14 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: RandomForestRegressor-330
Tag: RandomForestRegressor-978
Extract:
┌────────────┬───────────┬─────────────┐
│ measure │ operation │ measurement │
├────────────┼───────────┼─────────────┤
│ LPLoss( │ predict │ 4.46 │
│ LPLoss( │ predict │ 4.64 │
│ p = 1) │ │ │
│ RSquared() │ predict │ 0.356 │
│ RSquared() │ predict │ 0.304 │
└────────────┴───────────┴─────────────┘
Apply `describe` to this result for a named tuple summary.
````
Expand All @@ -312,21 +313,21 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: RandomForestRegressor-275
Tag: RandomForestRegressor-113
Extract:
┌───┬────────────┬───────────┬─────────────┬─────────┐
│ │ measure │ operation │ measurement │ 1.96*SE │
├───┼────────────┼───────────┼─────────────┼─────────┤
│ A │ LPLoss( │ predict │ 3.03 │ 0.87 │
│ A │ LPLoss( │ predict │ 3.01 │ 0.85 │
│ │ p = 1) │ │ │ │
│ B │ RSquared() │ predict │ 0.66 │ 0.15 │
│ B │ RSquared() │ predict │ 0.65 │ 0.17 │
└───┴────────────┴───────────┴─────────────┴─────────┘
┌───┬────────────────────────────────────────────┐
│ │ per_fold │
├───┼────────────────────────────────────────────┤
│ A │ [2.23, 2.43, 3.37, 2.47, 4.89, 2.83] │
│ B │ [0.726, 0.811, 0.728, 0.827, 0.438, 0.447] │
└───┴────────────────────────────────────────────┘
┌───┬─────────────────────────────────────────┐
│ │ per_fold │
├───┼─────────────────────────────────────────┤
│ A │ [2.35, 2.29, 3.02, 2.58, 4.9, 2.92] │
│ B │ [0.695, 0.844, 0.763, 0.8, 0.443, 0.38] │
└───┴─────────────────────────────────────────┘
Apply `describe` to this result for a named tuple summary.
````

Expand All @@ -349,20 +350,20 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: RandomForestRegressor-131
Tag: RandomForestRegressor-528
Extract:
┌───┬────────────┬───────────┬─────────────┬─────────┐
│ │ measure │ operation │ measurement │ 1.96*SE │
├───┼────────────┼───────────┼─────────────┼─────────┤
│ A │ LPLoss( │ predict │ 2.429 │ 0.095 │
│ A │ LPLoss( │ predict │ 2.48 │ 0.12 │
│ │ p = 1) │ │ │ │
│ B │ RSquared() │ predict │ 0.84 │ 0.012 │
│ B │ RSquared() │ predict │ 0.826 │ 0.021 │
└───┴────────────┴───────────┴─────────────┴─────────┘
┌───┬───────────────────────────────────────────────────────────────────────┐
│ │ per_fold │
├───┼───────────────────────────────────────────────────────────────────────┤
│ A │ [2.29, 2.52, 2.51, 2.33, 2.41, 2.52, 2.52, 2.25, 2.26, 2.68] │
│ B │ [0.825, 0.853, 0.841, 0.851, 0.83, 0.846, 0.853, 0.858, 0.851, 0.795] │
│ A │ [2.65, 2.39, 2.37, 2.92, 2.48, 2.45, 2.41, 2.32, 2.51, 2.3] │
│ B │ [0.816, 0.809, 0.808, 0.791, 0.839, 0.822, 0.86, 0.843, 0.781, 0.886] │
└───┴───────────────────────────────────────────────────────────────────────┘
Apply `describe` to this result for a named tuple summary.
````
Expand All @@ -373,8 +374,8 @@ e.uncertainty_radius_95

````
2-element Vector{Float64}:
0.09488695112138384
0.012422766062865595
0.12150183577386904
0.02074147391875972
````

# Interlude on scientific types
Expand Down Expand Up @@ -619,8 +620,8 @@ first(yprob, 5)
5-element CategoricalDistributions.UnivariateFiniteVector{ScientificTypesBase.Multiclass{2}, InlineStrings.String7, UInt32, Float64}:
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>1.0, >50K=>0.0)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>1.0, >50K=>0.0)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>0.9, >50K=>0.1)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>0.25, >50K=>0.75)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>0.89, >50K=>0.11)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>0.24, >50K=>0.76)
UnivariateFinite{ScientificTypesBase.Multiclass{2}}(<=50K=>1.0, >50K=>0.0)
````

Expand All @@ -631,8 +632,8 @@ yprob[3]
````
UnivariateFinite{ScientificTypesBase.Multiclass{2}}
┌ ┐
<=50K ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.9
>50K ┤■■■■ 0.1
<=50K ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.89
>50K ┤■■■■ 0.11
└ ┘
````

Expand All @@ -643,15 +644,15 @@ accuracy(ypoint, y[test])
````

````
0.7817986384808312
0.7822081179300814
````

````@julia
log_loss(yprob, y[test])
````

````
1.532945976938586
1.6055684252777864
````

Evaluate with one command:
Expand All @@ -671,13 +672,13 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: RandomForestClassifier-494
Tag: RandomForestClassifier-917
Extract:
┌──────────────────────┬──────────────┬─────────────┐
│ measure │ operation │ measurement │
├──────────────────────┼──────────────┼─────────────┤
│ Accuracy() │ predict_mode │ 0.782 │
│ LogLoss( │ predict │ 1.53 │
│ Accuracy() │ predict_mode │ 0.781 │
│ LogLoss( │ predict │ 1.58 │
│ tol = 2.22045e-16) │ │ │
└──────────────────────┴──────────────┴─────────────┘
Apply `describe` to this result for a named tuple summary.
Expand Down
5 changes: 3 additions & 2 deletions docs/src/notebooks/UsingMLJ/02_model_composition/notebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ EditURL = "notebook.jl"

Notebook supporting the video series "Using MLJ".

[Video](https://www.youtube.com/watch?v=ZqSqRLPyyoU&list=PLHwT4lR4GIv8&index=2).
[Slides](slides.pdf) from the video.

To run the code in this tutorial in a live Julia session, first follow the instructions
Expand Down Expand Up @@ -159,7 +160,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: DeterministicPipeline-776
Tag: DeterministicPipeline-790
Extract:
┌──────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down Expand Up @@ -224,7 +225,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: TransformedTargetModelDeterministic-712
Tag: TransformedTargetModelDeterministic-136
Extract:
┌──────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down
Loading
Loading