Residual
add_residuals_col(df, residual_name='residual', true_column='y', pred_column='y_hat')
¶
Add a residuals column to the DataFrame.
PARAMETER | DESCRIPTION |
---|---|
df |
The input DataFrame.
TYPE:
|
residual_name |
The name for the new residuals column.
TYPE:
|
true_column |
The name of the column with true values.
TYPE:
|
pred_column |
The name of the column with predicted values.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
The DataFrame with the added residuals column. |
calculate_residual_bounds(rss, n_rows)
¶
Calculate upper and lower residual bounds.
PARAMETER | DESCRIPTION |
---|---|
rss |
The residual sum of squares.
TYPE:
|
n_rows |
The number of rows in the DataFrame.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[float, float]
|
A tuple containing the lower and upper residual bounds. |
get_residual_bounds(df, residual_column='residual')
¶
Calculate residual bounds for the DataFrame.
PARAMETER | DESCRIPTION |
---|---|
df |
The input DataFrame.
TYPE:
|
residual_column |
The name of the residuals column.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tuple[float, float]
|
A tuple containing the lower and upper residual bounds. |
get_residual_sum_square(df, residual_column='residual')
¶
Calculate the residual sum of squares.
PARAMETER | DESCRIPTION |
---|---|
df |
The input DataFrame.
TYPE:
|
residual_column |
The name of the residuals column.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
The residual sum of squares. |