mendevi.models.base.Model

class mendevi.models.base.Model(*args: tuple, **kwargs: dict)[source]

Common structure to all models.

Attributes

citestr

The latex bibtext model citation.

parameterstorch.Tensor | None

The trainable parameters of the model (read and write).

input_labelslist[str]

The name of all input parameters (readonly).

output_labelslist[str]

The name of all output parameters (readonly).

accuracydict[str, float]

For each output label, associate the standard deviation of the associated average error. This dictionary is constructed when the .fit method is called (readonly).

Initialise the model.

Parameters

titlestr, optional

The model title.

**kwargsdict

Includes the following fields.

sourcesstr

All sources for the model, the conference paper, the authors, etc.

input_labelslist[str]

The name of all input parameters. The possibles values are mendevi.plot.axis.Name.

output_labelslist[str]

The name of all output parameters. The possibles values are mendevi.plot.axis.Name.

parametersobject, optional

The learnable parameters for regressive models.

property accuracy: dict[str, float]

Return the error std for each output label.

property cite: str

Return the bibtex citation.

fit(database: Path | str, select: str | None = None, query: str | None = None, table: str | None = None) Self[source]

Fit the trainable hyper parameters of the model.

Parameters

databasepathlike

The training database.

selectstr, optional

The python expression to keep the line, like mendevi plot --filter.

querystr, optional

If provided, use this sql query to perform the request, otherwise (default) attemps to guess the query.

tablestr, optional

The main sql table juste after the FROM in SELECT. It helps to choose the write query when there is several candidates.

Return

self

A reference to the inplace fitted model.

property input_labels: list[str]

Return the name of all input parameters.

property output_labels: list[str]

Return the name of all output parameters.

property parameters: Tensor

Return the trainable parameters of the model.

predict(*input_args: tuple, **input_kwargs: dict) dict[str][source]

Perform the prediction(s) of this model.

Parameters

*input_args, **input_kwargs

The parameters values, with the keys defined during initialisation.

Returns

predictiondict[str]

Associate each ouput variable with the prediction.

predict_from_video(video: Path | str, *args: tuple, **kwargs: dict) dict[str][source]

Simplify the predict method by automatically extracting parameters from the video.

Parameters

videopathlike

The path to the video whose behavior we want to predict.

*args, **kwargs, optional

The other arguments are passed to the prdict method.

Returns

predictiondict[str]

The value returned by the predict method.