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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 17 additions & 9 deletions
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

Lines changed: 22 additions & 13 deletions
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

Lines changed: 22 additions & 13 deletions
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.
1 Byte
Binary file not shown.

0 commit comments

Comments
 (0)