def test_get_depth(es): es = make_ecommerce_entityset() f = Feature(es['log']['value']) g = Feature(es['log']['value']) agg1 = Last(f, es['sessions']) agg2 = Last(agg1, es['customers']) d1 = Feature(agg2, es['sessions']) d2 = Feature(d1, es['log']) assert d2.get_depth() == 4 # Make sure this works if we pass in two of the same # feature. This came up when user supplied duplicates # in the seed_features of DFS. assert d2.get_depth(stop_at=[f, g]) == 4 assert d2.get_depth(stop_at=[f, g, agg1]) == 3 assert d2.get_depth(stop_at=[f, g, agg1]) == 3 assert d2.get_depth(stop_at=[f, g, agg2]) == 2 assert d2.get_depth(stop_at=[f, g, d1]) == 1 assert d2.get_depth(stop_at=[f, g, d2]) == 0
def test_get_depth(es): log_id_feat = es['log']['id'] customer_id_feat = es['customers']['id'] count_logs = Count(log_id_feat, parent_entity=es['sessions']) sum_count_logs = Sum(count_logs, parent_entity=es['customers']) num_logs_greater_than_5 = sum_count_logs > 5 count_customers = Count(customer_id_feat, parent_entity=es[u'régions'], where=num_logs_greater_than_5) num_customers_region = Feature(count_customers, es["customers"]) depth = num_customers_region.get_depth() assert depth == 5
def test_get_depth(es): log_id_feat = es['log']['id'] customer_id_feat = es['customers']['id'] count_logs = Count(log_id_feat, parent_entity=es['sessions']) sum_count_logs = Sum(count_logs, parent_entity=es['customers']) num_logs_greater_than_5 = sum_count_logs > 5 count_customers = Count(customer_id_feat, parent_entity=es['regions'], where=num_logs_greater_than_5) num_customers_region = Feature(count_customers, es["customers"]) depth = num_customers_region.get_depth() assert depth == 5