예제 #1
0
            // all possible combinations of two users
            $u1 = get_user_shown_name($uid);
            $u2 = get_user_shown_name($uid2);
            // print "$u1 $u2\n";
            $complex_groups1 = array_map('simplify', get_complex_groups_by_simple($simple_groups, $uid));
            $complex_groups2 = array_map('simplify', get_complex_groups_by_simple($simple_groups, $uid2));
            if (count($complex_groups1) === 0 or count($complex_groups2) === 0) {
                continue;
            }
            // print count($complex_groups1)." ".count($complex_groups2)." ".intersect($complex_groups1, $complex_groups2).PHP_EOL;
            // print count($groups_user1)." ".count($groups_user2)." ".intersect($groups_user1, $groups_user2).PHP_EOL;
            $matrix = array();
            $matrix['NONE']['NONE'] = 0;
            foreach ($COMPLEX_TYPES as $id1) {
                foreach ($COMPLEX_TYPES as $id2) {
                    $matrix[$id1][$id2] = count_matching_groups($complex_groups1, $complex_groups2, $id1, $id2);
                }
                $matrix[$id1]['NONE'] = count_matching_nones1($complex_groups1, $complex_groups2, $id1);
                $matrix['NONE'][$id1] = count_matching_nones1($complex_groups2, $complex_groups1, $id1);
            }
            $k = kappa_pairwise(array_merge($COMPLEX_TYPES, array('NONE')), $matrix, TRUE);
            $matrixes[$k['kappa']] = $matrix;
            $kappas[] = array_merge($k, array('user1' => $u1, 'user2' => $u2, 'book_id' => $book['id'], 'book_title' => $book['name'], 'u1count' => count($complex_groups1), 'u2count' => count($complex_groups2), 'with_m' => $u1 === $mod or $u2 === $mod, 'intersect' => intersect($complex_groups1, $complex_groups2)));
            // print PHP_EOL;
        }
    }
}
print "<h1>Cohen's kappa, complex groups</h1>";
print "<h2>All annotators and moderator</h2>";
foreach ($USERS as $user1) {
    $user1 = get_user_shown_name($user1);
예제 #2
0
        continue;
    }
    foreach (array_keys($users) as $index => $uid) {
        foreach (array_slice(array_keys($users), $index + 1) as $uid2) {
            // all possible combinations of two users
            $u1 = get_user_shown_name($uid);
            $u2 = get_user_shown_name($uid2);
            // print "$u1 $u2\n";
            $groups_user1 = filter_groups($simple_groups, $uid, $SIMPLE_TYPES);
            $groups_user2 = filter_groups($simple_groups, $uid2, $SIMPLE_TYPES);
            // print count($groups_user1)." ".count($groups_user2)." ".intersect($groups_user1, $groups_user2).PHP_EOL;
            $matrix = array();
            $matrix['NONE']['NONE'] = 0;
            foreach ($SIMPLE_TYPES as $id1) {
                foreach ($SIMPLE_TYPES as $id2) {
                    $matrix[$id1][$id2] = count_matching_groups($groups_user1, $groups_user2, $id1, $id2);
                }
                $matrix[$id1]['NONE'] = count_matching_nones1($groups_user1, $groups_user2, $id1);
                $matrix['NONE'][$id1] = count_matching_nones1($groups_user2, $groups_user1, $id1);
            }
            $k = kappa_pairwise(array_merge($SIMPLE_TYPES, array('NONE')), $matrix, TRUE);
            $matrixes[$k['kappa']] = $matrix;
            $kappas[] = array_merge($k, array('user1' => $u1, 'user2' => $u2, 'book_id' => $book['id'], 'book_title' => $book['name'], 'u1count' => count($groups_user1), 'u2count' => count($groups_user2), 'with_m' => $u1 === $mod or $u2 === $mod, 'intersect' => intersect($groups_user1, $groups_user2)));
        }
    }
}
print "<h1>Cohen's kappa, simple groups</h1>";
print "<h2>All annotators and moderator</h2>";
foreach ($USERS as $user1) {
    $user1 = get_user_shown_name($user1);
    print "{$user1} with mod <br />";