Predictions 2
Thu Aug 05 2021 15:36:04 GMT+0000 (Coordinated Universal Time)
Saved by
@CleverIT
def ratios(x, y, z):
predictions = list(df['Predictions'])[:-1]
price = list(df['Price'])[:-1]
corrects = []
for i in range(len(predictions)-y, len(predictions)-z):
if (predictions[i] * (1.0 + (x/100.0))) > price[i] > (predictions[i] * (1.0 - (x/100.0))):
corrects.append(1.0)
else:
corrects.append(0.0)
return np.average(corrects) * 100
def mape(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
return np.mean(np.abs((y_true - y_pred) / y_true)) * 100
content_copyCOPY
Comments