# -*- coding:utf-8 -*-
"""
@author: yq
@time: 2024/1/2
@desc: 模型基类
"""
import abc
from typing import Dict

import numpy as np
import pandas as pd

from entitys import MetricFucResultEntity, MlConfigEntity, DataFeatureEntity


class ModelBase(metaclass=abc.ABCMeta):

    def __init__(self, ml_config: MlConfigEntity = None, *args, **kwargs):
        self._ml_config = ml_config

    @property
    def ml_config(self):
        return self._ml_config

    @abc.abstractmethod
    def get_report_template_path(self, ) -> str:
        pass

    @abc.abstractmethod
    def train(self, train_data: DataFeatureEntity, test_data: DataFeatureEntity, *args, **kwargs):
        pass

    @abc.abstractmethod
    def prob(self, x: pd.DataFrame, *args, **kwargs) -> np.array:
        pass

    @abc.abstractmethod
    def score(self, x: pd.DataFrame, *args, **kwargs) -> np.array:
        pass

    @abc.abstractmethod
    def score_rule(self, x: pd.DataFrame, *args, **kwargs) -> np.array:
        pass

    @abc.abstractmethod
    def model_save(self, *args, **kwargs):
        pass

    @abc.abstractmethod
    def model_load(self, path: str, *args, **kwargs):
        pass

    @abc.abstractmethod
    def train_report(self, *args, **kwargs) -> Dict[str, MetricFucResultEntity]:
        """
        特征报告
        """
        pass

    @abc.abstractmethod
    def jupyter_print(self, *args, **kwargs):
        """
        notebook输出
        """
        pass
