from typing import Any, ClassVar, Literal
from typing_extensions import Self

from numpy import ndarray

from .._typing import ArrayLike, Float, MatrixLike
from ..base import BaseEstimator

# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#         Gael Varoquaux <gael.varoquaux@normalesup.org>
#         Virgile Fritsch <virgile.fritsch@inria.fr>
#
# License: BSD 3 clause

# avoid division truncation

def log_likelihood(emp_cov: MatrixLike, precision: MatrixLike) -> Float: ...
def empirical_covariance(X: ArrayLike, *, assume_centered: bool = False) -> ndarray: ...

class EmpiricalCovariance(BaseEstimator):
    feature_names_in_: ndarray = ...
    n_features_in_: int = ...
    precision_: ndarray = ...
    covariance_: ndarray = ...
    location_: ndarray = ...

    _parameter_constraints: ClassVar[dict] = ...

    def __init__(self, *, store_precision: bool = True, assume_centered: bool = False) -> None: ...
    def get_precision(self) -> ndarray: ...
    def fit(self, X: MatrixLike, y: Any = None) -> Self: ...
    def score(self, X_test: MatrixLike, y: Any = None) -> Float: ...
    def error_norm(
        self,
        comp_cov: MatrixLike,
        norm: Literal["frobenius", "spectral"] = "frobenius",
        scaling: bool = True,
        squared: bool = True,
    ) -> Float: ...
    def mahalanobis(self, X: MatrixLike) -> ndarray: ...
