# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Transforms.GlobalContrastNormalizer
"""

import numbers

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


def transforms_globalcontrastnormalizer(
        data,
        output_data=None,
        model=None,
        column=None,
        sub_mean=True,
        use_std_dev=False,
        scale=1.0,
        **params):
    """
    **Description**
        Performs a global contrast normalization on input values: Y = (s * X
        - M) / D, where s is a scale, M is mean and D is either L2
        norm or standard deviation.

    :param column: New column definition(s) (optional form: name:src)
        (inputs).
    :param sub_mean: Subtract mean from each value before normalizing
        (inputs).
    :param data: Input dataset (inputs).
    :param use_std_dev: Normalize by standard deviation rather than
        L2 norm (inputs).
    :param scale: Scale features by this value (inputs).
    :param output_data: Transformed dataset (outputs).
    :param model: Transform model (outputs).
    """

    entrypoint_name = 'Transforms.GlobalContrastNormalizer'
    inputs = {}
    outputs = {}

    if column is not None:
        inputs['Column'] = try_set(
            obj=column,
            none_acceptable=True,
            is_of_type=list,
            is_column=True)
    if sub_mean is not None:
        inputs['SubMean'] = try_set(
            obj=sub_mean,
            none_acceptable=True,
            is_of_type=bool)
    if data is not None:
        inputs['Data'] = try_set(
            obj=data,
            none_acceptable=False,
            is_of_type=str)
    if use_std_dev is not None:
        inputs['UseStdDev'] = try_set(
            obj=use_std_dev,
            none_acceptable=True,
            is_of_type=bool)
    if scale is not None:
        inputs['Scale'] = try_set(
            obj=scale,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if output_data is not None:
        outputs['OutputData'] = try_set(
            obj=output_data,
            none_acceptable=False,
            is_of_type=str)
    if model is not None:
        outputs['Model'] = try_set(
            obj=model,
            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

# - Generated by tools/entrypoint_compiler.py: do not edit by hand
"""
Transforms.GlobalContrastNormalizer
"""

import numbers

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


def transforms_globalcontrastnormalizer(
        data,
        output_data=None,
        model=None,
        column=None,
        sub_mean=True,
        use_std_dev=False,
        scale=1.0,
        **params):
    """
    **Description**
        Performs a global contrast normalization on input values: Y = (s * X
        - M) / D, where s is a scale, M is mean and D is either L2
        norm or standard deviation.

    :param column: New column definition(s) (optional form: name:src)
        (inputs).
    :param sub_mean: Subtract mean from each value before normalizing
        (inputs).
    :param data: Input dataset (inputs).
    :param use_std_dev: Normalize by standard deviation rather than
        L2 norm (inputs).
    :param scale: Scale features by this value (inputs).
    :param output_data: Transformed dataset (outputs).
    :param model: Transform model (outputs).
    """

    entrypoint_name = 'Transforms.GlobalContrastNormalizer'
    inputs = {}
    outputs = {}

    if column is not None:
        inputs['Column'] = try_set(
            obj=column,
            none_acceptable=True,
            is_of_type=list,
            is_column=True)
    if sub_mean is not None:
        inputs['SubMean'] = try_set(
            obj=sub_mean,
            none_acceptable=True,
            is_of_type=bool)
    if data is not None:
        inputs['Data'] = try_set(
            obj=data,
            none_acceptable=False,
            is_of_type=str)
    if use_std_dev is not None:
        inputs['UseStdDev'] = try_set(
            obj=use_std_dev,
            none_acceptable=True,
            is_of_type=bool)
    if scale is not None:
        inputs['Scale'] = try_set(
            obj=scale,
            none_acceptable=True,
            is_of_type=numbers.Real)
    if output_data is not None:
        outputs['OutputData'] = try_set(
            obj=output_data,
            none_acceptable=False,
            is_of_type=str)
    if model is not None:
        outputs['Model'] = try_set(
            obj=model,
            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

# - Generated by tools/entrypoint_compiler.py: do not edit by hand Transforms.GlobalContrastNormalizer **Description**         Performs a global contrast normalization on input values: Y = (s * X         - M) / D, where s is a scale, M is mean and D is either L2         norm or standard deviation.      :param column: New column definition(s) (optional form: name:src)         (inputs).     :param sub_mean: Subtract mean from each value before normalizing         (inputs).     :param data: Input dataset (inputs).     :param use_std_dev: Normalize by standard deviation rather than         L2 norm (inputs).     :param scale: Scale features by this value (inputs).     :param output_data: Transformed dataset (outputs).     :param model: Transform model (outputs).