pcs-annotator 0.1.5__tar.gz → 0.1.7__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.5 → pcs_annotator-0.1.7}/PKG-INFO +1 -1
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/LLM.py +1 -1
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/PCS.py +12 -30
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pyproject.toml +1 -1
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/LICENSE +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/README.md +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/Annotator.py +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/TextMutator.py +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/Tools.py +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/pcs_annotator/__init__.py +0 -0
- {pcs_annotator-0.1.5 → pcs_annotator-0.1.7}/requirements.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pcs-annotator
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
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
|
|
@@ -187,44 +187,26 @@ class PCS:
|
|
|
187
187
|
num_labels = len(possible_labels)
|
|
188
188
|
pcs_labels = np.zeros(num_labels)
|
|
189
189
|
|
|
190
|
+
print(llm_labels)
|
|
190
191
|
for i in range(len(w_llms)):
|
|
191
|
-
# Step 1: Rank MRs based on their weights
|
|
192
|
-
mrs_indices = np.argsort(w_mrs)[::-1] # Sort in descending order
|
|
193
|
-
|
|
194
|
-
# Get the labels from each MR for this LLM
|
|
195
|
-
mr_predictions = [llm_labels[i][j].strip().lower() for j in range(len(w_mrs))]
|
|
196
|
-
|
|
197
|
-
# Reorder predictions by MR weight
|
|
198
|
-
ranked_predictions = [mr_predictions[j] for j in mrs_indices]
|
|
199
|
-
|
|
200
|
-
# Step 2-4: Implement the voting logic for 4 MRs
|
|
201
|
-
selected_label = None
|
|
202
|
-
|
|
203
|
-
# Check if top two MRs choose the same label
|
|
204
|
-
if ranked_predictions[0] == ranked_predictions[1]:
|
|
205
|
-
selected_label = ranked_predictions[0]
|
|
206
|
-
# Check if the other two MRs (3rd and 4th) choose the same label
|
|
207
|
-
elif ranked_predictions[2] == ranked_predictions[3]:
|
|
208
|
-
selected_label = ranked_predictions[2]
|
|
209
|
-
else:
|
|
210
|
-
# Default to first (highest weighted) MR's label
|
|
211
|
-
selected_label = ranked_predictions[0]
|
|
212
|
-
|
|
213
|
-
# Convert the selected label to one-hot encoding
|
|
214
192
|
pcs_label_llm = np.zeros(num_labels)
|
|
215
|
-
|
|
216
|
-
for k in range(
|
|
217
|
-
if
|
|
218
|
-
|
|
219
|
-
|
|
193
|
+
for j in range(len(llm_labels[i])): #Iterate through MR labels
|
|
194
|
+
for k in range(len(pcs_label_llm)):
|
|
195
|
+
if llm_labels[i][j]:
|
|
196
|
+
if llm_labels[i][j].strip().lower() == possible_labels[k].strip().lower():
|
|
197
|
+
pcs_label_llm[k] += w_mrs[j]
|
|
198
|
+
|
|
199
|
+
# Normalize by sum of MR weights
|
|
200
|
+
if sum(w_mrs) != 0:
|
|
201
|
+
pcs_label_llm = pcs_label_llm / sum(w_mrs)
|
|
220
202
|
|
|
221
203
|
# Weight by LLM weights and accumulate
|
|
222
204
|
pcs_labels += w_llms[i] * pcs_label_llm
|
|
223
|
-
|
|
205
|
+
|
|
224
206
|
# Normalize by sum of LLM weights
|
|
225
207
|
if sum(w_llms) != 0:
|
|
226
208
|
pcs_labels = pcs_labels / sum(w_llms)
|
|
227
|
-
|
|
209
|
+
|
|
228
210
|
return pcs_labels
|
|
229
211
|
|
|
230
212
|
def Objective(self, params, llm_preds, NUM_LLMS, NUM_MRS, manual_labels):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|