Skip to content
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

Improve docstring of LinearRegression #330

Merged
Merged
Changes from all commits
Commits
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
21 changes: 10 additions & 11 deletions algorithms/linfa-linear/src/ols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,21 @@ use linfa::traits::{Fit, PredictInplace};
derive(Serialize, Deserialize),
serde(crate = "serde_crate")
)]
/// An ordinary least squares linear regression model.
/// An ordinary least squares univariate linear regression model.
///
/// LinearRegression fits a linear model to minimize the residual sum of
/// squares between the observed targets in the dataset, and the targets
/// predicted by the linear approximation.
/// Given predictors `x` and responses `y` ordinary least squares linear
/// regression estimates a model of the form
///
/// Ordinary least squares regression solves the overconstrainted model
/// `y = xW + b`
///
/// y = Ax + b
/// by finding a matrix `W` and a vector `b` which minimize the sum of the
/// squared L_2 norms `||y_j - x_jW - b||_2^2` for a dataset
/// `{(x_j, y_j) for j in 1..=n_samples}`.
///
/// by finding x and b which minimize the L_2 norm ||y - Ax - b||_2.
/// The algorithm is only implemented for _univariate_ regression. This means
/// that `b` and `y` are scalars and `W` is just one column.
///
/// It currently uses the [Moore-Penrose pseudo-inverse]()
/// to solve y - b = Ax.
///
/// /// ## Examples
/// ## Examples
///
/// Here's an example on how to train a linear regression model on the `diabetes` dataset
/// ```rust
Expand Down