當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。