Пример #1
0
    def test_cohen_kappa_very_similar_obs_interval_state_3s(self):

        pj = json.loads(open("files/test.boris").read())

        ethogram = pj[ETHOGRAM]
        selected_observations = ["observation #2", "observation #2 (copy)"]
        selected_subjects = ["No focal subject", "subject1", "subject2"]

        r, s, db = cursor = db_functions.load_aggregated_events_in_db(
            pj, selected_subjects, selected_observations, ["s"])

        cursor = db.cursor()
        K, _ = irr.cohen_kappa(cursor,
                               obsid1=selected_observations[0],
                               obsid2=selected_observations[1],
                               interval=decimal.Decimal("3"),
                               selected_subjects=selected_subjects,
                               include_modifiers=False)

        assert K == 1
Пример #2
0
    def test_cohen_kappa_same_observation(self):

        pj = json.loads(open("files/test.boris").read())

        ethogram = pj[ETHOGRAM]
        selected_observations = ["observation #1", "observation #1"]
        selected_subjects = ["subject1", "subject2"]

        r, s, db = cursor = db_functions.load_aggregated_events_in_db(
            pj, selected_subjects, selected_observations, ["s", "p"])
        assert r == True

        cursor = db.cursor()
        K, msg = irr.cohen_kappa(cursor,
                                 obsid1=selected_observations[0],
                                 obsid2=selected_observations[1],
                                 interval=decimal.Decimal("1.0"),
                                 selected_subjects=selected_subjects,
                                 include_modifiers=False)

        assert K == 1
Пример #3
0
        if not ok:
            print(cleanhtml(msg))
            sys.exit()

        cursor = db_connector.cursor()

        interval = 1
        if len(args.command) > 1:
            interval = utilities.float2decimal(args.command[1])

        include_modifiers = True
        if len(args.command) > 2:
            include_modifiers = "TRUE" in args.command[2].upper()

        K, out = irr.cohen_kappa(cursor, observations_id_list[0],
                                 observations_id_list[1], interval, subjects,
                                 include_modifiers)

        print(("Cohen's Kappa - Index of Inter-Rater Reliability\n\n"
               "Interval time: {interval:.3f} s\n").format(interval=interval))

        print(out)
        sys.exit()

    if "subtitles" in args.command:

        if not observations_id_list:
            print(
                "No observation selected. Command applied on all observations found in project\n"
            )
            observations_id_list = all_observations(pj)