Module qsarmodelingpy.calculate_parameters

Define algorithms for some statistics, such as SSY, PRESS, , MAE, RMSE, R

Functions

def calcMAE(yreal, ypred) ‑> float

Calculates the Mean Absolute Error.

MAE = \dfrac{\sum\limits_{i=1}^n \left\vert y_i - \hat y_i \right\vert}{n}

where y is the predicted value, \hat y is the true value and n is the number of data points.

Args

yreal : DataFrame,list,array
The real data.
ypred : DataFrame,list,array
The predicted data.

Returns

float
MAE
def calcPress(yreal, ypred) ‑> float

Calculates predicted residual error sum of squares of ypred regarding yreal.

PRESS = \sum\limits_{i} (y_i - \hat y_{i})^2

Args

yreal : DataFrame,list,array
The real data.
ypred : DataFrame,list,array
The predicted data.

Returns

float
PRESS
def calcR(yreal, ypred) ‑> float

Calculates R .

Args

yreal : DataFrame,list,array
The real data.
ypred : DataFrame,list,array
The predicted data.

Returns

float
R
def calcR2(yreal, ypred, mean_y=None) ‑> float

Calculates the coefficient of determination ( R^2 ).

R^2 = 1-\dfrac{PRESS}{SSY}

Args

yreal : DataFrame,list,array
The real data.
ypred : DataFrame,list,array
The predicted data.
mean_y : float, optional
Mean of yreal. If None, it'll be calculated. Defaults to None.

Returns

float
R^2

See also:

def calcRMSE(yreal, ypred) ‑> float

Calculates the Root Mean Square Error.

RMSE = \sqrt{\dfrac{PRESS}{n}}

Args

yreal : DataFrame,list,array
The real data.
ypred : DataFrame,list,array
The predicted data.

Returns

float
RMSE

See also:

def ssy(y, mean_y=None) ‑> float

Calculates Total Sum of Squares of the dependent variable.

SSY = \sum\limits_{i} (y_i - \bar y)^2

Args

y : DataFrame, list, array
The vector to calculate SSY.
mean_y : float, optional
Mean of y. If None, it'll be calculated. Defaults to None.

Returns

float
SSY