To calculate the root-mean-square error (RMSE), first import the math module and numpy module:
main.py31 chars3 lines
Given the actual values y_true and predicted values y_pred as arrays, RMSE can be calculated with the following code:
main.py80 chars3 linesTo calculate the confidence interval, first import the statistics module:
main.py18 chars2 lines
Given a list of values data, a confidence level of conf_level, and a sample size of n, you can calculate the confidence interval with the following code:
main.py264 chars6 linesTo calculate the relative error as a percentage, define a function that takes in the actual value y_true and predicted value y_pred as inputs:
main.py85 chars3 linesgistlibby LogSnag