## models.ElasticNetFit


A fitted elastic net, from [ElasticNet.fit](models.ElasticNet.md#prospicio.models.ElasticNet.fit) or [ElasticNet.path](models.ElasticNet.md#prospicio.models.ElasticNet.path).


Usage


``` python
models.ElasticNetFit()
```


## Attributes

| Name | Description |
|----|----|
| [coefficients](#coefficients) | Coefficients on the design's scale; exact zeros where the penalty |
| [deviance](#deviance) | Residual deviance. |
| [deviance_ratio](#deviance_ratio) | Share of the null deviance explained (glmnet's `dev.ratio`). |
| [df](#df) | Number of non-zero coefficients, intercept excluded. |
| [dispersion](#dispersion) | Dispersion. |
| [fitted](#fitted) | Fitted means on the training data. |
| [input_hash](#input_hash) | Hash of the training data (design, offset, weights, response). |
| [lam](#lam) | Penalty strength. |
| [names](#names) | Coefficient names. |
| [null_deviance](#null_deviance) | Deviance with only the intercept and unpenalized columns. |

------------------------------------------------------------------------


#### coefficients


Coefficients on the design's scale; exact zeros where the penalty


`coefficients: list[float]`


dropped a column.


------------------------------------------------------------------------


#### deviance


Residual deviance.


`deviance: float`


------------------------------------------------------------------------


#### deviance_ratio


Share of the null deviance explained (glmnet's `dev.ratio`).


`deviance_ratio: float`


------------------------------------------------------------------------


#### df


Number of non-zero coefficients, intercept excluded.


`df: int`


------------------------------------------------------------------------


#### dispersion


Dispersion.


`dispersion: float`


------------------------------------------------------------------------


#### fitted


Fitted means on the training data.


`fitted: list[float]`


------------------------------------------------------------------------


#### input_hash


Hash of the training data (design, offset, weights, response).


`input_hash: str`


------------------------------------------------------------------------


#### lam


Penalty strength.


`lam: float`


------------------------------------------------------------------------


#### names


Coefficient names.


`names: list[str]`


------------------------------------------------------------------------


#### null_deviance


Deviance with only the intercept and unpenalized columns.


`null_deviance: float`


## Methods

| Name | Description |
|----|----|
| [from_json()](#from_json) | Reads an artifact written by [to_json](distributions.to_json.md#prospicio.distributions.to_json). |
| [predict()](#predict) | Expected response for each row. |
| [predict_distribution()](#predict_distribution) | Joint predictive distribution across the rows, keyed |
| [to_json()](#to_json) | The fit as a versioned JSON artifact (spec with its lambda and alpha, coefficients, fit statistics), with provenance (crate |

------------------------------------------------------------------------


#### from_json()


Reads an artifact written by [to_json](distributions.to_json.md#prospicio.distributions.to_json).


Usage


``` python
from_json(text)
```


##### Parameters


`text: str`  


##### Returns


`ElasticNetFit`  


##### Raises


`ValueError`  
For malformed JSON, another format, a newer format version or inconsistent fields.


------------------------------------------------------------------------


#### predict()


Expected response for each row.


Usage


``` python
predict(design)
```


##### Parameters


`design: Design`  
Same columns as the training design.


##### Returns


`list of float`  


------------------------------------------------------------------------


#### predict_distribution()


Joint predictive distribution across the rows, keyed


Usage


``` python
predict_distribution(design, n_sims, seed)
```


`row = 0, 1, ...`: process uncertainty only (penalized coefficients have no standard errors; bootstrap the fit for parameter uncertainty).


##### Parameters


`design: Design`  

`n_sims: int`  

`seed: int`  


##### Returns


`PredictiveDistribution`  


------------------------------------------------------------------------


#### to_json()


The fit as a versioned JSON artifact (spec with its lambda and alpha, coefficients, fit statistics), with provenance (crate


Usage


``` python
to_json()
```


version and a hash of the training data). [ElasticNetFit.from_json](models.ElasticNetFit.md#prospicio.models.ElasticNetFit.from_json) reads it back exactly; pickling uses it too.


##### Returns


`str`
