-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_debug.py
More file actions
34 lines (29 loc) · 1.3 KB
/
Copy pathsimple_debug.py
File metadata and controls
34 lines (29 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import numpy as np
from datetime import datetime
from src.models.ml_models import MockRiskModel
from src.models.feature_engineering import PatientFeatures
# Create the exact failing case
patient_features = PatientFeatures(
patient_id='0',
features=np.array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 0., 0., -1.]),
feature_names=[f'feature_{i}' for i in range(20)],
feature_metadata={'completeness_score': 0.5, 'extraction_method': 'test', 'scaling_method': 'standard'},
processing_timestamp=datetime.utcnow(),
data_completeness_score=0.5
)
# Test individual mock model
model = MockRiskModel("test")
model.train(np.random.randn(10, 20), np.random.randint(0, 2, 10), patient_features.feature_names)
prediction = model.predict(patient_features)
print(f"Mock model prediction: risk_score={prediction.risk_score}, risk_probability={prediction.risk_probability}")
# Manual calculation
feature_sum = np.sum(patient_features.features)
print(f"Feature sum: {feature_sum}")
normalized_sum = abs(feature_sum) % 10.0
print(f"Normalized sum: {normalized_sum}")
risk_probability = min(max(normalized_sum / 10.0, 0.0), 1.0)
print(f"Risk probability: {risk_probability}")
risk_score = int(risk_probability * 100)
print(f"Risk score: {risk_score}")