xlin 0.1.33__tar.gz → 0.1.34__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.33 → xlin-0.1.34}/PKG-INFO +1 -1
- {xlin-0.1.33 → xlin-0.1.34}/pyproject.toml +1 -1
- {xlin-0.1.33 → xlin-0.1.34}/xlin/statistic.py +8 -5
- {xlin-0.1.33 → xlin-0.1.34}/LICENSE +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/README.md +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/__init__.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/ischinese.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/jsonl.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/metric.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/multiprocess_mapping.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/read_as_dataframe.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/timing.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/util.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/xls2xlsx.py +0 -0
- {xlin-0.1.33 → xlin-0.1.34}/xlin/yaml.py +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import List
|
1
|
+
from typing import List, Optional
|
2
2
|
from collections import defaultdict
|
3
3
|
|
4
4
|
import pandas as pd
|
@@ -47,7 +47,7 @@ def statistic_token_length(df: pd.DataFrame, model_path: str, row_to_prompt: lam
|
|
47
47
|
return lengths
|
48
48
|
|
49
49
|
|
50
|
-
def draw_histogram(data: list[int], bins=30, title="Data Distribution Analysis"):
|
50
|
+
def draw_histogram(data: list[int], bins=30, title="Data Distribution Analysis", fig_save_path: Optional[str]=None):
|
51
51
|
import numpy as np
|
52
52
|
import matplotlib.pyplot as plt
|
53
53
|
from scipy.stats import gaussian_kde
|
@@ -109,10 +109,11 @@ Kurtosis: {float((data - mean).mean()**4 / std**4):.4f}\
|
|
109
109
|
# 显示图形
|
110
110
|
plt.tight_layout()
|
111
111
|
plt.show()
|
112
|
+
if fig_save_path is not None:
|
113
|
+
plt.savefig(fig_save_path, dpi=300)
|
112
114
|
|
113
115
|
|
114
|
-
|
115
|
-
def draw_preds_labels(preds: list[str], labels: list[str]):
|
116
|
+
def draw_preds_labels(preds: list[str], labels: list[str], title="Pred and Label Class Distribution", fig_save_path: Optional[str]=None):
|
116
117
|
from collections import Counter
|
117
118
|
import matplotlib.pyplot as plt
|
118
119
|
|
@@ -155,10 +156,12 @@ def draw_preds_labels(preds: list[str], labels: list[str]):
|
|
155
156
|
plt.subplot(2, 2, 4)
|
156
157
|
plt.pie(label_values, labels=label_labels, autopct="%1.1f%%")
|
157
158
|
plt.title("label class distribution")
|
158
|
-
plt.suptitle(
|
159
|
+
plt.suptitle(title)
|
159
160
|
|
160
161
|
plt.tight_layout()
|
161
162
|
plt.show()
|
163
|
+
if fig_save_path is not None:
|
164
|
+
plt.savefig(fig_save_path, dpi=300)
|
162
165
|
|
163
166
|
|
164
167
|
def generate_classification_report(predictions: List[str], labels: List[str]) -> dict:
|
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
|