xlin 0.1.29__tar.gz → 0.1.30__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.
- {xlin-0.1.29 → xlin-0.1.30}/PKG-INFO +1 -1
- {xlin-0.1.29 → xlin-0.1.30}/pyproject.toml +1 -1
- {xlin-0.1.29 → xlin-0.1.30}/xlin/statistic.py +14 -0
- {xlin-0.1.29 → xlin-0.1.30}/LICENSE +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/README.md +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/__init__.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/ischinese.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/jsonl.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/metric.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/multiprocess_mapping.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/read_as_dataframe.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/timing.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/util.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/xls2xlsx.py +0 -0
- {xlin-0.1.29 → xlin-0.1.30}/xlin/yaml.py +0 -0
@@ -266,6 +266,20 @@ def generate_classification_report(predictions: List[str], labels: List[str]) ->
|
|
266
266
|
return report
|
267
267
|
|
268
268
|
|
269
|
+
def convert_to_jsonable_report(report_row):
|
270
|
+
new_report_json = {}
|
271
|
+
for key, value in report_row.items():
|
272
|
+
if isinstance(value, dict):
|
273
|
+
new_report_json[key] = convert_to_jsonable_report(value)
|
274
|
+
elif isinstance(value, list):
|
275
|
+
new_report_json[key] = [convert_to_jsonable_report(item) if isinstance(item, dict) else item for item in value]
|
276
|
+
elif isinstance(value, pd.DataFrame):
|
277
|
+
new_report_json[key] = value.fillna(-1).to_dict(orient="records")
|
278
|
+
else:
|
279
|
+
new_report_json[key] = value
|
280
|
+
return new_report_json
|
281
|
+
|
282
|
+
|
269
283
|
def print_classification_report(predictions: List[str], labels: List[str]):
|
270
284
|
report = generate_classification_report(predictions, labels)
|
271
285
|
"""
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|