Skip to content
Snippets Groups Projects
Commit 2d813b16 authored by kmilicic's avatar kmilicic
Browse files

final

parent 2db64b42
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,6 @@ class CreatinineMeasurement(BaseModel):
class PatientData(BaseModel):
age: float = Field(ge=0)
sex: str = Field(pattern="^[mf]$")
aki: str = Field(pattern="^[yn]$")
measurements: List[CreatinineMeasurement]
@field_validator("measurements")
......@@ -66,9 +65,7 @@ def validate_data(df: pd.DataFrame) -> None:
}
)
PatientData(
age=row["age"], sex=row["sex"], aki=row["aki"], measurements=measurements
)
PatientData(age=row["age"], sex=row["sex"], measurements=measurements)
def main():
......
-f https://download.pytorch.org/whl/torch_stable.html
numpy==1.26.4
torch==2.3.1+cpu
torch
pandas
tqdm
scikit-learn
......
from pathlib import Path
import pandas as pd
import pytest
from sklearn.metrics import fbeta_score
import model
......@@ -24,12 +21,6 @@ def test_preprocess_features():
assert result["sex"].dtype == int
def test_validate_data_missing_columns():
test_data = pd.DataFrame({"age": [30, 40], "sex": ["M", "F"]})
with pytest.raises(KeyError):
model.validate_data(test_data)
def test_validate_data_negative_age():
test_data = pd.DataFrame(
{
......
......@@ -10,7 +10,7 @@ import model
def test_net_forward_pass():
net = model.Net()
test_tensor = torch.randn(3, 5) # Batch of 3 samples with 5 features
test_tensor = torch.randn(3, 5) # Batch of l3 samples with 5 features
output = net(test_tensor)
assert output.shape == torch.Size([3]) # Should return 1 prediction per sample
assert (output >= 0).all() and (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment