# ridgefit

Linear regression with L2 regularization.

## Syntax

parameters = ridgefit(X,y)

parameters = ridgefit(X,y,options)

## Inputs

`X`- Training data.
`y`- Target values.
`options`- Type: struct

## Outputs

- parameters
- Contains all the values passed to ridgefit method as options. Additionally it has below key-value pairs.

## Example

Usage of ridgefit with options

```
X = [1 2 3; 4 5 6; 7 8 9; 10 11 12; 13 14 15; 16 17 18; 19 20 21];
y = [1, 2, 3, 4, 5, 6, 7];
options = struct;
options.to_normalize = true;
options.l2_penalty = 0.03;
parameters = ridgefit(X, y, options);
```

```
> parameters
parameters = struct [
coef: [Matrix] 3 x 1
0.66572
0.66572
0.66572
intercept: 4
l2_penalty: 0.03
n_features: 3
n_samples: 7
params: [Matrix] 4 x 1
4.00000
0.66572
0.66572
0.66572
scorer: @r2
to_normalize: 1
]
```

## Comments

Output 'parameters' can be passed to ridgepredict function.