Exemplo n.º 1
0
    ce_delta_sum = [1, 1]
    while max(ce_delta_sum) > 0.001 * sources_number * cases_number:
        cef_for_each_s = []
        observed_cases_changed = [] + observed_cases
        for observed_case_index in range(cases_number):
            observed_cases_changed[observed_case_index].update({"life_span": set_of_life_spans[observed_case_index]})
        observed_cases_changed = cook_raw_value(observed_cases_changed)

        time_points = observed_cases_changed[0].get("life_span")[0]
        for s in observed_keys:
            life_span_set = []
            sources_data = []
            time_points = []
            for case in raw_cases:
                sources_data.append(case.get(s))
            cef = get_CEF(life_span_set=set_of_life_spans, sources_data=sources_data)
            cef_measures.update({s: cef})
            cef_for_each_s.append(cef)

        set_of_life_spans = []
        for observed_changed in observed_cases_changed:
            del observed_changed["life_span"]
            life_span = get_life_span(observed=observed_changed, cef_measures=cef_measures)
            set_of_life_spans.append(life_span)

        ce_delta_sum = [0, 0]
        for old, new in zip(cef_for_each_s_old, cef_for_each_s):
            diff_for_s = [abs(x - y) for x, y in zip(old[0:2], new[0:2])]
            for i in range(len(ce_delta_sum)):
                ce_delta_sum[i] += diff_for_s[i]
        cef_for_each_s_old = cef_for_each_s
Exemplo n.º 2
0
        print 'CASE NUMBER: {}'.format(case_number)
        print 'Ground truth: {}'.format(ground_truth)
        for key in observed_keys:
            print '{}: {}'.format(key, observed.get(key)[1])
        print 'Initial life span: {}'.format(life_span)
        life_span_old = []

        cef_for_each_s_old = [cef_measures.get(s) for s in observed_keys]
        ce_delta_sum = [1, 1]
        while max(ce_delta_sum) > 0.01*sources_number:
            cef_for_each_s = []
            observed_changed = observed.copy()
            observed_changed.update({'life_span': life_span})
            observed_changed = cook_raw_value([observed_changed])[0]
            for s in observed_keys:
                cef = get_CEF(life_span=observed_changed.get('life_span'), source_data=observed_changed.get(s))
                cef_measures.update({s: cef})
                cef_for_each_s.append(cef)

            life_span_old = life_span
            life_span = get_life_span(observed=observed, cef_measures=cef_measures)
            iter_quantity += 1

            ce_delta_sum = [0, 0]
            for old, new in zip(cef_for_each_s_old, cef_for_each_s):
                diff_for_s = [abs(x-y) for x, y in zip(old[0:2], new[0:2])]
                for i in range(len(ce_delta_sum)):
                    ce_delta_sum[i] += diff_for_s[i]
            cef_for_each_s_old = cef_for_each_s
            majority_voting_result = majority_voting(observed)
Exemplo n.º 3
0
        print 'CASE NUMBER: {}'.format(case_number)
        print 'Ground truth: {}'.format(ground_truth)
        for key in observed_keys:
            print '{}: {}'.format(key, observed.get(key)[1])
        print 'Initial life span: {}'.format(life_span)
        life_span_old = []

        cef_for_each_s_old = [cef_measures.get(s) for s in observed_keys]
        ce_delta_sum = [1, 1]
        while max(ce_delta_sum) > 0.01 * sources_number:
            cef_for_each_s = []
            observed_changed = observed.copy()
            observed_changed.update({'life_span': life_span})
            observed_changed = cook_raw_value([observed_changed])[0]
            for s in observed_keys:
                cef = get_CEF(life_span=observed_changed.get('life_span'),
                              source_data=observed_changed.get(s))
                cef_measures.update({s: cef})
                cef_for_each_s.append(cef)

            life_span_old = life_span
            life_span = get_life_span(observed=observed,
                                      cef_measures=cef_measures)
            iter_quantity += 1

            ce_delta_sum = [0, 0]
            for old, new in zip(cef_for_each_s_old, cef_for_each_s):
                diff_for_s = [abs(x - y) for x, y in zip(old[0:2], new[0:2])]
                for i in range(len(ce_delta_sum)):
                    ce_delta_sum[i] += diff_for_s[i]
            cef_for_each_s_old = cef_for_each_s
            majority_voting_result = majority_voting(observed)