Skip to content

Commit 8211a69

Browse files
authored
update glm tutorial (#178)
1 parent 724b6b2 commit 8211a69

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

_literate/EX-GLM/Manifest.toml

Lines changed: 2 additions & 2 deletions
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"]

_literate/EX-GLM/tutorial.jl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ y = copy(dfY1)
6161
coerce!(X, autotype(X, :string_to_multiclass))
6262
yv = Vector(y[:, 1])
6363

64-
LinearRegressorPipe = @pipeline(Standardizer(),
65-
OneHotEncoder(drop_last = true),
66-
LinearRegressor())
64+
LinearRegressorPipe = Pipeline(
65+
Standardizer(),
66+
OneHotEncoder(drop_last = true),
67+
LinearRegressor()
68+
)
6769

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

76-
ŷ = MLJ.predict(LinearModel, Xm)
78+
ŷ = MLJ.predict(LinearModel, X)
7779
yhatResponse = [ŷ[i,1].μ for i in 1:nrow(y)]
7880
residuals = y .- yhatResponse
7981
r = report(LinearModel)
@@ -99,9 +101,11 @@ coerce!(X, autotype(X, :string_to_multiclass))
99101
yc = CategoricalArray(y[:, 1])
100102
yc = coerce(yc, OrderedFactor)
101103

102-
LinearBinaryClassifierPipe = @pipeline(Standardizer(),
103-
OneHotEncoder(drop_last = true),
104-
LinearBinaryClassifier())
104+
LinearBinaryClassifierPipe = Pipeline(
105+
Standardizer(),
106+
OneHotEncoder(drop_last = true),
107+
LinearBinaryClassifier()
108+
)
105109

106110
LogisticModel = machine(LinearBinaryClassifierPipe, X, yc)
107111
fit!(LogisticModel)

0 commit comments

Comments
 (0)