def handles_predicting_cases_it_has_not_seen_before(self): user_tz = ['Eastern (US & Canada)', 'Pacific (US & Canada)'] l1_time = [9, 9] l1_day = [0, 1] l2_time = [9, 9] l2_day = [3, 4] l3_time = [None, 9] l3_day = [None, 5] schedule_type = [2, 3] training_data = pd.DataFrame({ 'user_tz': user_tz, 'l1_time': l1_time, 'l1_day': l1_day, 'l2_time': l2_time, 'l2_day': l2_day, 'l3_time': l3_time, 'l3_day': l3_day, 'schedule_type': schedule_type }) business_forecast = [{'schedule_type': 1, 'user_tz': 'Eastern (US & Canada)', 'frequency': 1 }, {'schedule_type': 4, 'user_tz': 'Pacific (US & Canada)', 'frequency': 2 }] model = GeneralProbModel() model.fit(training_data) p = model.predict(business_forecast) expect(True).to.equal(True)
def should_take_into_account_conditional_probability(self): user_tz = ['Eastern (US & Canada)', 'Pacific (US & Canada)'] l1_time = [9, 9] l1_day = [0, 1] l2_time = [9, 9] l2_day = [3, 4] l3_time = [None, 9] l3_day = [None, 5] schedule_type = [2, 3] training_data = pd.DataFrame({ 'user_tz': user_tz, 'l1_time': l1_time, 'l1_day': l1_day, 'l2_time': l2_time, 'l2_day': l2_day, 'l3_time': l3_time, 'l3_day': l3_day, 'schedule_type': schedule_type }) business_forecast = [{'schedule_type': 2, 'user_tz': 'Eastern (US & Canada)', 'frequency': 1 }, {'schedule_type': 3, 'user_tz': 'Pacific (US & Canada)', 'frequency': 2 }] model = GeneralProbModel() model.fit(training_data) p = model.predict(business_forecast) expect(True).to.equal(True)
def handles_predicting_cases_it_has_not_seen_before(self): user_tz = ['Eastern (US & Canada)', 'Pacific (US & Canada)'] l1_time = [9, 9] l1_day = [0, 1] l2_time = [9, 9] l2_day = [3, 4] l3_time = [None, 9] l3_day = [None, 5] schedule_type = [2, 3] training_data = pd.DataFrame({ 'user_tz': user_tz, 'l1_time': l1_time, 'l1_day': l1_day, 'l2_time': l2_time, 'l2_day': l2_day, 'l3_time': l3_time, 'l3_day': l3_day, 'schedule_type': schedule_type }) business_forecast = [{ 'schedule_type': 1, 'user_tz': 'Eastern (US & Canada)', 'frequency': 1 }, { 'schedule_type': 4, 'user_tz': 'Pacific (US & Canada)', 'frequency': 2 }] model = GeneralProbModel() model.fit(training_data) p = model.predict(business_forecast) expect(True).to.equal(True)
def should_take_into_account_conditional_probability(self): user_tz = ['Eastern (US & Canada)', 'Pacific (US & Canada)'] l1_time = [9, 9] l1_day = [0, 1] l2_time = [9, 9] l2_day = [3, 4] l3_time = [None, 9] l3_day = [None, 5] schedule_type = [2, 3] training_data = pd.DataFrame({ 'user_tz': user_tz, 'l1_time': l1_time, 'l1_day': l1_day, 'l2_time': l2_time, 'l2_day': l2_day, 'l3_time': l3_time, 'l3_day': l3_day, 'schedule_type': schedule_type }) business_forecast = [{ 'schedule_type': 2, 'user_tz': 'Eastern (US & Canada)', 'frequency': 1 }, { 'schedule_type': 3, 'user_tz': 'Pacific (US & Canada)', 'frequency': 2 }] model = GeneralProbModel() model.fit(training_data) p = model.predict(business_forecast) expect(True).to.equal(True)