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

import pandas as pd

from entitys import MlConfigEntity, MetricFucResultEntity


class FeatureStrategyBase(metaclass=abc.ABCMeta):

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

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

    @abc.abstractmethod
    def feature_search(self, *args, **kwargs):
        """
        特征筛选
        """
        pass

    @abc.abstractmethod
    def variable_analyse(self, *args, **kwargs):
        """
        单个变量分析
        """
        pass

    @abc.abstractmethod
    def feature_generate(self, *args, **kwargs) -> pd.DataFrame:
        """
        特征转换
        """
        pass

    @abc.abstractmethod
    def feature_save(self, *args, **kwargs):
        """
        特征保存
        """
        pass

    @abc.abstractmethod
    def feature_load(self, path: str, *args, **kwargs):
        """
        特征加载
        """
        pass

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

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