001/* 002 * Copyright (c) 2015-2020, Oracle and/or its affiliates. All rights reserved. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.tribuo.regression.evaluation; 018 019import org.tribuo.evaluation.Evaluation; 020import org.tribuo.regression.Regressor; 021 022import java.util.Map; 023 024/** 025 * Defines methods that calculate regression performance. 026 */ 027public interface RegressionEvaluation extends Evaluation<Regressor> { 028 029 /** 030 * The average Mean Absolute Error across all dimensions. 031 * @return The average Mean Absolute Error. 032 */ 033 double averageMAE(); 034 035 /** 036 * Calculates the Mean Absolute Error for that dimension. 037 * @param variable The regression dimension to use. 038 * @return The Mean Absolute Error. 039 */ 040 double mae(Regressor variable); 041 042 /** 043 * Calculates the Mean Absolute Error for all dimensions. 044 * @return The Mean Absolute Error. 045 */ 046 Map<Regressor, Double> mae(); 047 048 /** 049 * The average R2 across all dimensions. 050 * @return The average R2. 051 */ 052 double averageR2(); 053 054 /** 055 * Calculates R2 for the supplied dimension. 056 * @param variable The regression dimension to use. 057 * @return The R2. 058 */ 059 double r2(Regressor variable); 060 061 /** 062 * Calculates R2 for all dimensions. 063 * @return The R2. 064 */ 065 Map<Regressor, Double> r2(); 066 067 /** 068 * The average RMSE across all dimensions. 069 * @return The average RMSE. 070 */ 071 double averageRMSE(); 072 073 /** 074 * Calculates the Root Mean Squared Error (i.e., the square root of the average squared errors across all data points) for the supplied dimension. 075 * @param variable The regression dimension to use. 076 * @return The RMSE. 077 */ 078 double rmse(Regressor variable); 079 080 /** 081 * Calculates the RMSE for all dimensions. 082 * @return The RMSE. 083 */ 084 Map<Regressor, Double> rmse(); 085 086 /** 087 * The average explained variance across all dimensions. 088 * @return The average explained variance. 089 */ 090 double averagedExplainedVariance(); 091 092 /** 093 * Calculates the explained variance of the ground truth using the predictions for the supplied dimension. 094 * @param variable The regression dimension to use. 095 * @return The explained variance. 096 */ 097 double explainedVariance(Regressor variable); 098 099 /** 100 * Calculatest the explained variance for all dimensions. 101 * @return The explained variance. 102 */ 103 Map<Regressor, Double> explainedVariance(); 104 105}