pcs-annotator 0.1.17__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/PKG-INFO +1 -1
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/PCS.py +0 -65
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pyproject.toml +1 -1
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/LICENSE +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/README.md +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/Annotator.py +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/LLM.py +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/TextMutator.py +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/Tools.py +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/pcs_annotator/__init__.py +0 -0
- {pcs_annotator-0.1.17 → pcs_annotator-0.2.0}/requirements.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pcs-annotator
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A Python library for classification tasks using multiple LLMs
|
|
5
5
|
Project-URL: Homepage, https://github.com/salsina/PCS-Python-Library
|
|
6
6
|
Project-URL: Issues, https://github.com/salsina/PCS-Python-Library/issues
|
|
@@ -109,72 +109,7 @@ class PCS:
|
|
|
109
109
|
|
|
110
110
|
pbar.update(1) # Update progress bar
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
def get_majority_vote_label(self, majority_votes, possible_labels=None):
|
|
114
|
-
if not possible_labels:
|
|
115
|
-
possible_labels = self.possible_labels
|
|
116
|
-
|
|
117
|
-
vote_counts = {label.strip().lower(): 0 for label in possible_labels}
|
|
118
|
-
|
|
119
|
-
for vote in majority_votes:
|
|
120
|
-
if not pd.isna(vote):
|
|
121
|
-
lowered_vote = vote.strip().lower()
|
|
122
|
-
if lowered_vote in vote_counts:
|
|
123
|
-
vote_counts[lowered_vote] += 1
|
|
124
112
|
|
|
125
|
-
max_votes = max(vote_counts.values())
|
|
126
|
-
|
|
127
|
-
for label, count in vote_counts.items():
|
|
128
|
-
if count == max_votes:
|
|
129
|
-
return label
|
|
130
|
-
|
|
131
|
-
# def get_pcs_label(self, llm_labels, w_llms=None, w_mrs=None, label_thresholds=None, possible_labels=None):
|
|
132
|
-
# if possible_labels is None:
|
|
133
|
-
# possible_labels = self.possible_labels
|
|
134
|
-
# if w_llms is None:
|
|
135
|
-
# w_llms = self.optimal_llm_weights
|
|
136
|
-
# if w_mrs is None:
|
|
137
|
-
# w_mrs = self.optimal_mr_weights
|
|
138
|
-
# if label_thresholds is None:
|
|
139
|
-
# label_thresholds = self.optimal_label_thresholds
|
|
140
|
-
|
|
141
|
-
# num_labels = len(possible_labels)
|
|
142
|
-
# pcs_labels = [0] * num_labels
|
|
143
|
-
|
|
144
|
-
# for i in range(len(w_llms)):
|
|
145
|
-
# pcs_label_llm = [0] * num_labels
|
|
146
|
-
# for j in range(len(llm_labels[i])): #Iterate through MR labels
|
|
147
|
-
# for k in range(len(pcs_label_llm)):
|
|
148
|
-
# if not pd.isna(llm_labels[i][j]):
|
|
149
|
-
# if llm_labels[i][j].strip().lower() == possible_labels[k].strip().lower():
|
|
150
|
-
# pcs_label_llm[k] += w_mrs[j]
|
|
151
|
-
|
|
152
|
-
# for j in range(len(pcs_label_llm)):
|
|
153
|
-
# # pcs_label_llm[j] = pcs_label_llm[j]/sum(w_mrs)
|
|
154
|
-
# if sum(w_mrs) != 0:
|
|
155
|
-
# pcs_label_llm[j] = pcs_label_llm[j] / sum(w_mrs)
|
|
156
|
-
# else:
|
|
157
|
-
# pcs_label_llm[j] = 0
|
|
158
|
-
|
|
159
|
-
# for j in range(len(pcs_label_llm)):
|
|
160
|
-
# pcs_labels[j] += w_llms[i] * pcs_label_llm[j]
|
|
161
|
-
|
|
162
|
-
# for i in range(num_labels):
|
|
163
|
-
# if sum(w_llms) != 0:
|
|
164
|
-
# pcs_labels[i] = pcs_labels[i]/sum(w_llms)
|
|
165
|
-
# else:
|
|
166
|
-
# pcs_labels[i] = 0
|
|
167
|
-
|
|
168
|
-
# for i in range(num_labels):
|
|
169
|
-
# if pcs_labels[i] > label_thresholds[i]:
|
|
170
|
-
# final_pred = possible_labels[i]
|
|
171
|
-
# return final_pred
|
|
172
|
-
|
|
173
|
-
# majority_votes = []
|
|
174
|
-
# for i in range(len(w_llms)):
|
|
175
|
-
# majority_votes.append(llm_labels[i][0])
|
|
176
|
-
|
|
177
|
-
# return self.get_majority_vote_label(majority_votes, possible_labels)
|
|
178
113
|
|
|
179
114
|
def get_pcs_label(self, llm_labels, w_llms=None, w_mrs=None, possible_labels=None):
|
|
180
115
|
if possible_labels is None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|