Spaces:
Running
Running
VladGeekPro Copilot commited on
Commit ·
60421a5
1
Parent(s): fb5dc97
RaisedThresholdLevelTo80
Browse filesCo-authored-by: Copilot <copilot@github.com>
- expense_predictor.py +3 -3
expense_predictor.py
CHANGED
|
@@ -189,9 +189,9 @@ def predict_expenses(expenses: list[dict], target_user_id, debug: bool = False)
|
|
| 189 |
pct = count / total_records * 100
|
| 190 |
print(f"[PREDICT] supplier_id={supplier_id} -> {count} records ({pct:.1f}%)")
|
| 191 |
|
| 192 |
-
# Select suppliers whose frequency is strictly greater than
|
| 193 |
max_freq = max(supplier_freq.values()) if supplier_freq else 0
|
| 194 |
-
freq_threshold = 0.
|
| 195 |
candidate_items = [
|
| 196 |
item for item in supplier_history.items()
|
| 197 |
if supplier_freq[item[0]] > freq_threshold
|
|
@@ -207,7 +207,7 @@ def predict_expenses(expenses: list[dict], target_user_id, debug: bool = False)
|
|
| 207 |
if debug:
|
| 208 |
print(
|
| 209 |
f"[PREDICT] Processing {len(candidate_items)} suppliers "
|
| 210 |
-
f"with freq >
|
| 211 |
)
|
| 212 |
|
| 213 |
if not candidate_items:
|
|
|
|
| 189 |
pct = count / total_records * 100
|
| 190 |
print(f"[PREDICT] supplier_id={supplier_id} -> {count} records ({pct:.1f}%)")
|
| 191 |
|
| 192 |
+
# Select suppliers whose frequency is strictly greater than 80% of the top supplier frequency.
|
| 193 |
max_freq = max(supplier_freq.values()) if supplier_freq else 0
|
| 194 |
+
freq_threshold = 0.8 * max_freq
|
| 195 |
candidate_items = [
|
| 196 |
item for item in supplier_history.items()
|
| 197 |
if supplier_freq[item[0]] > freq_threshold
|
|
|
|
| 207 |
if debug:
|
| 208 |
print(
|
| 209 |
f"[PREDICT] Processing {len(candidate_items)} suppliers "
|
| 210 |
+
f"with freq > 80% of max ({freq_threshold:.2f})"
|
| 211 |
)
|
| 212 |
|
| 213 |
if not candidate_items:
|