Skip to content

Add docstrings! #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jun 14, 2022
Merged
Changes from 3 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a374516
add docstring skeletons
josephsdavid May 23, 2022
3dcd289
blue compliance
josephsdavid May 23, 2022
7b07819
linear regression done?
josephsdavid May 30, 2022
dabd03f
Update src/MLJGLMInterface.jl
josephsdavid May 30, 2022
be9afed
Update src/MLJGLMInterface.jl
josephsdavid May 31, 2022
4f4b126
Update src/MLJGLMInterface.jl
josephsdavid May 31, 2022
95665d8
Update src/MLJGLMInterface.jl
josephsdavid May 31, 2022
f44f411
Update src/MLJGLMInterface.jl
josephsdavid May 31, 2022
8830fe3
Add LinearBinaryClassifier
josephsdavid May 31, 2022
f4e2e3a
update docs with suggested header
josephsdavid May 31, 2022
cc6e9fa
Update src/MLJGLMInterface.jl
josephsdavid May 31, 2022
9bcda17
resolve scitype issue
josephsdavid May 31, 2022
dc8d972
fix more scitype issues
josephsdavid May 31, 2022
e25fbc9
formatting and details
josephsdavid May 31, 2022
d7748a5
more scitypes
josephsdavid May 31, 2022
f7f7da9
add count regression example
josephsdavid Jun 1, 2022
dc11206
marginal -> conditional
josephsdavid Jun 1, 2022
fd47b5f
cleanup
josephsdavid Jun 1, 2022
799cb37
Update src/MLJGLMInterface.jl
josephsdavid Jun 1, 2022
7eaf90b
see also fix
josephsdavid Jun 1, 2022
4df6a3a
scitype fix
josephsdavid Jun 1, 2022
a4fb67a
Update src/MLJGLMInterface.jl
josephsdavid Jun 1, 2022
bb1aecb
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
24fe789
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
378cf9c
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
efa1f07
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
cf24445
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
9cc079a
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
8cbe9f3
Update src/MLJGLMInterface.jl
josephsdavid Jun 4, 2022
b1c17ac
drop regressor wiki
josephsdavid Jun 4, 2022
93d6189
touch up
josephsdavid Jun 6, 2022
c96ddf0
tidied up
josephsdavid Jun 6, 2022
92eaae5
add crabs and consistent capitalizations/punctuations
josephsdavid Jun 7, 2022
3681c33
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
8dc6b38
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
582a2fc
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
e586899
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
9f3c271
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
8055d82
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
1c6fa14
Update src/MLJGLMInterface.jl
josephsdavid Jun 13, 2022
72f3783
cleaned up
josephsdavid Jun 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 75 additions & 1 deletion src/MLJGLMInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ end
"""
glm_features(model, X)

Returns an iterable features object, to be used in the construction of
Returns an iterable features object, to be used in the construction of
glm formula and glm data header.
"""
function glm_features(model, X)
Expand Down Expand Up @@ -327,4 +327,78 @@ metadata_model(
path = "$PKG.LinearCountRegressor"
)

const DOC_LINEAR_REGRESSION = "TODO"
"""
$(MMI.doc_header(LinearRegressor))
`LinearRegressor` implements the $DOC_LINEAR_REGRESSION.

# Training data

In MLJ or MLJBase, bind an instance `model` to data with
mach = machine(model, X, y)

Where

- `X`: any table of input features (eg, a `DataFrame`) whose columns
each have one of the following element scitypes: `Continuous`,
`Count`, or `<:OrderedFactor`; check column scitypes with `schema(X)`

- `y`: is the target, which can be any `AbstractVector` whose element
scitype is `Continuous`; check the scitype with `scitype(y)`

# Hyper-parameters

- `fit_intercept=true`: Whether to calculate the intercept for this model.
If set to false, no intercept will be calculated (e.g. the data is expected
to be centered)
- `allowrankdeficient=false`: Whether to allow rank deficient matrices (e.g.
more columns than rows)
- `offsetcol=nothing`: Name of the column to be used as an offset, if any.
An offset is a variable which is known to have a coefficient of 1.
# Operations

- `predict(mach, Xnew)`: return predictions of the target given new
features `Xnew` having the same Scitype as `X` above. Predictions are
probabilistic but uncalibrated.
- `predict_mean(mach, Xnew)`: instead return the mean of
each prediction above
# Fitted parameters
The fields of `fitted_params(mach)` are:

- `featues`: The names of the features used during model fitting
- `coef`: The linear coefficients determined by the model
- `intercept`: The intercept determined by the model
# Report
The fields of `report(mach)` are:

- `deviance`: Measure of deviance of fitted model with respect to
a perfectly fitted model. For a linear model, this is the weighted
residual sum of squares
- `dof_residual`: degrees of freedom for residuals, when meaningful
- `stderror`: standard errors of the coefficients
- `vcov`: estimated variance-covariance matrix of the coefficient estimates
# Examples
```
using MLJ
GLM = @load LinearRegressor pkg=GLM
glm = GLM()

X, y = make_regression(100, 2) # synthetic data
mach = machine(glm, X, y) |> fit!

Xnew, _ = make_regression(3, 2)
yhat = predict(mach, Xnew) # new predictions
yhat_point = predict_mean(mach, Xnew) # new predictions

fitted_params(mach).features
fitted_params(mach).coef # x1, x2, intercept
fitted_params(mach).intercept

report(mach)
```
See also
TODO: ADD REFERENCES
"""
LinearRegressor

end # module