## models.GamFit


A fitted GAM, from [Gam.fit](models.Gam.md#prospicio.models.Gam.fit).


Usage


``` python
models.GamFit()
```


## Attributes

| Name | Description |
|----|----|
| [coefficients](#coefficients) | Coefficients. |
| [deviance](#deviance) | Residual deviance. |
| [dispersion](#dispersion) | Dispersion. |
| [edf](#edf) | Effective degrees of freedom. |
| [fitted](#fitted) | Fitted means on the training data. |
| [input_hash](#input_hash) | Hash of the training data (design, offset, weights, response). |
| [lambdas](#lambdas) | Smoothing parameter of each smooth. |
| [names](#names) | Coefficient names: parametric columns, then `s(x).1`, … |
| [score](#score) | The minimized GCV or UBRE score. |

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


#### coefficients


Coefficients.


`coefficients: list[float]`


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


#### deviance


Residual deviance.


`deviance: float`


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


#### dispersion


Dispersion.


`dispersion: float`


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


#### edf


Effective degrees of freedom.


`edf: 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`


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


#### lambdas


Smoothing parameter of each smooth.


`lambdas: list[float]`


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


#### names


Coefficient names: parametric columns, then `s(x).1`, …


`names: list[str]`


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


#### score


The minimized GCV or UBRE score.


`score: 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 `row`. |
| [to_json()](#to_json) | The fit as a versioned JSON artifact (GLM spec, smooths with their knots and constraints, smoothing parameters, estimates), 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


`GamFit`  


##### 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, raw smooth columns included.


##### Returns


`list of float`  


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


#### predict_distribution()


Joint predictive distribution across the rows, keyed `row`.


Usage


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


##### Parameters


`design: Design`  

`n_sims: int`  

`seed: int`  


##### Returns


`PredictiveDistribution`  


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


#### to_json()


The fit as a versioned JSON artifact (GLM spec, smooths with their knots and constraints, smoothing parameters, estimates), with provenance (crate


Usage


``` python
to_json()
```


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


##### Returns


`str`
