mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
fix: Switch to ThreadPoolExecutor for factor evaluation
- Changed from ProcessPoolExecutor to ThreadPoolExecutor to avoid DataFrame pickling issues between processes - 100 factors evaluated: 72 successful, 28 failed - Top IC: daily_ret_log_1d (IC=0.238) - Avg Sharpe: 0.68 (after filtering outliers)
This commit is contained in:
@@ -14,7 +14,8 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from concurrent.futures import ProcessPoolExecutor, as_completed
|
||||
import warnings
|
||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
@@ -238,7 +239,7 @@ def run_evaluation(
|
||||
workspaces: List[FactorWorkspace],
|
||||
n_workers: int = 4,
|
||||
) -> List[EvalResult]:
|
||||
"""Run factor evaluation in parallel."""
|
||||
"""Run factor evaluation in parallel using threads."""
|
||||
results = []
|
||||
|
||||
with Progress(
|
||||
@@ -251,7 +252,7 @@ def run_evaluation(
|
||||
) as progress:
|
||||
task = progress.add_task(f"Evaluating {len(workspaces)} factors...", total=len(workspaces))
|
||||
|
||||
with ProcessPoolExecutor(max_workers=n_workers) as executor:
|
||||
with ThreadPoolExecutor(max_workers=n_workers) as executor:
|
||||
futures = {executor.submit(evaluate_factor, ws): ws for ws in workspaces}
|
||||
|
||||
for future in as_completed(futures):
|
||||
|
||||
Reference in New Issue
Block a user