Export / Import¶
JSON-based serialization and deserialization for single and multi-motif regression models.
pyprego.export ¶
Export and load regression models.
Mirrors export.R from the R prego package. Provides JSON-based serialisation for single and multi-motif regression models.
export_regression_model ¶
export_regression_model(model: RegressionResult, fn: str | Path | None = None) -> dict[str, Any] | None
Export a single-motif regression model.
| PARAMETER | DESCRIPTION |
|---|---|
model
|
Fitted regression model.
TYPE:
|
fn
|
File path to save JSON. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict | None
|
If fn is |
load_regression_model ¶
Load a single-motif regression model from file or dict.
| PARAMETER | DESCRIPTION |
|---|---|
fn
|
JSON file path or a dict (as returned by :func:
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
RegressionResult
|
Loaded model with a functioning |
export_multi_regression ¶
Export a multi-motif regression model.
| PARAMETER | DESCRIPTION |
|---|---|
reg
|
Multi-motif regression result.
TYPE:
|
fn
|
File path to save JSON. If
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict | None
|
If fn is |
load_multi_regression ¶
Load a multi-motif regression model.
| PARAMETER | DESCRIPTION |
|---|---|
fn
|
JSON file path or dict.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
MultiRegressionResult
|
Loaded multi-motif model with |