Utilities
Helper routines for aggregation.
add_skills_to_data(data, skills, on_missing_skill, default_skill)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
skills
|
Series
|
workers' skills. A pandas.Series index by workers and holding corresponding worker's skill |
required |
on_missing_skill
|
str
|
How to handle assignments done by workers with unknown skill. Possible values: * "error" — raise an exception if there is at least one assignment done by user with unknown skill; * "ignore" — drop assignments with unknown skill values during prediction. Raise an exception if there is no assignments with known skill for any task; * value — default value will be used if skill is missing. |
required |
Source code in crowdkit/aggregation/utils.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
|
clone_aggregator(aggregator)
Construct a new unfitted aggregator with the same parameters. Args: aggregator (BaseClassificationAggregator): aggregator instance to be cloned
Returns:
Name | Type | Description |
---|---|---|
BaseClassificationAggregator |
BaseClassificationAggregator
|
cloned aggregator's instance. Its params are same to input, except for the results of previous fit (private attributes). |
Source code in crowdkit/aggregation/utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
get_accuracy(data, true_labels, by=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataFrame
|
Workers' labeling results.
A pandas.DataFrame containing |
required |
true_labels
|
Series
|
Tasks' ground truth labels.
A pandas.Series indexed by |
required |
Returns:
Name | Type | Description |
---|---|---|
Series |
Series[Any]
|
workers' skills. A pandas.Series index by workers and holding corresponding worker's skill |
Source code in crowdkit/aggregation/utils.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
get_most_probable_labels(proba)
Returns most probable labels
Parameters:
Name | Type | Description | Default |
---|---|---|---|
proba
|
DataFrame
|
Tasks' label probability distributions.
A pandas.DataFrame indexed by |
required |
Source code in crowdkit/aggregation/utils.py
86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
manage_data(data, weights=None, skills=None)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataFrame
|
Workers' labeling results.
A pandas.DataFrame containing |
required |
skills
|
Series
|
workers' skills. A pandas.Series index by workers and holding corresponding worker's skill |
None
|
Source code in crowdkit/aggregation/utils.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
named_series_attrib(name)
Attrs attribute with converter and setter which preserves specified attribute name
Source code in crowdkit/aggregation/utils.py
187 188 189 190 191 192 193 194 |
|
normalize_rows(scores)
Scales values so that every raw sums to 1
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scores
|
DataFrame
|
Tasks' label scores.
A pandas.DataFrame indexed by |
required |
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
Tasks' label probability distributions.
A pandas.DataFrame indexed by |
Source code in crowdkit/aggregation/utils.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|