Module Expr Str ImportFrom alias Import alias identifier ImportFrom alias alias ImportFrom alias ImportFrom alias Import alias Assign NameStore ListLoad Str Str Str Str Str FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Expr Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad keyword NameLoad If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Num Num If CompareEq AttributeLoad NameLoad attr Num body Assign NameStore Call AttributeLoad NameLoad attr TupleLoad Num Num If CompareNotEq SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num body Raise Call NameLoad Call AttributeLoad Str attr SubscriptLoad AttributeLoad NameLoad attr Index Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore TupleLoad NameLoad Str Str Str If CompareNotIn NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad keyword NameLoad If CompareEq NameLoad Num body Raise Call NameLoad Str orelse If CompareNotEq NameLoad Call NameLoad NameLoad body Raise Call NameLoad BinOpMod Str TupleLoad Call NameLoad NameLoad NameLoad Assign NameStore IfExp CompareEq NameLoad Num Str Str Return TupleLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Str body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad keyword NameLoad keyword Num If Call NameLoad NameLoad NameLoad body If CompareEq NameLoad Str body Return NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Str body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpPow BinOpSub NameLoad NameLoad Num keyword Num keyword NameLoad If Call NameLoad NameLoad NameLoad body If CompareEq NameLoad Str body Return NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad Str If CompareEq NameLoad Str body Raise Call NameLoad Str Return Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad Str body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub NameLoad NameLoad keyword NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr BinOpPow BinOpSub BinOpSub NameLoad NameLoad NameLoad Num keyword NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr BinOpPow BinOpSub NameLoad NameLoad Num keyword NameLoad keyword Num Assign NameStore CompareNotEq NameLoad Num Assign NameStore CompareNotEq NameLoad Num Assign NameStore BinOpBitAnd NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Assign SubscriptStore NameLoad Index NameLoad BinOpSub Num BinOpDiv SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpBitAnd NameLoad UnaryOpInvert NameLoad Num If Call NameLoad NameLoad NameLoad body If CompareEq NameLoad Str body Return NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad orelse Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults NameLoad NameLoad body Expr Str Assign TupleStore NameStore NameStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad ExtSlice Slice Index AttributeLoad NameLoad attr orelse Assign NameStore Num Assign NameStore Call AttributeLoad BinOpMult NameLoad BinOpPow BinOpSub NameLoad NameLoad Num attr keyword Num keyword AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad BinOpMult NameLoad BinOpPow BinOpSub NameLoad Call AttributeLoad NameLoad attr NameLoad keyword Num keyword NameLoad Num attr keyword Num keyword AttributeLoad NameLoad attr Assign NameStore CompareNotEq NameLoad Num Assign NameStore CompareNotEq NameLoad Num Assign NameStore BinOpBitAnd NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Assign SubscriptStore NameLoad Index NameLoad BinOpSub Num BinOpDiv SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign SubscriptStore NameLoad Index BinOpBitAnd NameLoad UnaryOpInvert NameLoad Num If BoolOpAnd CompareIs NameLoad NameLoad CompareNotEq SubscriptLoad AttributeLoad NameLoad attr Index Num Num body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Str If Call NameLoad NameLoad NameLoad body If CompareEq NameLoad Str body Return NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad orelse If CompareEq NameLoad Str body Assign NameStore NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return Num orelse Return Num orelse Assign NameStore NameLoad Return Call AttributeLoad NameLoad attr NameLoad keyword NameLoad decorator_list
N/A N/A Metrics to assess performance on regression task

Functions named as ``*_score`` return a scalar value to maximize: the higher
the better

Function named as ``*_error`` or ``*_loss`` return a scalar value to minimize:
the lower the better
 __future__ division N/A numpy np utils.validation check_array check_consistent_length utils.validation column_or_1d externals.six string_types N/A warnings N/A __ALL__ N/A mean_absolute_error mean_squared_error median_absolute_error r2_score explained_variance_score _check_reg_targets N/A N/A y_true y_pred multioutput N/A N/A N/A Check that y_true and y_pred belong to the same regression task

    Parameters
    ----------
    y_true : array-like,

    y_pred : array-like,

    multioutput : array-like or string in ['raw_values', uniform_average',
        'variance_weighted'] or None
        None is accepted due to backward compatibility of r2_score().

    Returns
    -------
    type_true : one of {'continuous', continuous-multioutput'}
        The type of the true target data, as output by
        'utils.multiclass.type_of_target'

    y_true : array-like of shape = (n_samples, n_outputs)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples, n_outputs)
        Estimated target values.

    multioutput : array-like of shape = (n_outputs) or string in ['raw_values',
        uniform_average', 'variance_weighted'] or None
        Custom output weights if ``multioutput`` is array-like or
        just the corresponding argument if ``multioutput`` is a
        correct keyword.

     N/A N/A check_consistent_length y_true y_pred N/A y_true N/A check_array y_true ensure_2d False N/A y_pred N/A check_array y_pred ensure_2d False N/A N/A N/A y_true ndim 1 N/A N/A y_true N/A N/A y_true reshape N/A -1 1 N/A N/A N/A y_pred ndim 1 N/A N/A y_pred N/A N/A y_pred reshape N/A -1 1 N/A N/A N/A N/A y_true shape N/A 1 N/A N/A y_pred shape N/A 1 N/A N/A N/A ValueError N/A N/A y_true and y_pred have different number of output ({0}!={1}) format N/A N/A y_true shape N/A 1 N/A N/A y_pred shape N/A 1 N/A n_outputs N/A N/A y_true shape N/A 1 N/A multioutput_options N/A None raw_values uniform_average variance_weighted N/A N/A multioutput multioutput_options N/A N/A multioutput N/A check_array multioutput ensure_2d False N/A N/A n_outputs 1 N/A N/A N/A ValueError Custom weights are useful only in multi-output cases. N/A N/A N/A n_outputs N/A len multioutput N/A N/A N/A ValueError N/A There must be equally many custom weights (%d) as outputs (%d). N/A N/A len multioutput n_outputs N/A y_type N/A N/A n_outputs 1 continuous continuous-multioutput N/A N/A y_type y_true y_pred multioutput N/A mean_absolute_error N/A N/A y_true y_pred sample_weight multioutput N/A None uniform_average N/A N/A Mean absolute error regression loss

    Read more in the :ref:`User Guide <mean_absolute_error>`.

    Parameters
    ----------
    y_true : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Estimated target values.

    sample_weight : array-like of shape = (n_samples), optional
        Sample weights.

    multioutput : string in ['raw_values', 'uniform_average']
        or array-like of shape (n_outputs)
        Defines aggregating of multiple output values.
        Array-like value defines weights used to average errors.

        'raw_values' :
            Returns a full set of errors in case of multioutput input.

        'uniform_average' :
            Errors of all outputs are averaged with uniform weight.


    Returns
    -------
    loss : float or ndarray of floats
        If multioutput is 'raw_values', then mean absolute error is returned
        for each output separately.
        If multioutput is 'uniform_average' or an ndarray of weights, then the
        weighted average of all output errors is returned.

        MAE output is non-negative floating point. The best value is 0.0.

    Examples
    --------
    >>> from sklearn.metrics import mean_absolute_error
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> mean_absolute_error(y_true, y_pred)
    0.5
    >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
    >>> y_pred = [[0, 2], [-1, 2], [8, -5]]
    >>> mean_absolute_error(y_true, y_pred)
    0.75
    >>> mean_absolute_error(y_true, y_pred, multioutput='raw_values')
    array([ 0.5,  1. ])
    >>> mean_absolute_error(y_true, y_pred, multioutput=[0.3, 0.7])
    ... # doctest: +ELLIPSIS
    0.849...
     N/A N/A y_type y_true y_pred multioutput N/A _check_reg_targets y_true y_pred multioutput N/A output_errors N/A N/A np average N/A N/A np abs N/A y_pred y_true weights sample_weight axis 0 N/A N/A isinstance multioutput string_types N/A N/A N/A multioutput raw_values N/A N/A output_errors N/A N/A N/A multioutput uniform_average N/A N/A multioutput None N/A N/A N/A np average output_errors weights multioutput N/A mean_squared_error N/A N/A y_true y_pred sample_weight multioutput N/A None uniform_average N/A N/A Mean squared error regression loss

    Read more in the :ref:`User Guide <mean_squared_error>`.

    Parameters
    ----------
    y_true : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Estimated target values.

    sample_weight : array-like of shape = (n_samples), optional
        Sample weights.

    multioutput : string in ['raw_values', 'uniform_average']
        or array-like of shape (n_outputs)
        Defines aggregating of multiple output values.
        Array-like value defines weights used to average errors.

        'raw_values' :
            Returns a full set of errors in case of multioutput input.

        'uniform_average' :
            Errors of all outputs are averaged with uniform weight.

    Returns
    -------
    loss : float or ndarray of floats
        A non-negative floating point value (the best value is 0.0), or an
        array of floating point values, one for each individual target.

    Examples
    --------
    >>> from sklearn.metrics import mean_squared_error
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> mean_squared_error(y_true, y_pred)
    0.375
    >>> y_true = [[0.5, 1],[-1, 1],[7, -6]]
    >>> y_pred = [[0, 2],[-1, 2],[8, -5]]
    >>> mean_squared_error(y_true, y_pred)  # doctest: +ELLIPSIS
    0.708...
    >>> mean_squared_error(y_true, y_pred, multioutput='raw_values')
    ... # doctest: +ELLIPSIS
    array([ 0.416...,  1.        ])
    >>> mean_squared_error(y_true, y_pred, multioutput=[0.3, 0.7])
    ... # doctest: +ELLIPSIS
    0.824...

     N/A N/A y_type y_true y_pred multioutput N/A _check_reg_targets y_true y_pred multioutput N/A output_errors N/A N/A np average N/A N/A y_true y_pred 2 axis 0 weights sample_weight N/A N/A isinstance multioutput string_types N/A N/A N/A multioutput raw_values N/A N/A output_errors N/A N/A N/A multioutput uniform_average N/A N/A multioutput None N/A N/A N/A np average output_errors weights multioutput N/A median_absolute_error N/A N/A y_true y_pred N/A N/A N/A Median absolute error regression loss

    Read more in the :ref:`User Guide <median_absolute_error>`.

    Parameters
    ----------
    y_true : array-like of shape = (n_samples)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples)
        Estimated target values.

    Returns
    -------
    loss : float
        A positive floating point value (the best value is 0.0).

    Examples
    --------
    >>> from sklearn.metrics import median_absolute_error
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> median_absolute_error(y_true, y_pred)
    0.5

     N/A N/A y_type y_true y_pred _ N/A _check_reg_targets y_true y_pred uniform_average N/A N/A y_type continuous-multioutput N/A N/A N/A ValueError Multioutput not supported in median_absolute_error N/A N/A N/A np median N/A N/A np abs N/A y_pred y_true N/A explained_variance_score N/A N/A y_true y_pred sample_weight multioutput N/A None uniform_average N/A N/A Explained variance regression score function

    Best possible score is 1.0, lower values are worse.

    Read more in the :ref:`User Guide <explained_variance_score>`.

    Parameters
    ----------
    y_true : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Estimated target values.

    sample_weight : array-like of shape = (n_samples), optional
        Sample weights.

    multioutput : string in ['raw_values', 'uniform_average',                 'variance_weighted'] or array-like of shape (n_outputs)
        Defines aggregating of multiple output scores.
        Array-like value defines weights used to average scores.

        'raw_values' :
            Returns a full set of scores in case of multioutput input.

        'uniform_average' :
            Scores of all outputs are averaged with uniform weight.

        'variance_weighted' :
            Scores of all outputs are averaged, weighted by the variances
            of each individual output.

    Returns
    -------
    score : float or ndarray of floats
        The explained variance or ndarray if 'multioutput' is 'raw_values'.

    Notes
    -----
    This is not a symmetric function.

    Examples
    --------
    >>> from sklearn.metrics import explained_variance_score
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> explained_variance_score(y_true, y_pred)  # doctest: +ELLIPSIS
    0.957...
    >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
    >>> y_pred = [[0, 2], [-1, 2], [8, -5]]
    >>> explained_variance_score(y_true, y_pred, multioutput='uniform_average')
    ... # doctest: +ELLIPSIS
    0.983...

     N/A N/A y_type y_true y_pred multioutput N/A _check_reg_targets y_true y_pred multioutput N/A y_diff_avg N/A N/A np average N/A y_true y_pred weights sample_weight axis 0 N/A numerator N/A N/A np average N/A N/A N/A y_true y_pred y_diff_avg 2 weights sample_weight axis 0 N/A y_true_avg N/A N/A np average y_true weights sample_weight axis 0 N/A denominator N/A N/A np average N/A N/A y_true y_true_avg 2 weights sample_weight axis 0 N/A nonzero_numerator N/A numerator 0 N/A nonzero_denominator N/A denominator 0 N/A valid_score N/A nonzero_numerator nonzero_denominator N/A output_scores N/A N/A np ones N/A N/A y_true shape N/A 1 N/A N/A output_scores N/A valid_score N/A 1 N/A N/A numerator N/A valid_score N/A denominator N/A valid_score N/A N/A output_scores N/A N/A nonzero_numerator N/A nonzero_denominator 0.0 N/A N/A isinstance multioutput string_types N/A N/A N/A multioutput raw_values N/A N/A output_scores N/A N/A N/A multioutput uniform_average N/A N/A avg_weights None N/A N/A N/A multioutput variance_weighted N/A N/A avg_weights denominator N/A N/A avg_weights multioutput N/A N/A N/A np average output_scores weights avg_weights N/A r2_score N/A N/A y_true y_pred sample_weight multioutput N/A None None N/A N/A R^2 (coefficient of determination) regression score function.

    Best possible score is 1.0 and it can be negative (because the
    model can be arbitrarily worse). A constant model that always
    predicts the expected value of y, disregarding the input features,
    would get a R^2 score of 0.0.

    Read more in the :ref:`User Guide <r2_score>`.

    Parameters
    ----------
    y_true : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Ground truth (correct) target values.

    y_pred : array-like of shape = (n_samples) or (n_samples, n_outputs)
        Estimated target values.

    sample_weight : array-like of shape = (n_samples), optional
        Sample weights.

    multioutput : string in ['raw_values', 'uniform_average', 'variance_weighted'] or None or array-like of shape (n_outputs)

        Defines aggregating of multiple output scores.
        Array-like value defines weights used to average scores.
        Default value corresponds to 'variance_weighted', this behaviour is
        deprecated since version 0.17 and will be changed to 'uniform_average'
        starting from 0.19.

        'raw_values' :
            Returns a full set of scores in case of multioutput input.

        'uniform_average' :
            Scores of all outputs are averaged with uniform weight.

        'variance_weighted' :
            Scores of all outputs are averaged, weighted by the variances
            of each individual output.

    Returns
    -------
    z : float or ndarray of floats
        The R^2 score or ndarray of scores if 'multioutput' is
        'raw_values'.

    Notes
    -----
    This is not a symmetric function.

    Unlike most other scores, R^2 score may be negative (it need not actually
    be the square of a quantity R).

    References
    ----------
    .. [1] `Wikipedia entry on the Coefficient of determination
            <https://en.wikipedia.org/wiki/Coefficient_of_determination>`_

    Examples
    --------
    >>> from sklearn.metrics import r2_score
    >>> y_true = [3, -0.5, 2, 7]
    >>> y_pred = [2.5, 0.0, 2, 8]
    >>> r2_score(y_true, y_pred)  # doctest: +ELLIPSIS
    0.948...
    >>> y_true = [[0.5, 1], [-1, 1], [7, -6]]
    >>> y_pred = [[0, 2], [-1, 2], [8, -5]]
    >>> r2_score(y_true, y_pred, multioutput='variance_weighted')  # doctest: +ELLIPSIS
    0.938...

     N/A N/A y_type y_true y_pred multioutput N/A _check_reg_targets y_true y_pred multioutput N/A N/A sample_weight None N/A N/A sample_weight N/A column_or_1d sample_weight N/A weight N/A sample_weight N/A N/A N/A N/A np newaxis N/A N/A weight 1.0 N/A numerator N/A N/A N/A weight N/A N/A y_true y_pred 2 sum axis 0 dtype N/A np float64 N/A denominator N/A N/A N/A weight N/A N/A y_true N/A N/A np average y_true axis 0 weights sample_weight 2 sum axis 0 dtype N/A np float64 N/A nonzero_denominator N/A denominator 0 N/A nonzero_numerator N/A numerator 0 N/A valid_score N/A nonzero_denominator nonzero_numerator N/A output_scores N/A N/A np ones N/A N/A N/A y_true shape N/A 1 N/A N/A output_scores N/A valid_score N/A 1 N/A N/A numerator N/A valid_score N/A denominator N/A valid_score N/A N/A output_scores N/A N/A nonzero_numerator N/A nonzero_denominator 0.0 N/A N/A N/A multioutput None N/A N/A N/A y_true shape N/A 1 1 N/A N/A N/A N/A warnings warn Default 'multioutput' behavior now corresponds to 'variance_weighted' value which is deprecated since 0.17, it will be changed to 'uniform_average' starting from 0.19. DeprecationWarning N/A multioutput variance_weighted N/A N/A isinstance multioutput string_types N/A N/A N/A multioutput raw_values N/A N/A output_scores N/A N/A N/A multioutput uniform_average N/A N/A avg_weights None N/A N/A N/A multioutput variance_weighted N/A N/A avg_weights denominator N/A N/A N/A N/A np any nonzero_denominator N/A N/A N/A N/A N/A np any nonzero_numerator N/A N/A 1.0 N/A N/A 0.0 N/A N/A avg_weights multioutput N/A N/A N/A np average output_scores weights avg_weights N/A