def effect3(history: History) -> float: value = history.get_event(2) if not history.get_event(2, delay=1): value *= 1.5 elif not history.get_event(2, delay=2): value *= 3 elif not history.get_event(2, delay=3): value *= 6 return value
def promo_delay(history: History) -> float: value = 0 if history.get_event(4): value = Uniform(40, 80).generate() elif history.get_event(4, delay=1): value = Uniform(30, 50).generate() elif history.get_event(4, delay=2): value = Uniform(0, 20).generate() return value
def effect_function(history: History) -> float: value = history.get_event() if history.get_event(201, delay=200): value *= 1.5 elif history.get_event(position=301, delay=300, null_value=None): value *= 3 elif history.get_event(delay=500): value *= 3 elif history.get_event(delay=600, position=601): value *= 3 value = history.get_event(401) + 4 return value
def sales(history: History) -> float: return history.get_event(1) * history.get_event(2)
def effect2(history: History) -> float: week = history.get_datetime().isocalendar()[1] ratio = week / 52 return history.get_event(1) * (1 + ratio / 20)
def effect1(history: History) -> float: day = history.get_datetime().weekday() # [Sun, Mon, Tue, Wed, Thu, Fri, Sat] ratios = [20, 20, 15, 10, 0, -30, -50] return history.get_event(1) * (1 + ratios[day] / 100)
def pathology(history: History) -> float: gene1 = history.get_event(1) > 0.8 gene2 = history.get_event(2) > 0.7 gene5 = history.get_event(5) > 0.6 return gene1 and gene2 or gene5
def effect_function1(h: History) -> float: return h.get_event()
def effect_function(history: History) -> float: return history.get_event()