Skip to content

johnson

sgp.models.johnson.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.models.johnson.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.models.johnson.HashableBaseModelIO.__hash__

__hash__() -> int

Return the hash of the model.

sgp.models.johnson.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.models.johnson.HashableBaseModelIO.fromCryptography classmethod

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

Decrypt the model using the key.

sgp.models.johnson.HashableBaseModelIO.fromDict classmethod

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

Load the model from a dictionary.

sgp.models.johnson.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.models.johnson.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.models.johnson.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.models.johnson.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.models.johnson.HashableBaseModelIO.toCryptography

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

Encrypt the model using the key.

sgp.models.johnson.HashableBaseModelIO.toDict

toDict(**kwargs) -> dict

Convert the model to a dictionary.

sgp.models.johnson.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.models.johnson.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.models.johnson.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.models.johnson.HashableBaseModelIO.update

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

Update the options of the optimizer

sgp.models.johnson.Johnson

Bases: HashableBaseModelIO

Johnson distribution model.

sgp.models.johnson.Johnson.X2Y classmethod

X2Y(X: ArrayLike | Number, type: Literal['su', 'sb', 'sl'], aX: float, bX: float, aY: float, bY: float) -> ndarray | Number

Denormalize the data from the Johnson distribution.

sgp.models.johnson.Johnson.Y2X classmethod

Y2X(Y: ArrayLike | Number, type: Literal['su', 'sb', 'sl'], aX: float, bX: float, aY: float, bY: float) -> ndarray | Number

Normalize the data to the Johnson distribution.

sgp.models.johnson.Johnson.__call__

__call__(z: Sequence[float], data: ArrayLike) -> float

Calculate the fitness of the Johnson distribution.

sgp.models.johnson.Johnson.dist classmethod

dist(type: Literal['su', 'sb', 'sl'], aX: float, bX: float, aY: float, bY: float, mu: float = 0.0, sigma: float = 1.0) -> Tuple[rv_continuous, Tuple, Dict[str, ...]]

Get the distribution object and distribution parameters.

sgp.models.johnson.Johnson.fit

fit(data: ArrayLike, z: float) -> Tuple[Literal['su', 'sb', 'sl'], float, float, float, float]

Fit the Johnson distribution to the data.

sgp.models.johnson.Johnson.fitness

fitness(z: Sequence[float], data: ArrayLike) -> float

Calculate the fitness of the Johnson distribution.

sgp.models.johnson.Johnson.kstest_pvalue

kstest_pvalue(z: Sequence[float], data: ArrayLike) -> float

Calculate the p-value of the Johnson distribution.

sgp.models.johnson.Johnson.kstest_statistic

kstest_statistic(z: Sequence[float], data: ArrayLike) -> float

Calculate the statistic of the Johnson distribution.