root_mean_squared_log_error#
- sklearn.metrics.root_mean_squared_log_error(y_true, y_pred, *, sample_weight=None, multioutput='uniform_average')[source]#
均方根对数误差回归损失。
Read more in the User Guide.
1.4 版本新增。
- 参数:
- y_true形状为 (n_samples,) 或 (n_samples, n_outputs) 的类数组对象
真实(正确)的目标值。
- y_pred形状为 (n_samples,) 或 (n_samples, n_outputs) 的类数组对象
估计的目标值。
- sample_weightshape 为 (n_samples,) 的 array-like, default=None
样本权重。
- multioutput{‘raw_values’, ‘uniform_average’} 或形状为 (n_outputs,) 的类数组对象, default=’uniform_average’
定义了多输出值聚合的方式。类数组值定义了用于平均误差的权重。
- ‘raw_values’
Returns a full set of errors when the input is of multioutput format.
- ‘uniform_average’
所有输出的误差以统一权重进行平均。
- 返回:
- lossfloat or ndarray of floats
一个非负浮点值(最佳值为0.0),或者一个浮点值数组,每个单独目标一个值。
示例
>>> from sklearn.metrics import root_mean_squared_log_error >>> y_true = [3, 5, 2.5, 7] >>> y_pred = [2.5, 5, 4, 8] >>> root_mean_squared_log_error(y_true, y_pred) 0.199...