Skip to content

Commit 76b1d3d

Browse files
committed
fd-update
1 parent 56fbb46 commit 76b1d3d

File tree

185 files changed

+4951
-4654
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+4951
-4654
lines changed
129 Bytes
Binary file not shown.

__site/__generated/A-composing-models/Manifest.toml

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
121121

122122
[[deps.Distributions]]
123123
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
124-
git-tree-sha1 = "6a8dc9f82e5ce28279b6e3e2cea9421154f5bd0d"
124+
git-tree-sha1 = "97e9e9d0b8303bae296f3bdd1c2b0065dcb7e7ef"
125125
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
126-
version = "0.25.37"
126+
version = "0.25.38"
127127

128128
[[deps.DocStringExtensions]]
129129
deps = ["LibGit2"]
@@ -413,9 +413,9 @@ version = "0.12.3"
413413

414414
[[deps.Parsers]]
415415
deps = ["Dates"]
416-
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
416+
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
417417
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
418-
version = "2.1.3"
418+
version = "2.2.0"
419419

420420
[[deps.Pkg]]
421421
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]

__site/__generated/A-composing-models/tutorial-raw.jl

+17-9
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,25 @@ height = [178, 194, 165, 173, 168];
1010

1111
scitype(X.age)
1212

13-
pipe = @pipeline(
14-
X -> coerce(X, :age=>Continuous),
15-
OneHotEncoder(),
16-
KNNRegressor(K=3),
17-
target = UnivariateStandardizer());
18-
19-
pipe.knn_regressor.K = 2
13+
pipe = Pipeline(
14+
coercer = X -> coerce(X, :age=>Continuous),
15+
one_hot_encoder = OneHotEncoder(),
16+
transformed_target_model = TransformedTargetModel(
17+
model = KNNRegressor(K=3);
18+
target=UnivariateStandardizer()
19+
)
20+
)
21+
22+
pipe.transformed_target_model.model.K = 2
2023
pipe.one_hot_encoder.drop_last = true;
2124

22-
evaluate(pipe, X, height, resampling=Holdout(),
23-
measure=rms) |> pprint
25+
evaluate(
26+
pipe,
27+
X,
28+
height,
29+
resampling=Holdout(),
30+
measure=rms
31+
) |> pprint
2432

2533
# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl
2634

__site/__generated/A-composing-models/tutorial.ipynb

+22-13
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,31 @@
102102
"source": [
103103
"A typical workflow for such data is to one-hot-encode the categorical data and then apply some regression model on the data.\n",
104104
"Let's say that we want to apply the following steps:\n",
105-
"1. standardize the target variable (`:height`)\n",
106-
"1. one hot encode the categorical data\n",
107-
"1. train a KNN regression model"
105+
"1. One hot encode the categorical features in `X`\n",
106+
"1. Standardize the target variable (`:height`)\n",
107+
"1. Train a KNN regression model on the one hot encoded data and the Standardized target."
108108
],
109109
"metadata": {}
110110
},
111111
{
112112
"cell_type": "markdown",
113113
"source": [
114-
"The `@pipeline` macro helps you define such a simple (non-branching) pipeline of steps to be applied in order:"
114+
"The `Pipeline` constructor helps you define such a simple (non-branching) pipeline of steps to be applied in order:"
115115
],
116116
"metadata": {}
117117
},
118118
{
119119
"outputs": [],
120120
"cell_type": "code",
121121
"source": [
122-
"pipe = @pipeline(\n",
123-
" X -> coerce(X, :age=>Continuous),\n",
124-
" OneHotEncoder(),\n",
125-
" KNNRegressor(K=3),\n",
126-
" target = UnivariateStandardizer());"
122+
"pipe = Pipeline(\n",
123+
" coercer = X -> coerce(X, :age=>Continuous),\n",
124+
" one_hot_encoder = OneHotEncoder(),\n",
125+
" transformed_target_model = TransformedTargetModel(\n",
126+
" model = KNNRegressor(K=3);\n",
127+
" target=UnivariateStandardizer()\n",
128+
" )\n",
129+
")"
127130
],
128131
"metadata": {},
129132
"execution_count": null
@@ -132,7 +135,8 @@
132135
"cell_type": "markdown",
133136
"source": [
134137
"Note the coercion of the `:age` variable to Continuous since `KNNRegressor` expects `Continuous` input.\n",
135-
"Note also the `target` keyword where you can specify a transformation of the target variable."
138+
"Note also the `TransformedTargetModel` which allows one to learn a transformation (in this case Standardization) of the\n",
139+
"target variable to be passed to the `KNNRegressor`."
136140
],
137141
"metadata": {}
138142
},
@@ -147,7 +151,7 @@
147151
"outputs": [],
148152
"cell_type": "code",
149153
"source": [
150-
"pipe.knn_regressor.K = 2\n",
154+
"pipe.transformed_target_model.model.K = 2\n",
151155
"pipe.one_hot_encoder.drop_last = true;"
152156
],
153157
"metadata": {},
@@ -164,8 +168,13 @@
164168
"outputs": [],
165169
"cell_type": "code",
166170
"source": [
167-
"evaluate(pipe, X, height, resampling=Holdout(),\n",
168-
" measure=rms) |> pprint"
171+
"evaluate(\n",
172+
" pipe,\n",
173+
" X,\n",
174+
" height,\n",
175+
" resampling=Holdout(),\n",
176+
" measure=rms\n",
177+
") |> pprint"
169178
],
170179
"metadata": {},
171180
"execution_count": null

__site/__generated/A-composing-models/tutorial.jl

+22-13
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,39 @@ scitype(X.age)
3434

3535
# A typical workflow for such data is to one-hot-encode the categorical data and then apply some regression model on the data.
3636
# Let's say that we want to apply the following steps:
37-
# 1. standardize the target variable (`:height`)
38-
# 1. one hot encode the categorical data
39-
# 1. train a KNN regression model
37+
# 1. One hot encode the categorical features in `X`
38+
# 1. Standardize the target variable (`:height`)
39+
# 1. Train a KNN regression model on the one hot encoded data and the Standardized target.
4040

41-
# The `@pipeline` macro helps you define such a simple (non-branching) pipeline of steps to be applied in order:
41+
# The `Pipeline` constructor helps you define such a simple (non-branching) pipeline of steps to be applied in order:
4242

43-
pipe = @pipeline(
44-
X -> coerce(X, :age=>Continuous),
45-
OneHotEncoder(),
46-
KNNRegressor(K=3),
47-
target = UnivariateStandardizer());
43+
pipe = Pipeline(
44+
coercer = X -> coerce(X, :age=>Continuous),
45+
one_hot_encoder = OneHotEncoder(),
46+
transformed_target_model = TransformedTargetModel(
47+
model = KNNRegressor(K=3);
48+
target=UnivariateStandardizer()
49+
)
50+
)
4851

4952
# Note the coercion of the `:age` variable to Continuous since `KNNRegressor` expects `Continuous` input.
50-
# Note also the `target` keyword where you can specify a transformation of the target variable.
53+
# Note also the `TransformedTargetModel` which allows one to learn a transformation (in this case Standardization) of the
54+
# target variable to be passed to the `KNNRegressor`.
5155

5256
# Hyperparameters of this pipeline can be accessed (and set) using dot syntax:
5357

54-
pipe.knn_regressor.K = 2
58+
pipe.transformed_target_model.model.K = 2
5559
pipe.one_hot_encoder.drop_last = true;
5660

5761
# Evaluation for a pipe can be done with the `evaluate!` method; implicitly it will construct machines that will contain the fitted parameters etc:
5862

59-
evaluate(pipe, X, height, resampling=Holdout(),
60-
measure=rms) |> pprint
63+
evaluate(
64+
pipe,
65+
X,
66+
height,
67+
resampling=Holdout(),
68+
measure=rms
69+
) |> pprint
6170

6271
# This file was generated using Literate.jl, https://github.com/fredrikekre/Literate.jl
6372

1 Byte
Binary file not shown.
1 Byte
Binary file not shown.

__site/__generated/A-ensembles.tar.gz

2 Bytes
Binary file not shown.
2 Bytes
Binary file not shown.
Binary file not shown.
1 Byte
Binary file not shown.
1 Byte
Binary file not shown.
2 Bytes
Binary file not shown.

__site/__generated/A-stacking.tar.gz

2 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

__site/__generated/D0-loading.tar.gz

-2 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

__site/__generated/D0-scitype.tar.gz

0 Bytes
Binary file not shown.

__site/__generated/EX-AMES.tar.gz

1 Byte
Binary file not shown.

__site/__generated/EX-GLM.tar.gz

-12 Bytes
Binary file not shown.

__site/__generated/EX-GLM/Manifest.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
133133

134134
[[deps.Distributions]]
135135
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
136-
git-tree-sha1 = "6a8dc9f82e5ce28279b6e3e2cea9421154f5bd0d"
136+
git-tree-sha1 = "97e9e9d0b8303bae296f3bdd1c2b0065dcb7e7ef"
137137
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
138-
version = "0.25.37"
138+
version = "0.25.38"
139139

140140
[[deps.DocStringExtensions]]
141141
deps = ["LibGit2"]
@@ -323,9 +323,9 @@ version = "0.2.0"
323323

324324
[[deps.MLJGLMInterface]]
325325
deps = ["Distributions", "GLM", "MLJModelInterface", "Parameters", "Tables"]
326-
git-tree-sha1 = "925ae5a51c5b3cc2c66a714bcefbdb8f5950e491"
326+
git-tree-sha1 = "f9e26c43458be2285e61e96ea18fe7e13aa62007"
327327
uuid = "caf8df21-4939-456d-ac9c-5fefbfb04c0c"
328-
version = "0.1.7"
328+
version = "0.2.0"
329329

330330
[[deps.MLJIteration]]
331331
deps = ["IterationControl", "MLJBase", "Random"]
@@ -431,9 +431,9 @@ version = "0.12.3"
431431

432432
[[deps.Parsers]]
433433
deps = ["Dates"]
434-
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
434+
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
435435
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
436-
version = "2.1.3"
436+
version = "2.2.0"
437437

438438
[[deps.Pkg]]
439439
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
@@ -530,9 +530,9 @@ version = "3.0.0"
530530

531531
[[deps.SentinelArrays]]
532532
deps = ["Dates", "Random"]
533-
git-tree-sha1 = "244586bc07462d22aed0113af9c731f2a518c93e"
533+
git-tree-sha1 = "15dfe6b103c2a993be24404124b8791a09460983"
534534
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
535-
version = "1.3.10"
535+
version = "1.3.11"
536536

537537
[[deps.Serialization]]
538538
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

__site/__generated/EX-GLM/tutorial-raw.jl

+11-7
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ y = copy(dfY1)
3232
coerce!(X, autotype(X, :string_to_multiclass))
3333
yv = Vector(y[:, 1])
3434

35-
LinearRegressorPipe = @pipeline(Standardizer(),
36-
OneHotEncoder(drop_last = true),
37-
LinearRegressor())
35+
LinearRegressorPipe = Pipeline(
36+
Standardizer(),
37+
OneHotEncoder(drop_last = true),
38+
LinearRegressor()
39+
)
3840

3941
LinearModel = machine(LinearRegressorPipe, X, yv)
4042
fit!(LinearModel)
4143
fp = fitted_params(LinearModel)
4244

43-
ŷ = MLJ.predict(LinearModel, Xm)
45+
ŷ = MLJ.predict(LinearModel, X)
4446
yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]
4547
residuals = y .- yhatResponse
4648
r = report(LinearModel)
@@ -62,9 +64,11 @@ coerce!(X, autotype(X, :string_to_multiclass))
6264
yc = CategoricalArray(y[:, 1])
6365
yc = coerce(yc, OrderedFactor)
6466

65-
LinearBinaryClassifierPipe = @pipeline(Standardizer(),
66-
OneHotEncoder(drop_last = true),
67-
LinearBinaryClassifier())
67+
LinearBinaryClassifierPipe = Pipeline(
68+
Standardizer(),
69+
OneHotEncoder(drop_last = true),
70+
LinearBinaryClassifier()
71+
)
6872

6973
LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)
7074
fit!(LogisticModel)

__site/__generated/EX-GLM/tutorial.ipynb

+11-7
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,11 @@
151151
"coerce!(X, autotype(X, :string_to_multiclass))\n",
152152
"yv = Vector(y[:, 1])\n",
153153
"\n",
154-
"LinearRegressorPipe = @pipeline(Standardizer(),\n",
155-
" OneHotEncoder(drop_last = true),\n",
156-
" LinearRegressor())\n",
154+
"LinearRegressorPipe = Pipeline(\n",
155+
" Standardizer(),\n",
156+
" OneHotEncoder(drop_last = true),\n",
157+
" LinearRegressor()\n",
158+
")\n",
157159
"\n",
158160
"LinearModel = machine(LinearRegressorPipe, X, yv)\n",
159161
"fit!(LinearModel)\n",
@@ -175,7 +177,7 @@
175177
"outputs": [],
176178
"cell_type": "code",
177179
"source": [
178-
"ŷ = MLJ.predict(LinearModel, Xm)\n",
180+
"ŷ = MLJ.predict(LinearModel, X)\n",
179181
"yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]\n",
180182
"residuals = y .- yhatResponse\n",
181183
"r = report(LinearModel)\n",
@@ -225,9 +227,11 @@
225227
"yc = CategoricalArray(y[:, 1])\n",
226228
"yc = coerce(yc, OrderedFactor)\n",
227229
"\n",
228-
"LinearBinaryClassifierPipe = @pipeline(Standardizer(),\n",
229-
" OneHotEncoder(drop_last = true),\n",
230-
" LinearBinaryClassifier())\n",
230+
"LinearBinaryClassifierPipe = Pipeline(\n",
231+
" Standardizer(),\n",
232+
" OneHotEncoder(drop_last = true),\n",
233+
" LinearBinaryClassifier()\n",
234+
")\n",
231235
"\n",
232236
"LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)\n",
233237
"fit!(LogisticModel)\n",

__site/__generated/EX-GLM/tutorial.jl

+11-7
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,11 @@ y = copy(dfY1)
6363
coerce!(X, autotype(X, :string_to_multiclass))
6464
yv = Vector(y[:, 1])
6565

66-
LinearRegressorPipe = @pipeline(Standardizer(),
67-
OneHotEncoder(drop_last = true),
68-
LinearRegressor())
66+
LinearRegressorPipe = Pipeline(
67+
Standardizer(),
68+
OneHotEncoder(drop_last = true),
69+
LinearRegressor()
70+
)
6971

7072
LinearModel = machine(LinearRegressorPipe, X, yv)
7173
fit!(LinearModel)
@@ -75,7 +77,7 @@ fp = fitted_params(LinearModel)
7577
#
7678
# We can quickly read the results of our models in MLJ. Remember to compute the accuracy of the linear model.
7779

78-
ŷ = MLJ.predict(LinearModel, Xm)
80+
ŷ = MLJ.predict(LinearModel, X)
7981
yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]
8082
residuals = y .- yhatResponse
8183
r = report(LinearModel)
@@ -101,9 +103,11 @@ coerce!(X, autotype(X, :string_to_multiclass))
101103
yc = CategoricalArray(y[:, 1])
102104
yc = coerce(yc, OrderedFactor)
103105

104-
LinearBinaryClassifierPipe = @pipeline(Standardizer(),
105-
OneHotEncoder(drop_last = true),
106-
LinearBinaryClassifier())
106+
LinearBinaryClassifierPipe = Pipeline(
107+
Standardizer(),
108+
OneHotEncoder(drop_last = true),
109+
LinearBinaryClassifier()
110+
)
107111

108112
LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)
109113
fit!(LogisticModel)

__site/__generated/EX-airfoil.tar.gz

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
3 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

__site/__generated/EX-horse.tar.gz

25 Bytes
Binary file not shown.

__site/__generated/EX-horse/Manifest.toml

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
1414

1515
[[deps.ArrayInterface]]
1616
deps = ["Compat", "IfElse", "LinearAlgebra", "Requires", "SparseArrays", "Static"]
17-
git-tree-sha1 = "d0d82f1c0b651173a4f839d84f662d03f3417740"
17+
git-tree-sha1 = "ffc6588e17bcfcaa79dfa5b4f417025e755f83fc"
1818
uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
19-
version = "4.0.0"
19+
version = "4.0.1"
2020

2121
[[deps.Artifacts]]
2222
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@@ -157,9 +157,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"
157157

158158
[[deps.Distributions]]
159159
deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"]
160-
git-tree-sha1 = "6a8dc9f82e5ce28279b6e3e2cea9421154f5bd0d"
160+
git-tree-sha1 = "97e9e9d0b8303bae296f3bdd1c2b0065dcb7e7ef"
161161
uuid = "31c24e10-a181-5473-b8eb-7969acd0382f"
162-
version = "0.25.37"
162+
version = "0.25.38"
163163

164164
[[deps.DocStringExtensions]]
165165
deps = ["LibGit2"]
@@ -513,9 +513,9 @@ version = "0.12.3"
513513

514514
[[deps.Parsers]]
515515
deps = ["Dates"]
516-
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
516+
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
517517
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
518-
version = "2.1.3"
518+
version = "2.2.0"
519519

520520
[[deps.Pkg]]
521521
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
@@ -618,9 +618,9 @@ version = "3.0.0"
618618

619619
[[deps.SentinelArrays]]
620620
deps = ["Dates", "Random"]
621-
git-tree-sha1 = "244586bc07462d22aed0113af9c731f2a518c93e"
621+
git-tree-sha1 = "15dfe6b103c2a993be24404124b8791a09460983"
622622
uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c"
623-
version = "1.3.10"
623+
version = "1.3.11"
624624

625625
[[deps.Serialization]]
626626
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"

0 commit comments

Comments
 (0)