import numpy as np
from plaster.run.base_result import BaseResult
from plaster.run.knn_v1.knn_v1_params import KNNV1Params


class KNNV1Result(BaseResult):
    name = "knn_v1"
    filename = "knn_v1.pkl"

    required_props = dict(
        params=KNNV1Params,
        true_pep_iz=(type(None), np.ndarray),
        pred_pep_iz=np.ndarray,
        scores=np.ndarray,
        runnerup_pep_iz=(type(None), np.ndarray),
        runnerup_scores=(type(None), np.ndarray),
    )

    def __repr__(self):
        try:
            return f"KNNV1Result with average score {np.mean(self.scores)}"
        except:
            return "KNNV1Result"
