当前位置: 首页>>代码示例>>Python>>正文


Python regression.mean_squared_error方法代码示例

本文整理汇总了Python中sklearn.metrics.regression.mean_squared_error方法的典型用法代码示例。如果您正苦于以下问题:Python regression.mean_squared_error方法的具体用法?Python regression.mean_squared_error怎么用?Python regression.mean_squared_error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sklearn.metrics.regression的用法示例。


在下文中一共展示了regression.mean_squared_error方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: score

# 需要导入模块: from sklearn.metrics import regression [as 别名]
# 或者: from sklearn.metrics.regression import mean_squared_error [as 别名]
def score(self, X, y, step=1, method="r2"):
        """
        Produce multi-step prediction of y, and compute the metrics against y.
        Nan is ignored when computing the metrics.

        :param array-like X: exogenous input time series, shape = (n_samples,
                             n_exog_inputs)
        :param array-like y: target time series to predict, shape = (n_samples)
        :param int step: prediction step.
        :param string method: could be "r2" (R Square) or "mse" (Mean Square
                              Error).

        :return: prediction metric. Nan is ignored when computing the metrics.
        """
        ypred = self.predict(X, y, step=step)
        mask = np.isnan(y) | np.isnan(ypred)
        if method == "r2":
            return r2_score(y[~mask], ypred[~mask])
        elif method == "mse":
            return mean_squared_error(y[~mask], ypred[~mask]) 
开发者ID:jxx123,项目名称:fireTS,代码行数:22,代码来源:models.py

示例2: plot_predictions_by_dimension

# 需要导入模块: from sklearn.metrics import regression [as 别名]
# 或者: from sklearn.metrics.regression import mean_squared_error [as 别名]
def plot_predictions_by_dimension(data_x, data_y, data_test):
    score_y_by_dimension = predictions_by_dimension(data_y, data_test)
    score_x_by_dimension = predictions_by_dimension(data_x, data_test)
    mse = mean_squared_error(score_x_by_dimension, score_y_by_dimension)
    return score_x_by_dimension, score_y_by_dimension, mse 
开发者ID:rcamino,项目名称:multi-categorical-gans,代码行数:7,代码来源:mse_predictions_by_dimension.py

示例3: plot_predictions_by_categorical

# 需要导入模块: from sklearn.metrics import regression [as 别名]
# 或者: from sklearn.metrics.regression import mean_squared_error [as 别名]
def plot_predictions_by_categorical(data_x, data_y, data_test, variable_sizes):
    score_y_by_categorical = predictions_by_categorical(data_y, data_test, variable_sizes)
    score_x_by_categorical = predictions_by_categorical(data_x, data_test, variable_sizes)
    mse = mean_squared_error(score_x_by_categorical, score_y_by_categorical)
    return score_x_by_categorical, score_y_by_categorical, mse 
开发者ID:rcamino,项目名称:multi-categorical-gans,代码行数:7,代码来源:mse_predictions_by_categorical.py

示例4: mse_probabilities_by_dimension

# 需要导入模块: from sklearn.metrics import regression [as 别名]
# 或者: from sklearn.metrics.regression import mean_squared_error [as 别名]
def mse_probabilities_by_dimension(data_x, data_y):
    p_x_by_dimension = probabilities_by_dimension(data_x)
    p_y_by_dimension = probabilities_by_dimension(data_y)
    mse = mean_squared_error(p_x_by_dimension, p_y_by_dimension)
    return p_x_by_dimension, p_y_by_dimension, mse 
开发者ID:rcamino,项目名称:multi-categorical-gans,代码行数:7,代码来源:mse_probabilities_by_dimension.py


注:本文中的sklearn.metrics.regression.mean_squared_error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。