Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
swemls-cwk1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Milicic, Karlo
swemls-cwk1
Commits
2d813b16
Commit
2d813b16
authored
1 month ago
by
kmilicic
Browse files
Options
Downloads
Patches
Plain Diff
final
parent
2db64b42
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
model.py
+1
-4
1 addition, 4 deletions
model.py
requirements.txt
+1
-3
1 addition, 3 deletions
requirements.txt
test/test_data.py
+0
-9
0 additions, 9 deletions
test/test_data.py
test/test_model.py
+1
-1
1 addition, 1 deletion
test/test_model.py
with
3 additions
and
17 deletions
model.py
+
1
−
4
View file @
2d813b16
...
...
@@ -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
():
...
...
This diff is collapsed.
Click to expand it.
requirements.txt
+
1
−
3
View file @
2d813b16
-f https://download.pytorch.org/whl/torch_stable.html
numpy
==1.26.4
torch
==2.3.1+cpu
torch
pandas
tqdm
scikit-learn
...
...
This diff is collapsed.
Click to expand it.
test/test_data.py
+
0
−
9
View file @
2d813b16
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
(
{
...
...
This diff is collapsed.
Click to expand it.
test/test_model.py
+
1
−
1
View file @
2d813b16
...
...
@@ -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
l
3 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
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment