Skip to content

Commit

Permalink
fd-update
Browse files Browse the repository at this point in the history
  • Loading branch information
tlienart committed Jan 14, 2022
1 parent 56fbb46 commit 76b1d3d
Show file tree
Hide file tree
Showing 185 changed files with 4,951 additions and 4,654 deletions.
Binary file modified __site/__generated/A-composing-models.tar.gz
Binary file not shown.
8 changes: 4 additions & 4 deletions __site/__generated/A-composing-models/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

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

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
Expand Down Expand Up @@ -413,9 +413,9 @@ version = "0.12.3"

[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.1.3"
version = "2.2.0"

[[deps.Pkg]]
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
Expand Down
26 changes: 17 additions & 9 deletions __site/__generated/A-composing-models/tutorial-raw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,25 @@ height = [178, 194, 165, 173, 168];

scitype(X.age)

pipe = @pipeline(
X -> coerce(X, :age=>Continuous),
OneHotEncoder(),
KNNRegressor(K=3),
target = UnivariateStandardizer());

pipe.knn_regressor.K = 2
pipe = Pipeline(
coercer = X -> coerce(X, :age=>Continuous),
one_hot_encoder = OneHotEncoder(),
transformed_target_model = TransformedTargetModel(
model = KNNRegressor(K=3);
target=UnivariateStandardizer()
)
)

pipe.transformed_target_model.model.K = 2
pipe.one_hot_encoder.drop_last = true;

evaluate(pipe, X, height, resampling=Holdout(),
measure=rms) |> pprint
evaluate(
pipe,
X,
height,
resampling=Holdout(),
measure=rms
) |> pprint

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

35 changes: 22 additions & 13 deletions __site/__generated/A-composing-models/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,28 +102,31 @@
"source": [
"A typical workflow for such data is to one-hot-encode the categorical data and then apply some regression model on the data.\n",
"Let's say that we want to apply the following steps:\n",
"1. standardize the target variable (`:height`)\n",
"1. one hot encode the categorical data\n",
"1. train a KNN regression model"
"1. One hot encode the categorical features in `X`\n",
"1. Standardize the target variable (`:height`)\n",
"1. Train a KNN regression model on the one hot encoded data and the Standardized target."
],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"The `@pipeline` macro helps you define such a simple (non-branching) pipeline of steps to be applied in order:"
"The `Pipeline` constructor helps you define such a simple (non-branching) pipeline of steps to be applied in order:"
],
"metadata": {}
},
{
"outputs": [],
"cell_type": "code",
"source": [
"pipe = @pipeline(\n",
" X -> coerce(X, :age=>Continuous),\n",
" OneHotEncoder(),\n",
" KNNRegressor(K=3),\n",
" target = UnivariateStandardizer());"
"pipe = Pipeline(\n",
" coercer = X -> coerce(X, :age=>Continuous),\n",
" one_hot_encoder = OneHotEncoder(),\n",
" transformed_target_model = TransformedTargetModel(\n",
" model = KNNRegressor(K=3);\n",
" target=UnivariateStandardizer()\n",
" )\n",
")"
],
"metadata": {},
"execution_count": null
Expand All @@ -132,7 +135,8 @@
"cell_type": "markdown",
"source": [
"Note the coercion of the `:age` variable to Continuous since `KNNRegressor` expects `Continuous` input.\n",
"Note also the `target` keyword where you can specify a transformation of the target variable."
"Note also the `TransformedTargetModel` which allows one to learn a transformation (in this case Standardization) of the\n",
"target variable to be passed to the `KNNRegressor`."
],
"metadata": {}
},
Expand All @@ -147,7 +151,7 @@
"outputs": [],
"cell_type": "code",
"source": [
"pipe.knn_regressor.K = 2\n",
"pipe.transformed_target_model.model.K = 2\n",
"pipe.one_hot_encoder.drop_last = true;"
],
"metadata": {},
Expand All @@ -164,8 +168,13 @@
"outputs": [],
"cell_type": "code",
"source": [
"evaluate(pipe, X, height, resampling=Holdout(),\n",
" measure=rms) |> pprint"
"evaluate(\n",
" pipe,\n",
" X,\n",
" height,\n",
" resampling=Holdout(),\n",
" measure=rms\n",
") |> pprint"
],
"metadata": {},
"execution_count": null
Expand Down
35 changes: 22 additions & 13 deletions __site/__generated/A-composing-models/tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,39 @@ scitype(X.age)

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

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

pipe = @pipeline(
X -> coerce(X, :age=>Continuous),
OneHotEncoder(),
KNNRegressor(K=3),
target = UnivariateStandardizer());
pipe = Pipeline(
coercer = X -> coerce(X, :age=>Continuous),
one_hot_encoder = OneHotEncoder(),
transformed_target_model = TransformedTargetModel(
model = KNNRegressor(K=3);
target=UnivariateStandardizer()
)
)

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

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

pipe.knn_regressor.K = 2
pipe.transformed_target_model.model.K = 2
pipe.one_hot_encoder.drop_last = true;

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

evaluate(pipe, X, height, resampling=Holdout(),
measure=rms) |> pprint
evaluate(
pipe,
X,
height,
resampling=Holdout(),
measure=rms
) |> pprint

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

Binary file modified __site/__generated/A-ensembles-2.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-ensembles-3.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-ensembles.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-fit-predict.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-learning-networks-2.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-learning-networks.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-model-choice.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-model-tuning.tar.gz
Binary file not shown.
Binary file modified __site/__generated/A-stacking.tar.gz
Binary file not shown.
Binary file modified __site/__generated/D0-categorical.tar.gz
Binary file not shown.
Binary file modified __site/__generated/D0-dataframe.tar.gz
Binary file not shown.
Binary file modified __site/__generated/D0-loading.tar.gz
Binary file not shown.
Binary file modified __site/__generated/D0-processing.tar.gz
Binary file not shown.
Binary file modified __site/__generated/D0-scitype.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-AMES.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-GLM.tar.gz
Binary file not shown.
16 changes: 8 additions & 8 deletions __site/__generated/EX-GLM/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b"

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

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
Expand Down Expand Up @@ -323,9 +323,9 @@ version = "0.2.0"

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

[[deps.MLJIteration]]
deps = ["IterationControl", "MLJBase", "Random"]
Expand Down Expand Up @@ -431,9 +431,9 @@ version = "0.12.3"

[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.1.3"
version = "2.2.0"

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

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

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Expand Down
18 changes: 11 additions & 7 deletions __site/__generated/EX-GLM/tutorial-raw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,17 @@ y = copy(dfY1)
coerce!(X, autotype(X, :string_to_multiclass))
yv = Vector(y[:, 1])

LinearRegressorPipe = @pipeline(Standardizer(),
OneHotEncoder(drop_last = true),
LinearRegressor())
LinearRegressorPipe = Pipeline(
Standardizer(),
OneHotEncoder(drop_last = true),
LinearRegressor()
)

LinearModel = machine(LinearRegressorPipe, X, yv)
fit!(LinearModel)
fp = fitted_params(LinearModel)

ŷ = MLJ.predict(LinearModel, Xm)
ŷ = MLJ.predict(LinearModel, X)
yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]
residuals = y .- yhatResponse
r = report(LinearModel)
Expand All @@ -62,9 +64,11 @@ coerce!(X, autotype(X, :string_to_multiclass))
yc = CategoricalArray(y[:, 1])
yc = coerce(yc, OrderedFactor)

LinearBinaryClassifierPipe = @pipeline(Standardizer(),
OneHotEncoder(drop_last = true),
LinearBinaryClassifier())
LinearBinaryClassifierPipe = Pipeline(
Standardizer(),
OneHotEncoder(drop_last = true),
LinearBinaryClassifier()
)

LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)
fit!(LogisticModel)
Expand Down
18 changes: 11 additions & 7 deletions __site/__generated/EX-GLM/tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@
"coerce!(X, autotype(X, :string_to_multiclass))\n",
"yv = Vector(y[:, 1])\n",
"\n",
"LinearRegressorPipe = @pipeline(Standardizer(),\n",
" OneHotEncoder(drop_last = true),\n",
" LinearRegressor())\n",
"LinearRegressorPipe = Pipeline(\n",
" Standardizer(),\n",
" OneHotEncoder(drop_last = true),\n",
" LinearRegressor()\n",
")\n",
"\n",
"LinearModel = machine(LinearRegressorPipe, X, yv)\n",
"fit!(LinearModel)\n",
Expand All @@ -175,7 +177,7 @@
"outputs": [],
"cell_type": "code",
"source": [
"ŷ = MLJ.predict(LinearModel, Xm)\n",
"ŷ = MLJ.predict(LinearModel, X)\n",
"yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]\n",
"residuals = y .- yhatResponse\n",
"r = report(LinearModel)\n",
Expand Down Expand Up @@ -225,9 +227,11 @@
"yc = CategoricalArray(y[:, 1])\n",
"yc = coerce(yc, OrderedFactor)\n",
"\n",
"LinearBinaryClassifierPipe = @pipeline(Standardizer(),\n",
" OneHotEncoder(drop_last = true),\n",
" LinearBinaryClassifier())\n",
"LinearBinaryClassifierPipe = Pipeline(\n",
" Standardizer(),\n",
" OneHotEncoder(drop_last = true),\n",
" LinearBinaryClassifier()\n",
")\n",
"\n",
"LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)\n",
"fit!(LogisticModel)\n",
Expand Down
18 changes: 11 additions & 7 deletions __site/__generated/EX-GLM/tutorial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ y = copy(dfY1)
coerce!(X, autotype(X, :string_to_multiclass))
yv = Vector(y[:, 1])

LinearRegressorPipe = @pipeline(Standardizer(),
OneHotEncoder(drop_last = true),
LinearRegressor())
LinearRegressorPipe = Pipeline(
Standardizer(),
OneHotEncoder(drop_last = true),
LinearRegressor()
)

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

ŷ = MLJ.predict(LinearModel, Xm)
ŷ = MLJ.predict(LinearModel, X)
yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]
residuals = y .- yhatResponse
r = report(LinearModel)
Expand All @@ -101,9 +103,11 @@ coerce!(X, autotype(X, :string_to_multiclass))
yc = CategoricalArray(y[:, 1])
yc = coerce(yc, OrderedFactor)

LinearBinaryClassifierPipe = @pipeline(Standardizer(),
OneHotEncoder(drop_last = true),
LinearBinaryClassifier())
LinearBinaryClassifierPipe = Pipeline(
Standardizer(),
OneHotEncoder(drop_last = true),
LinearBinaryClassifier()
)

LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)
fit!(LogisticModel)
Expand Down
Binary file modified __site/__generated/EX-airfoil.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-boston-flux.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-boston-lgbm.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-breastcancer.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-crabs-xgb.tar.gz
Binary file not shown.
Binary file modified __site/__generated/EX-horse.tar.gz
Binary file not shown.
16 changes: 8 additions & 8 deletions __site/__generated/EX-horse/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"

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

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

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

[[deps.DocStringExtensions]]
deps = ["LibGit2"]
Expand Down Expand Up @@ -513,9 +513,9 @@ version = "0.12.3"

[[deps.Parsers]]
deps = ["Dates"]
git-tree-sha1 = "d7fa6237da8004be601e19bd6666083056649918"
git-tree-sha1 = "92f91ba9e5941fc781fecf5494ac1da87bdac775"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "2.1.3"
version = "2.2.0"

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

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

[[deps.Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
Expand Down
Loading

0 comments on commit 76b1d3d

Please sign in to comment.