stouputils.data_science.models.abstract_model module#
Abstract base class for all model implementations. Defines the interface that all concrete model classes must implement.
Provides abstract methods for core model operations including:
Class routine management
Model loading
Training procedures
Prediction functionality
Evaluation metrics
Classes inheriting from AbstractModel must implement all methods.
- class AbstractModel(
- num_classes: int,
- kfold: int = 0,
- transfer_learning: str = 'imagenet',
- **override_params: Any,
Bases:
objectAbstract class for all models to copy and implement the methods.
- routine_full(
- dataset: Dataset,
- verbose: int = 0,
Function ‘routine_full’ is abstract and must be implemented by a subclass
- class_train(
- dataset: Dataset,
- verbose: int = 0,
Function ‘class_train’ is abstract and must be implemented by a subclass
- class_predict(
- X_test: Iterable[Any],
Function ‘class_predict’ is abstract and must be implemented by a subclass
- class_evaluate(
- dataset: Dataset,
- metrics_names: tuple[str, ...] = (),
- save_model: bool = False,
- verbose: int = 0,
Function ‘class_evaluate’ is abstract and must be implemented by a subclass
- _fit(
- model: Any,
- x: Any,
- y: Any | None = None,
- validation_data: tuple[Any, Any] | None = None,
- shuffle: bool = True,
- batch_size: int | None = None,
- epochs: int = 1,
- callbacks: list[Any] | None = None,
- class_weight: dict[int, float] | None = None,
- verbose: int = 0,
- *args: Any,
- **kwargs: Any,
Function ‘_fit’ is abstract and must be implemented by a subclass
- _get_callbacks() list[Any][source]#
Function ‘_get_callbacks’ is abstract and must be implemented by a subclass
- _get_metrics() list[Any][source]#
Function ‘_get_metrics’ is abstract and must be implemented by a subclass
- _get_optimizer(
- learning_rate: float = 0.0,
Function ‘_get_optimizer’ is abstract and must be implemented by a subclass
- _get_base_model() Any[source]#
Function ‘_get_base_model’ is abstract and must be implemented by a subclass
- _get_architectures(
- optimizer: Any = None,
- loss: Any = None,
- metrics: list[Any] | None = None,
Function ‘_get_architectures’ is abstract and must be implemented by a subclass
- _find_best_learning_rate(
- dataset: Dataset,
- verbose: int = 0,
Function ‘_find_best_learning_rate’ is abstract and must be implemented by a subclass
- _train_fold(
- dataset: Dataset,
- fold_number: int = 0,
- mlflow_prefix: str = 'history',
- verbose: int = 0,
Function ‘_train_fold’ is abstract and must be implemented by a subclass
- _log_final_model() None[source]#
Function ‘_log_final_model’ is abstract and must be implemented by a subclass
- _find_best_learning_rate_subprocess(
- dataset: Dataset,
- queue: Queue[Any] | None = None,
- verbose: int = 0,
Function ‘_find_best_learning_rate_subprocess’ is abstract and must be implemented by a subclass