-
Notifications
You must be signed in to change notification settings - Fork 1
/
score_thread.h
51 lines (42 loc) · 1.43 KB
/
score_thread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Reads user_groups from a queue, computes the CC, clustering, and
controversy scores, and writes them out to a file. Also writes the
controversy, edit fraction, and clustering score for each page in
the group's local edit graph to a separate file. */
#ifndef __score_thread_h__
#define __score_thread_h__
#include <stdio.h>
#include <stdint.h>
struct queue;
struct mmap_item;
struct mmap_feature;
struct user_group {
int num_users;
int64_t *userids;
};
struct thread_info {
const char *mmap_pages;
const struct mmap_item *pages;
int num_pages;
const char *mmap_users;
const struct mmap_item *users;
int num_users;
const struct mmap_feature *controversy;
int num_controversy;
struct queue *input_queue;
char cc_output_file[100];
char c_output_file[100];
};
/* Determines which type of similarity function to use:
cosine similarity or Jensen-Shannon divergence */
#define SIM_FUNC cosine_similarity
double JSD(const char *pages_mfile,
const struct mmap_item *first_page,
const struct mmap_item *second_page);
double cosine_similarity(const char *pages_mfile,
const struct mmap_item *first_page,
const struct mmap_item *second_page);
/* Compute CC, controversy, and clustering scores for the items drawn
from thread_info->input_queue, writing them to the files specified
in thread_info. */
void* generate_scores(void *thread_info);
#endif