Skip to content

Commit fb744a2

Browse files
committed
further doc tweaks; add human_name trait where needed
1 parent 23fac3f commit fb744a2

File tree

4 files changed

+44
-34
lines changed

4 files changed

+44
-34
lines changed

src/MLJMultivariateStatsInterface.jl

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ metadata_pkg.(
7676
7777
$(MMI.doc_header(LinearRegressor))
7878
79-
`LinearRegressor` assumes the target is a continuous variable and trains a linear prediction
80-
function using the least squares algorithm. Options exist to specify a bias term.`
79+
`LinearRegressor` assumes the target is a `Continuous` variable and trains a linear
80+
prediction function using the least squares algorithm. Options exist to specify a bias term.
8181
8282
# Training data
8383
@@ -102,7 +102,7 @@ Train the machine using `fit!(mach, rows=...)`.
102102
# Operations
103103
104104
- `predict(mach, Xnew)`: Return predictions of the target given new
105-
features `Xnew` having the same scitype as `X` above.
105+
features `Xnew`, which should have the same scitype as `X` above.
106106
107107
# Fitted parameters
108108
@@ -163,7 +163,7 @@ Train the machine using `fit!(mach, rows=...)`.
163163
# Operations
164164
165165
- `predict(mach, Xnew)`: Return predictions of the target given new
166-
features `Xnew` having the same scitype as `X` above.
166+
features `Xnew`, which should have the same scitype as `X` above.
167167
168168
# Fitted parameters
169169
@@ -232,7 +232,7 @@ Train the machine using `fit!(mach, rows=...)`.
232232
# Operations
233233
234234
- `predict(mach, Xnew)`: Return predictions of the target given new
235-
features `Xnew` having the same scitype as `X` above.
235+
features `Xnew`, which should have the same scitype as `X` above.
236236
237237
# Fitted parameters
238238
@@ -300,7 +300,7 @@ Train the machine using `fit!(mach, rows=...)`.
300300
# Operations
301301
302302
- `predict(mach, Xnew)`: Return predictions of the target given new
303-
features `Xnew` having the same scitype as `X` above.
303+
features `Xnew`, which should have the same scitype as `X` above.
304304
305305
# Fitted parameters
306306
@@ -348,8 +348,8 @@ In MLJ or MLJBase, bind an instance `model` to data with
348348
349349
Here:
350350
351-
- `X` is any table of input features (eg, a `DataFrame`) whose columns
352-
are of scitype `Continuous`; check column scitypes with `schema(X)`.
351+
- `X` is any table of input features (eg, a `DataFrame`) whose columns are of scitype
352+
`Continuous`; check column scitypes with `schema(X)`.
353353
354354
Train the machine using `fit!(mach, rows=...)`.
355355
@@ -379,8 +379,8 @@ Train the machine using `fit!(mach, rows=...)`.
379379
380380
# Operations
381381
382-
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew` having
383-
the same scitype as `X` above.
382+
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
383+
should have the same scitype as `X` above.
384384
385385
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`,
386386
such as returned by `transform`, reconstruct a table, having same the number
@@ -452,8 +452,8 @@ In MLJ or MLJBase, bind an instance `model` to data with
452452
453453
Here:
454454
455-
- `X` is any table of input features (eg, a `DataFrame`) whose columns
456-
are of scitype `Continuous`; check column scitypes with `schema(X)`.
455+
- `X` is any table of input features (eg, a `DataFrame`) whose columns are of scitype
456+
`Continuous`; check column scitypes with `schema(X)`.
457457
458458
Train the machine using `fit!(mach, rows=...)`.
459459
@@ -480,8 +480,8 @@ Train the machine using `fit!(mach, rows=...)`.
480480
481481
# Operations
482482
483-
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew` having
484-
the same scitype as `X` above.
483+
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
484+
should have the same scitype as `X` above.
485485
486486
- `inverse_transform(mach, Xsmall)`: For a dimension-reduced table `Xsmall`, such as
487487
returned by `transform`, reconstruct a table, having same the number of columns as the
@@ -646,9 +646,9 @@ $(MMI.doc_header(LDA))
646646
[Multiclass linear discriminant
647647
analysis](https://en.wikipedia.org/wiki/Linear_discriminant_analysis) learns a projection in
648648
a space of features to a lower dimensional space, in a way that attempts to preserve as much
649-
as possible the degree to which the target classes can be discriminated. This can be used
650-
either for dimension reduction of the features (see `transform` below) or for probabilistic
651-
classification of the target (see `predict` below).
649+
as possible the degree to which the classes of a discrete target variable can be
650+
discriminated. This can be used either for dimension reduction of the features (see
651+
`transform` below) or for probabilistic classification of the target (see `predict` below).
652652
653653
In the case of prediction, the class probability for a new observation reflects the
654654
proximity of that observation to training observations associated with that class, and how
@@ -700,8 +700,8 @@ Train the machine using `fit!(mach, rows=...)`.
700700
701701
# Operations
702702
703-
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew` having
704-
the same scitype as `X` above.
703+
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
704+
should have the same scitype as `X` above.
705705
706706
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew` having the
707707
same scitype as `X` above. Predictions are probabilistic but uncalibrated.
@@ -715,8 +715,8 @@ Train the machine using `fit!(mach, rows=...)`.
715715
The fields of `fitted_params(mach)` are:
716716
717717
- `projected_class_means`: The matrix comprised of class-specific means as columns, of size
718-
`(indim, nclasses)`, where `indim` is the number of input features (columns) and `nclasses` the
719-
number of target classes.
718+
`(indim, nclasses)`, where `indim` is the number of input features (columns) and
719+
`nclasses` the number of target classes.
720720
721721
- `projection_matrix`: The learned projection matrix, of size `(indim, outdim)`, where
722722
`indim` and `outdim` are the input and output dimensions respectively.
@@ -827,8 +827,8 @@ Train the machine using `fit!(mach, rows=...)`.
827827
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
828828
should have the same scitype as `X` above.
829829
830-
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew` having the
831-
same scitype as `X` above. Predictions are probabilistic but uncalibrated.
830+
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew`, which
831+
should have the same scitype as `X` above. Predictions are probabilistic but uncalibrated.
832832
833833
- `predict_mode(mach, Xnew)`: Return the modes of the probabilistic predictions returned
834834
above.
@@ -947,8 +947,8 @@ Train the machine using `fit!(mach, rows=...)`.
947947
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
948948
should have the same scitype as `X` above.
949949
950-
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew` having the
951-
same scitype as `X` above. Predictions are probabilistic but uncalibrated.
950+
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew`, which
951+
should have same scitype as `X` above. Predictions are probabilistic but uncalibrated.
952952
953953
- `predict_mode(mach, Xnew)`: Return the modes of the probabilistic predictions
954954
returned above.
@@ -1051,8 +1051,8 @@ Train the machine using `fit!(mach, rows=...)`.
10511051
- `transform(mach, Xnew)`: Return a lower dimensional projection of the input `Xnew`, which
10521052
should have the same scitype as `X` above.
10531053
1054-
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew` having the
1055-
same scitype as `X` above. Predictions are probabilistic but uncalibrated.
1054+
- `predict(mach, Xnew)`: Return predictions of the target given features `Xnew`, which
1055+
should have same scitype as `X` above. Predictions are probabilistic but uncalibrated.
10561056
10571057
- `predict_mode(mach, Xnew)`: Return the modes of the probabilistic predictions
10581058
returned above.
@@ -1214,7 +1214,7 @@ FactorAnalysis
12141214
12151215
$(MMI.doc_header(PPCA))
12161216
1217-
Probabilistic principal component analysis is a dimension reduction algorithm which
1217+
Probabilistic principal component analysis is a dimension-reduction algorithm which
12181218
represents a constrained form of the Gaussian distribution in which the number of free
12191219
parameters can be restricted while still allowing the model to capture the dominant
12201220
correlations in a data set. It is expressed as the maximum likelihood solution of a

src/models/decomposition_models.jl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ end
8484

8585
metadata_model(
8686
KernelPCA,
87+
human_name="kernel prinicipal component analysis model",
8788
input=Table(Continuous),
8889
output=Table(Continuous),
8990
weights=false,
@@ -137,6 +138,7 @@ end
137138

138139
metadata_model(
139140
ICA,
141+
human_name="independent component analysis model",
140142
input=Table(Continuous),
141143
output=Table(Continuous),
142144
weights=false,
@@ -178,7 +180,9 @@ function MMI.fit(model::PPCA, verbosity::Int, X)
178180
return fitresult, cache, report
179181
end
180182

181-
metadata_model(PPCA,
183+
metadata_model(
184+
PPCA,
185+
human_name="probabilistic PCA model",
182186
input=Table(Continuous),
183187
output=Table(Continuous),
184188
weights=false,
@@ -223,7 +227,9 @@ function MMI.fit(model::FactorAnalysis, verbosity::Int, X)
223227
return fitresult, cache, report
224228
end
225229

226-
metadata_model(FactorAnalysis,
230+
metadata_model(
231+
FactorAnalysis,
232+
human_name="factor analysis model",
227233
input=Table(Continuous),
228234
output=Table(Continuous),
229235
weights=false,

src/models/discriminant_analysis.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ function MMI.predict(m::LDA, (core_res, classes_seen), Xnew)
108108
return MMI.UnivariateFinite(classes_seen, Pr)
109109
end
110110

111-
metadata_model(LDA,
111+
metadata_model(
112+
LDA,
113+
human_name="linear discriminant analysis model",
112114
input=Table(Continuous),
113115
target=AbstractVector{<:Finite},
114116
weights=false,
@@ -239,6 +241,7 @@ end
239241

240242
metadata_model(
241243
BayesianLDA,
244+
human_name="Bayesian LDA model",
242245
input=Table(Continuous),
243246
target= AbstractVector{<:Finite},
244247
weights=false,
@@ -304,6 +307,7 @@ end
304307

305308
metadata_model(
306309
SubspaceLDA,
310+
human_name="subpace LDA model",
307311
input=Table(Continuous),
308312
target=AbstractVector{<:Finite},
309313
weights=false,
@@ -414,6 +418,7 @@ end
414418

415419
metadata_model(
416420
BayesianSubspaceLDA,
421+
human_name="Bayesian subspace LDA model",
417422
input=Table(Continuous),
418423
target=AbstractVector{<:Finite},
419424
weights=false,

src/models/linear_models.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ end
1111
_convert(common_type, x::AbstractVector) = convert(AbstractVector{common_type}, x)
1212
_convert(common_type, x::AbstractMatrix) = convert(AbstractMatrix{common_type}, MMI.matrix(x))
1313
matrix_(X::AbstractVector) = X
14-
matrix_(X) = MMI.matrix(X)
14+
matrix_(X) = MMI.matrix(X)
1515
_names(y::AbstractVector) = nothing
1616
_names(Y) = collect(MMI.schema(Y).names)
1717

@@ -60,7 +60,7 @@ function _predict_regressor(
6060
Xmat_new * @view(fr.sol_matrix[1:end-1, :]) .+ transpose(
6161
@view(fr.sol_matrix[end, :])
6262
);
63-
names=fr.names,
63+
names=fr.names,
6464
prototype=prototype
6565
)
6666
else
@@ -176,4 +176,3 @@ metadata_model(
176176
weights=false,
177177
path="$(PKG).MultitargetRidgeRegressor"
178178
)
179-

0 commit comments

Comments
 (0)