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.
- parameterstuple[tuple[str], dict[tuple, object]] | None
The fitted parameters of the trainable model (readonly).
- aggregationlist[str]
The labels that divide clusterers (readonly).
- input_labelslist[str]
The name of all input parameters (readonly).
- input_labels_aggreglist[str]
The subset of input_label that does not contain the aggregation values (readonly).
- output_labelslist[str]
The name of all output parameters (readonly).
- accuracydict[str, dict]
For each cluster name, associate for each output label, the predicted and validation data. This dictionary is builded / overwitten when the .validate 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.
- aggregationlist[str]
Specifies the list of parameters that the model will not interpolate. By default, this list consists of the subset of discrete parameters from input_labels. For example, if you provide an empty list, a single instance of the model will be trained on all parameters.
- extract_video_props(video: Path | str) dict[str][source]¶
Excerpt from the video, useful settings for the model.
Parameters¶
- videopathlike
The path to the video whose behavior we want to
predict.
Returns¶
- propertiesdict[str]
For relevant input labels, associate the corresponding properties of the video provided as a parameter.
- 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.
- fit_generator(database: Path | str, select: str | None = None, query: str | None = None, table: str | None = None, *, _validate: bool = False) Self[source]¶
Fit the trainable hyper parameters of the model.
Implementation of :py:method:`fit`.
- property input_labels_aggreg: list[str]¶
Return the subset of input_label that does not contain the aggregation values.
- predict(*input_args: tuple, **input_kwargs: dict) dict[str, list][source]¶
Perform the prediction(s) of this model.
Parameters¶
Returns¶
- predictiondict[str]
Associate each ouput variable with the prediction.
- predict_from_video(video: Path | str, *args: tuple, **kwargs: dict) dict[str, list][source]¶
Simplify the predict method by automatically extracting parameters from the video.
Parameters¶
Returns¶
- predictiondict[str]
The value returned by the
predictmethod.