Skip to content

io

sgp.io.ANNIO

sgp.io.DatabaseIO

Bases: HashableBaseModelIO

sgp.io.DatabaseIO.XY property

XY: Dict[str, Tuple[Expr, List[str]]]

Symbolic expressions for the original variables from the variables in the multivariate distribution.

RETURNS DESCRIPTION
Dict[str, Tuple[Expr, List[str]]]

A dictionary of (symbolic expression, free symbols) for each variable.

sgp.io.DatabaseIO.YX property

YX: Dict[str, Tuple[Expr, List[str]]]

Symbolic expressions for the variables in the multivariate distribution from the original variables.

RETURNS DESCRIPTION
Dict[str, Tuple[Expr, List[str]]]

A dictionary of (symbolic expression, free symbols) for each variable.

sgp.io.DatabaseIO.df property

Get the data for the database.

RETURNS DESCRIPTION
DataFrame

A DataFrame with the data for the database.

sgp.io.DatabaseIO.df_mpd property

df_mpd: DataFrame

Get the data for the multivariate distribution.

RETURNS DESCRIPTION
DataFrame

A DataFrame with the data for the multivariate distribution.

sgp.io.DatabaseIO.keys property

keys: List[str]

Get the keys for the database.

sgp.io.DatabaseIO.X

X(Y: str) -> str

Get the original variable from the variable in the multivariate distribution.

sgp.io.DatabaseIO.Xs

Xs(**ys: ndarray | float) -> Dict[str, ndarray | float]

Get the values for the original variables from the variables in the multivariate distribution.

sgp.io.DatabaseIO.Y

Y(X: str) -> str

Get the variable in the multivariate distribution from the original variable.

sgp.io.DatabaseIO.Ys

Ys(**xs: ndarray | float) -> Dict[str, ndarray | float]

Get the values for the variables in the multivariate distribution from the original variables.

sgp.io.DatabaseIO.cov

cov(key: str) -> float

Get the coefficient of variation of the database key.

sgp.io.DatabaseIO.describe

describe(key: str) -> Tuple[float, ...]

Get the statistics of the database key.

sgp.io.DatabaseIO.max

max(key: str) -> float

Get the maximum of the database key.

sgp.io.DatabaseIO.mean

mean(key: str) -> float

Get the mean of the database key.

sgp.io.DatabaseIO.min

min(key: str) -> float

Get the minimum of the database key.

sgp.io.DatabaseIO.std

std(key: str) -> float

Get the standard deviation of the database key.

sgp.io.EquationIO

sgp.io.HSSIO

Bases: HashableBaseModelIO

sgp.io.HSSIO.predict

predict(soilType: str, inputs: Dict[str, float]) -> Tuple[Dict[str, str], Dict[str, float]]

Get the output properties for the HSS model.

sgp.io.HSSParametersIO

Bases: HashableBaseModelIO

sgp.io.HSSParametersIO.predict

predict(inputs: Dict[str, float]) -> Tuple[Dict[str, str], Dict[str, float]]

Get the output properties for the HSS model.

sgp.io.HashableBaseModelIO

Bases: BaseModel

Input/output utilities for the models with support for the following features:

  • Hashing of the model
  • Conversion to and from dictionaries, json, toml, and yaml files
  • Compatibility with pydantic v1 and v2

sgp.io.HashableBaseModelIO.exclude property

exclude: set[int] | set[str] | dict[int, Any] | dict[str, Any] | None

Fields to exclude from the model, typically used to exclude arbitrary types when it is allowed in the pydantic model to avoid hashing issues.

sgp.io.HashableBaseModelIO.__hash__

__hash__() -> int

Return the hash of the model.

sgp.io.HashableBaseModelIO.fromBytes classmethod

fromBytes(*, binary: bytes | None = None, path: str | None = None, **kwargs) -> Self

Load the model from a binary string or file if a path is provided.

sgp.io.HashableBaseModelIO.fromCryptography classmethod

fromCryptography(*, binary: bytes | None = None, path: str | None = None, **kwargs) -> Self

Decrypt the model using the key.

sgp.io.HashableBaseModelIO.fromDict classmethod

fromDict(*, data: dict, **kwargs) -> Self

Load the model from a dictionary.

sgp.io.HashableBaseModelIO.fromJson classmethod

fromJson(*, string: str | None = None, path: str | None = None, **kwargs)

Load the model from a json string or file if a path is provided.

sgp.io.HashableBaseModelIO.fromToml classmethod

fromToml(*, string: str | None = None, path: str | None = None, **kwargs)

Load the model from a toml string or file if a path is provided.

sgp.io.HashableBaseModelIO.fromYaml classmethod

fromYaml(*, string: str | None = None, path: str | None = None, **kwargs)

Load the model from a yaml string or file if a path is provided.

sgp.io.HashableBaseModelIO.toBytes

toBytes(path: Path | str | None = None, **kwargs) -> bytes | None

Convert the model to a binary string or save it to a file if a path is provided.

sgp.io.HashableBaseModelIO.toCryptography

toCryptography(path: Path | str | None = None, **kwargs) -> bytes | None

Encrypt the model using the key.

sgp.io.HashableBaseModelIO.toDict

toDict(**kwargs) -> dict

Convert the model to a dictionary.

sgp.io.HashableBaseModelIO.toJson

toJson(path: Path | str | None = None, **kwargs) -> str | None

Convert the model to a json string or save it to a file if a path is provided.

sgp.io.HashableBaseModelIO.toToml

toToml(path: Path | str | None = None, **kwargs) -> str | None

Convert the model to a toml string or save it to a file if a path is provided.

sgp.io.HashableBaseModelIO.toYaml

toYaml(path: Path | str | None = None, **kwargs) -> str | None

Convert the model to a yaml string or save it to a file if a path is provided.

sgp.io.HashableBaseModelIO.update

update(data: dict = None, **kwargs) -> Self

Update the options of the optimizer

sgp.io.InputIO

Bases: VariableIO

sgp.io.MPDIO

Bases: HashableBaseModelIO

sgp.io.MPDIO.keys property

keys: List[str]

Get the keys for the multivariate distribution.

sgp.io.SGPIO

sgp.io.SoilParametersIO

sgp.io.VariableIO

sgp.io.hashkey

hashkey(*args, **kwargs)

Return a cache key for the specified hashable arguments, convert non-hashable arguments to hashable ones.