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
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ csv_file = Downloads.download(url)
````

````
"/tmp/jl_ruz0kP/horse.csv"
"/tmp/jl_kOThHT/horse.csv"
````

Entering these lines of code downloads the data to a temporary file at the location
Expand Down Expand Up @@ -531,8 +531,8 @@ A = rand(2, 3)

````
2×3 Matrix{Float64}:
0.113155 0.33251 0.397839
0.171581 0.90293 0.436722
0.832781 0.999535 0.163212
0.685279 0.998338 0.966773
````

````@julia
Expand All @@ -550,8 +550,8 @@ Asparse = sparse(A)

````
2×3 SparseArrays.SparseMatrixCSC{Float64, Int64} with 6 stored entries:
0.113155 0.33251 0.397839
0.171581 0.90293 0.436722
0.832781 0.999535 0.163212
0.685279 0.998338 0.966773
````

````@julia
Expand Down
Binary file modified docs/src/notebooks/MLJTutorial/02_models/learning_curve.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
276 changes: 138 additions & 138 deletions docs/src/notebooks/MLJTutorial/02_models/notebook.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/src/notebooks/MLJTutorial/03_pipelines/notebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ x = rand(100);
````

````
mean(x) = 0.47696749924138343
std(x) = 0.29728842148044776
mean(x) = 0.488231598311445
std(x) = 0.29947481462620856

````

Expand All @@ -46,8 +46,8 @@ xhat = transform(mach, x);

````
[ Info: Training machine(Standardizer(features = Symbol[], …), …).
mean(xhat) = 2.042810365310288e-16
std(xhat) = 1.0
mean(xhat) = -9.769962616701378e-17
std(xhat) = 0.9999999999999999

````

Expand Down Expand Up @@ -501,7 +501,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: DeterministicPipeline-190
Tag: DeterministicPipeline-761
Extract:
┌──────────┬───────────┬─────────────┐
│ measure │ operation │ measurement │
Expand Down Expand Up @@ -631,7 +631,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: DeterministicPipeline-398
Tag: DeterministicPipeline-289
Extract:
┌──────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down Expand Up @@ -672,7 +672,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: DeterministicPipeline-611
Tag: DeterministicPipeline-526
Extract:
┌──────────┬───────────┬─────────────┬──────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down Expand Up @@ -700,7 +700,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: DeterministicPipeline-592
Tag: DeterministicPipeline-221
Extract:
┌──────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down
Binary file modified docs/src/notebooks/MLJTutorial/04_tuning/gamma_sampler.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/src/notebooks/MLJTutorial/04_tuning/notebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: ProbabilisticPipeline-307
Tag: ProbabilisticPipeline-620
Extract:
┌──────────────────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand All @@ -394,7 +394,7 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: ProbabilisticTunedModel-779
Tag: ProbabilisticTunedModel-280
Extract:
┌──────────────────────┬───────────┬─────────────┬─────────┐
│ measure │ operation │ measurement │ 1.96*SE │
Expand Down
Binary file modified docs/src/notebooks/MLJTutorial/04_tuning/tuning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 50 additions & 50 deletions docs/src/notebooks/MLJTutorial/05_composition/notebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ pretty(X)
│ Float64 │ Float64 │ Float64 │
│ Continuous │ Continuous │ Continuous │
├────────────┼────────────┼────────────┤
│ 14.9681 │ -1.47137 │ 12.1949 │
│ -3.26626 │ -0.710617 │ 7.36507 │
│ -4.17429 │ -0.0882215 │ 9.87907 │
│ 6.00034 │ -2.41859 │ 14.9897 │
│ -4.38537 │ -0.187352 │ 7.22233 │
│ -9.85801 │ 0.948133 │ 1.5543 │
│ -9.05017 │ 0.116089 │ 0.3031 │
│ 13.9369 │ -0.530196 │ -2.03829 │
│ -0.617015 │ 2.30274 │ -1.08639 │
│ -8.65166 │ 2.36956 │ 1.34361 │
└────────────┴────────────┴────────────┘

````
Expand All @@ -91,11 +91,11 @@ yhat = predict(mach2, Xstand)

````
5-element CategoricalDistributions.UnivariateFiniteVector{ScientificTypesBase.Multiclass{3}, Int64, UInt32, Float64}:
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.993, 2=>0.00372, 3=>0.00319)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.000405, 2=>0.000195, 3=>0.999)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.000309, 2=>0.000249, 3=>0.999)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00752, 2=>0.992, 3=>0.000947)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00012, 2=>1.96e-5, 3=>1.0)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>8.09e-5, 2=>8.48e-5, 3=>1.0)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00351, 2=>0.000732, 3=>0.996)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.995, 2=>0.00474, 3=>0.00011)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00327, 2=>0.989, 3=>0.00818)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>6.88e-5, 2=>0.00843, 3=>0.991)
````

**Step 1** - Edit your code as follows:
Expand All @@ -119,15 +119,15 @@ yhat = predict(mach2, Xstand)
````

````
Node @440 → LogisticClassifier(…)
Node @623 → LogisticClassifier(…)
args:
1: Node @909 → Standardizer(…)
1: Node @703 → Standardizer(…)
formula:
predict(
machine(LogisticClassifier(lambda = 0.001, …), …),
transform(
machine(Standardizer(features = Symbol[], …), …),
Source @128,
Source @747,
),
)
````
Expand All @@ -150,11 +150,11 @@ Xstand() |> pretty
│ Float64 │ Float64 │ Float64 │
│ Continuous │ Continuous │ Continuous │
├────────────┼────────────┼────────────┤
│ 1.54143 │ -0.508564 │ 0.563239 │
│ -0.597675 │ 0.271238 │ -0.895631 │
│ -0.704197 │ 0.909215 │ -0.136268 │
│ 0.489404 │ -1.47949 │ 1.40741 │
│ -0.728959 │ 0.807603 │ -0.938747 │
│ -0.694096 │ -0.0720163 │ 0.991034 │
│ -0.614108 │ -0.715398 │ 0.185347 │
│ 1.66195 │ -1.21514 │ -1.32235 │
│ 0.220901 │ 0.975443 │ -0.709393 │
│ -0.574649 │ 1.02711 │ 0.855364 │
└────────────┴────────────┴────────────┘

````
Expand All @@ -178,11 +178,11 @@ yhat()

````
5-element CategoricalDistributions.UnivariateFiniteVector{ScientificTypesBase.Multiclass{3}, Int64, UInt32, Float64}:
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.993, 2=>0.00372, 3=>0.00319)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.000405, 2=>0.000195, 3=>0.999)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.000309, 2=>0.000249, 3=>0.999)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00752, 2=>0.992, 3=>0.000947)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00012, 2=>1.96e-5, 3=>1.0)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>8.09e-5, 2=>8.48e-5, 3=>1.0)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00351, 2=>0.000732, 3=>0.996)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.995, 2=>0.00474, 3=>0.00011)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.00327, 2=>0.989, 3=>0.00818)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>6.88e-5, 2=>0.00843, 3=>0.991)
````

The node `yhat` is the "descendant" (in an associated DAG we have
Expand All @@ -194,7 +194,7 @@ origins(yhat)

````
1-element Vector{MLJBase.Source}:
Source @128 ⏎ `ScientificTypesBase.Table{AbstractVector{ScientificTypesBase.Continuous}}`
Source @747 ⏎ `ScientificTypesBase.Table{AbstractVector{ScientificTypesBase.Continuous}}`
````

The data at the source node is replaced by `Xnew` to obtain a
Expand All @@ -207,8 +207,8 @@ yhat(Xnew)

````
2-element CategoricalDistributions.UnivariateFiniteVector{ScientificTypesBase.Multiclass{3}, Int64, UInt32, Float64}:
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>1.13e-8, 2=>1.0, 3=>6.09e-8)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>2.89e-16, 2=>1.0, 3=>4.36e-13)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>0.0461, 2=>0.954, 3=>1.47e-10)
UnivariateFinite{ScientificTypesBase.Multiclass{3}}(1=>1.0, 2=>8.32e-5, 3=>1.38e-9)
````

**Step 2** - Export the learning network as a new stand-alone model type
Expand Down Expand Up @@ -238,15 +238,15 @@ yhat = predict(mach2, Xstand)
````

````
Node @530 → :classifier
Node @708 → :classifier
args:
1: Node @804 → :standardizer
1: Node @363 → :standardizer
formula:
predict(
machine(:classifier, …),
transform(
machine(:standardizer, …),
Source @128,
Source @747,
),
)
````
Expand Down Expand Up @@ -380,7 +380,7 @@ y = source(y)
````

````
Source @555 ⏎ `AbstractVector{ScientificTypesBase.Continuous}`
Source @704 ⏎ `AbstractVector{ScientificTypesBase.Continuous}`
````

**First layer and target transformation:**
Expand All @@ -396,13 +396,13 @@ z = MLJ.transform(mach2, y)
````

````
Node @022 → UnivariateBoxCoxTransformer(…)
Node @116 → UnivariateBoxCoxTransformer(…)
args:
1: Source @555
1: Source @704
formula:
transform(
machine(UnivariateBoxCoxTransformer(n = 171, …), …),
Source @555,
Source @704,
)
````

Expand All @@ -419,18 +419,18 @@ zhat = 0.5*predict(mach3, W) + 0.5*predict(mach4, W)
````

````
Node @135
Node @464
args:
1: Node @083
2: Node @797
1: Node @919
2: Node @316
formula:
+(
var"#*##0#*##1"(
predict(
machine(RidgeRegressor(lambda = 0.1, …), …),
transform(
machine(Standardizer(features = Symbol[], …), …),
Source @100,
Source @991,
),
),
),
Expand All @@ -439,7 +439,7 @@ Node @135
machine(RandomForestRegressor(max_depth = -1, …), …),
transform(
machine(Standardizer(features = Symbol[], …), …),
Source @100,
Source @991,
),
),
),
Expand All @@ -453,9 +453,9 @@ yhat = inverse_transform(mach2, zhat)
````

````
Node @539 → UnivariateBoxCoxTransformer(…)
Node @061 → UnivariateBoxCoxTransformer(…)
args:
1: Node @135
1: Node @464
formula:
inverse_transform(
machine(UnivariateBoxCoxTransformer(n = 171, …), …),
Expand All @@ -465,7 +465,7 @@ Node @539 → UnivariateBoxCoxTransformer(…)
machine(RidgeRegressor(lambda = 0.1, …), …),
transform(
machine(Standardizer(features = Symbol[], …), …),
Source @100,
Source @991,
),
),
),
Expand All @@ -474,7 +474,7 @@ Node @539 → UnivariateBoxCoxTransformer(…)
machine(RandomForestRegressor(max_depth = -1, …), …),
transform(
machine(Standardizer(features = Symbol[], …), …),
Source @100,
Source @991,
),
),
),
Expand All @@ -491,9 +491,9 @@ yhat(rows=1:3)

````
3-element Vector{Float64}:
4.1049434111127105
4.674958202525163
4.112097582032496
1.5198312953553146
0.8824006167264453
1.57930874294795
````

Now for the new model type:
Expand Down Expand Up @@ -547,20 +547,20 @@ PerformanceEvaluation object with these fields:
per_fold, per_observation,
fitted_params_per_fold, report_per_fold,
train_test_rows, resampling, repeats
Tag: CompositeModel-983
Tag: CompositeModel-665
Extract:
┌───┬────────────────────────┬───────────┬─────────────┬─────────┐
│ │ measure │ operation │ measurement │ 1.96*SE │
├───┼────────────────────────┼───────────┼─────────────┼─────────┤
│ A │ RootMeanSquaredError() │ predict │ 3.87 │ 0.46 │
│ B │ LPLoss( │ predict │ 2.454 │ 0.04 │
│ A │ RootMeanSquaredError() │ predict │ 3.95 │ 0.68 │
│ B │ LPLoss( │ predict │ 2.49 │ 0.26 │
│ │ p = 1) │ │ │ │
└───┴────────────────────────┴───────────┴─────────────┴─────────┘
┌───┬──────────────────────────────────────┐
│ │ per_fold │
├───┼──────────────────────────────────────┤
│ A │ [4.45, 4.28, 3.41, 3.3, 4.21, 3.37] │
│ B │ [2.45, 2.46, 2.46, 2.38, 2.53, 2.45] │
│ A │ [3.09, 5.37, 3.61, 3.81, 3.63, 3.82] │
│ B │ [2.17, 2.98, 2.62, 2.24, 2.35, 2.57] │
└───┴──────────────────────────────────────┘
Apply `describe` to this result for a named tuple summary.
````
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading