You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/03_pipelines/notebook.pluto.jl
+17-85Lines changed: 17 additions & 85 deletions
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ instantiate properly for other Julia versions.
110
110
111
111
# ╔═╡ 99cbb473-2785-48ad-bcba-9840c8a65923
112
112
md"""
113
-
The follwing is a temporary fix until the macro-free pipline mechanism will be included in an offical release of MLJ (then the cell above can be used):
113
+
The follwing is a temporary fix until the macro-free pipeline mechanism will be included in an offical release of MLJ (then the cell above can be used):
114
114
"""
115
115
116
116
# ╔═╡ 499cbc31-83ba-4583-ba1f-6363f43ec697
@@ -281,12 +281,19 @@ transformation to `XHouseCont`, we can combine both the encoding and the
281
281
dimension-reducing models into a single model, known as a
282
282
*pipeline*. While MLJ offers a powerful interface for composing
283
283
models in a variety of ways, we'll stick to these simplest class of
284
-
composite models for now. The easiest way to construct them is using
285
-
the `Pipeline` type:
284
+
composite models for now. The simplest "hard-wired" composite type is the `Pipeline` type, which is for linear (non-branching) sequences of models. At most one of these can be a supervised model (which often appears last):
286
285
"""
287
286
288
287
# ╔═╡ 5ed77309-afa6-4c94-88c0-761fe6b5a5d4
289
-
pipe1 =Pipeline(ContinuousEncoder, PCA)
288
+
pipe0 =Pipeline(ContinuousEncoder, PCA)
289
+
290
+
# ╔═╡ d45ff6ec-2dd6-4a9c-a97e-79337b0be5c8
291
+
md"""
292
+
Notice that component models now appear as *hyper-parameters* of the pipeline model, and these have automatically generated field names (which can be overwritten, as in `Pipeline(enc=ContinuousEncoder, reducer=PCA)`). There is also an "arrow" syntax for constructing pipelines. The following defines the same pipeline as above:
293
+
"""
294
+
295
+
# ╔═╡ 380a3bb6-535d-4f4b-8e7c-18148f7cc0b8
296
+
pipe1 = ContinuousEncoder |> PCA
290
297
291
298
# ╔═╡ eee1bcc8-ff0b-4238-950d-551d88aab415
292
299
md"""
@@ -317,7 +324,7 @@ md"Want to combine this pre-processing with ridge regression?"
Next, suppose that instead of using the raw `:price` as the
400
-
training target, we want to use the log-price (a common practice in
401
-
dealing with house price data). However, suppose that we still want
402
-
to report final *predictions* on the original linear scale (and use
403
-
these for evaluation purposes). Then we supply appropriate functions
404
-
to key-word arguments `target` and `inverse`.
405
-
"""
406
+
Target transformations are not supported by the `Pipeline` type, only the `@pipeline` macro, which does not currently work from Pluto notebooks. Refer to the Juptyer notebook or plain julia script for a demonstration. Target transformations can also be implemented using MLJ's generic model composition syntax introduced in Part 5.
406
407
407
-
# ╔═╡ 72d314eb-74ef-4555-9979-7044b2f2df33
408
-
md"First we'll overload `log` and `exp` for broadcasting:"
409
-
410
-
# ╔═╡ bc2bdda0-8fe3-4ef0-b2a1-fbbde543f620
411
-
begin
412
-
Base.log(v::AbstractArray) =log.(v)
413
-
Base.exp(v::AbstractArray) =exp.(v)
414
-
end
408
+
In the future you will be able to conveniently implement target transformations with a separate model wrapper.
0 commit comments