'Grouping based on and plotting error statistics in python
I have implemented a regression model and retrieved results. Now to evaluate the results I want to create plot, where MAE, and its standard deviation are represented in the same figure. However, I want to group the date into intervals and evaluate statistics. Though, I can use sklearn metrics for calculating mean absolute error, it works on entire range of data. Can some one give an idea about how to group the data based on intervals.
The data is very large hence, could not share here. However, random data and implemented code for calculating bias, I am attaching below.
import pandas as pd
import random
import matplotlib.pyplot as plt
yact = random.sample(range(1, 100), 50)
ypred=random.sample(range(1, 100), 50)
df = pd.DataFrame(yact,columns=['yact'])
df['ypred']=ypred
df['bias']=df['yact']-df['ypred']
#groups=[20,40,60,80,100]
I want to creat groups of y pred based on yact (similar to groups given above). A reference figure which I am trying to plot is present in the first quadrant of below attached figure.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

