diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 55f889c..e17bc06 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,3 +49,6 @@ jobs: - uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - uses: codecov/codecov-action@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # If authenticating with GitHub Actions token + DOCUMENTER_KEY: ${{ secrets.CODECOV_TOKEN }} # If authenticating with SSH deploy key diff --git a/src/fit.jl b/src/fit.jl index 088999e..eb1d4a4 100644 --- a/src/fit.jl +++ b/src/fit.jl @@ -24,6 +24,26 @@ function init(config::EvoLinearRegressor; end + +""" + fit(config::EvoLinearRegressor; + x, y, w=nothing, + x_eval=nothing, y_eval=nothing, w_eval=nothing, + metric=:mse, + print_every_n=1, + tol=1e-5) + +`Provided a `config`, EvoLinear.fit` takes `x` and `y` as features and target inputs, plus optionally `w` as weights and train a Linear boosted model. + +# Arguments +- `config::EvoLinearRegressor`: + +# Keyword arguments +- `x::AbstractMatrix`: Features matrix. Dimensions are `[nobs, num_features]`. +- `y::AbstractVector`: Vector of observed targets. +- `w=nothing`: Vector of weights. Can be be either a `Vector` or `nothing`. If `nothing`, assumes a vector of 1s. +- `metric=:mse`: Evaluation metric to be tracked through each iteration. +""" function fit(config::EvoLinearRegressor; x, y, w=nothing, x_eval=nothing, y_eval=nothing, w_eval=nothing, diff --git a/src/predict.jl b/src/predict.jl index 0528fc5..15caceb 100644 --- a/src/predict.jl +++ b/src/predict.jl @@ -1,7 +1,34 @@ -function predict_linear(m, x) +""" + predict_linear(m, x) + +Returns the predictions on the linear basis from model `m` using the features matrix `x`. + +# Arguments + +- `m::EvoLinearModel` +- `x` +""" +function predict_linear(m::EvoLinearModel, x) p = x * m.coef .+ m.bias return p end + +""" + predict_proj(m, x) + +Returns the predictions on the projected basis from model `m` using the features matrix `x`. + +- `MSE`: pred_proj = pred_linear +- `Logistic`: pred_proj = sigmoid(pred_linear) +- `Poisson`: pred_proj = exp(pred_linear) +- `Gamma`: pred_proj = exp(pred_linear) +- `Tweedie`: pred_proj = exp(pred_linear) + +# Arguments + +- `m::EvoLinearModel` +- `x` +""" function predict_proj(m::EvoLinearModel{MSE}, x) p = predict_linear(m, x) return p