I am looking for an efficient way to calculate the following discounted sum for different lengths in an if-statement.
Basically, I want to do the following calculation in an if statement:
if value[0] - mean > delta ** 1 * value[1] + delta ** 2 * value[2] + delta ** 3 * value[3]:
continue
where delta = 0.9 for example and the value belongs to a list of numbers.
I tried the following, but it does not really seem to work until now:
if value[0] - mean > np.sum([delta ** i * value[i] for i in range(1,k)]):
continue
where k = 3 in this example but should be variable to different lengths.
How could I efficiently achieve this?
Many thanks for any comments.
Aucun commentaire:
Enregistrer un commentaire