# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Models.AnomalyDetectionEvaluator
"""

import numbers

from ..utils.entrypoints import EntryPoint
from ..utils.utils import try_set, unlist


def models_anomalydetectionevaluator(
        data,
        warnings=None,
        overall_metrics=None,
        per_instance_metrics=None,
        name_column='Name',
        k=10,
        p=0.01,
        num_top_results=50,
        stream=True,
        max_auc_examples=-1,
        label_column=None,
        weight_column=None,
        score_column=None,
        strat_column=None,
        **params):
    """
    **Description**
        Evaluates an anomaly detection scored dataset.

    :param data: The data to be used for evaluation. (inputs).
    :param name_column: Name column name. (inputs).
    :param k: Expected number of false positives (inputs).
    :param p: Expected false positive rate (inputs).
    :param num_top_results: Number of top-scored predictions to
        display (inputs).
    :param stream: Whether to calculate metrics in one pass (inputs).
    :param max_auc_examples: The number of samples to use for AUC
        calculation. If 0, AUC is not computed. If -1, the whole
        dataset is used (inputs).
    :param label_column: Column to use for labels. (inputs).
    :param weight_column: Weight column name. (inputs).
    :param score_column: Score column name. (inputs).
    :param strat_column: Stratification column name. (inputs).
    :param warnings: Warning dataset (outputs).
    :param overall_metrics: Overall metrics dataset (outputs).
    :param per_instance_metrics: Per instance metrics dataset
        (outputs).
    """

    entrypoint_name = 'Models.AnomalyDetectionEvaluator'
    inputs = {}
    outputs = {}

    if data is not None:
        inputs['Data'] = try_set(
            obj=data,
            none_acceptable=False,
            is_of_type=str)
    if name_column is not None:
        inputs['NameColumn'] = try_set(
            obj=name_column,
            none_acceptable=True,
            is_of_type=str,
            is_column=True)
    if k is not None:
        inputs['K'] = try_set(
            obj=k,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if p is not None:
        inputs['P'] = try_set(
            obj=p,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if num_top_results is not None:
        inputs['NumTopResults'] = try_set(
            obj=num_top_results,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if stream is not None:
        inputs['Stream'] = try_set(
            obj=stream,
            none_acceptable=True,
            is_of_type=bool)
    if max_auc_examples is not None:
        inputs['MaxAucExamples'] = try_set(
            obj=max_auc_examples,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if label_column is not None:
        inputs['LabelColumn'] = try_set(
            obj=label_column,
            none_acceptable=True,
            is_of_type=str,
            is_column=True)
    if weight_column is not None:
        inputs['WeightColumn'] = try_set(
            obj=weight_column,
            none_acceptable=True,
            is_of_type=str,
            is_column=True)
    if score_column is not None:
        inputs['ScoreColumn'] = try_set(
            obj=score_column,
            none_acceptable=True,
            is_of_type=str,
            is_column=True)
    if strat_column is not None:
        inputs['StratColumn'] = try_set(
            obj=strat_column,
            none_acceptable=True,
            is_of_type=list,
            is_column=True)
    if warnings is not None:
        outputs['Warnings'] = try_set(
            obj=warnings, none_acceptable=False, is_of_type=str)
    if overall_metrics is not None:
        outputs['OverallMetrics'] = try_set(
            obj=overall_metrics, none_acceptable=False, is_of_type=str)
    if per_instance_metrics is not None:
        outputs['PerInstanceMetrics'] = try_set(
            obj=per_instance_metrics, none_acceptable=False, is_of_type=str)

    input_variables = {
        x for x in unlist(inputs.values())
        if isinstance(x, str) and x.startswith("$")}
    output_variables = {
        x for x in unlist(outputs.values())
        if isinstance(x, str) and x.startswith("$")}

    entrypoint = EntryPoint(
        name=entrypoint_name, inputs=inputs, outputs=outputs,
        input_variables=input_variables,
        output_variables=output_variables)
    return entrypoint
