notes

Personal notes
git clone git://git.laack.co/notes.git
Log | Files | Refs

RMSE.md (851B)


      1 # Root Mean Square Error
      2 
      3 ML CH2
      4 
      5 **Definition:** This is the most common form of error measuring for regression problems where you take the difference between each inference and the actual output, square it, do this with all samples, divide by the number of samples, and then take the square root. 
      6 
      7 This is common because it weights more heavily far off inferences than slighly off inferences.
      8 
      9 Here is a simple implementation:
     10 
     11 ```python
     12 import math
     13 
     14 # often you would use ordered pairs for expected and inference.
     15 expected = [10, 10, 4, 3, 2, 4, 5, 5]
     16 inference = [9 , 7, 3, 2, 1, 3, 2, 5]
     17 
     18 count = 0
     19 total = 0
     20 while count < len(expected):
     21     exp = expected[count]
     22     inf = inference[count]
     23     total += (exp - inf) ** 2
     24     count += 1
     25 
     26 total = total / count
     27 total = math.sqrt(total)
     28 print(total)
     29 ```
     30 
     31 Another metric for errors is [MAE](MAE.md)