Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NHS-aki-model
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
Hodgins, Michael
NHS-aki-model
Commits
f8a7f08f
Commit
f8a7f08f
authored
1 month ago
by
Michael
Browse files
Options
Downloads
Patches
Plain Diff
Added some comments
parent
ce5aa38e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
coursework1/aki.csv
+17
-17
17 additions, 17 deletions
coursework1/aki.csv
coursework1/model.py
+8
-7
8 additions, 7 deletions
coursework1/model.py
with
25 additions
and
24 deletions
coursework1/aki.csv
+
17
−
17
View file @
f8a7f08f
...
...
@@ -293,7 +293,7 @@ n
n
n
y
y
n
n
n
n
...
...
@@ -569,7 +569,7 @@ y
y
n
n
y
n
n
n
n
...
...
@@ -822,7 +822,7 @@ n
y
n
n
y
n
n
n
n
...
...
@@ -863,7 +863,7 @@ n
n
n
n
n
y
n
n
n
...
...
@@ -2259,8 +2259,7 @@ n
n
y
n
n
n
y
n
n
n
...
...
@@ -2270,6 +2269,7 @@ n
n
n
y
y
n
y
n
...
...
@@ -2590,7 +2590,7 @@ n
n
n
n
y
n
n
y
n
...
...
@@ -3177,7 +3177,7 @@ n
n
n
y
n
y
n
n
n
...
...
@@ -3938,7 +3938,7 @@ n
y
n
n
y
n
y
n
n
...
...
@@ -3964,7 +3964,7 @@ n
n
y
n
n
y
n
n
n
...
...
@@ -4384,7 +4384,7 @@ n
n
n
y
y
n
n
n
n
...
...
@@ -4487,7 +4487,7 @@ n
y
n
n
y
n
n
n
n
...
...
@@ -4739,7 +4739,7 @@ y
y
n
n
n
y
n
n
n
...
...
@@ -4792,7 +4792,7 @@ n
n
n
n
n
y
y
n
n
...
...
@@ -4977,7 +4977,7 @@ y
y
n
n
y
n
n
n
n
...
...
@@ -5204,7 +5204,7 @@ n
n
n
n
y
n
n
n
y
...
...
@@ -6113,7 +6113,7 @@ n
y
n
n
n
y
y
n
n
...
...
This diff is collapsed.
Click to expand it.
coursework1/model.py
+
8
−
7
View file @
f8a7f08f
...
...
@@ -44,11 +44,11 @@ def preprocessData(data, labelsRow = None):
# Extract features and labels
features
=
data
# Features
train_
labels
=
None
labels
=
None
# If lables are provided
if
(
labelsRow
):
features
=
features
.
drop
(
data
.
columns
[
labelsRow
],
axis
=
1
)
# Features
train_
labels
=
data
.
iloc
[:,
labelsRow
].
values
# Labels
labels
=
data
.
iloc
[:,
labelsRow
].
values
# Labels
processed_features
=
[]
...
...
@@ -56,15 +56,15 @@ def preprocessData(data, labelsRow = None):
for
patientInfo
in
features
.
values
:
# Clip the end of the rows by removing NaN values
isNan
=
pd
.
isna
(
patientInfo
)
clean
ed_data
=
[
x
for
x
,
nan
in
zip
(
patientInfo
,
isNan
)
if
not
nan
]
Nan_remov
ed_data
=
[
x
for
x
,
nan
in
zip
(
patientInfo
,
isNan
)
if
not
nan
]
#Add patient to the featurs
processed_features
.
append
(
processPatientData
(
clean
ed_data
))
processed_features
.
append
(
processPatientData
(
Nan_remov
ed_data
))
# Normalize features
if needed
# Normalize features
scaler
=
StandardScaler
()
processed_features
=
scaler
.
fit_transform
(
processed_features
)
return
processed_features
,
train_
labels
return
processed_features
,
labels
def
train
(
train_features
,
train_labels
):
...
...
@@ -110,6 +110,8 @@ def main():
model
=
train
(
train_features
,
train_labels
)
#Predict and evaluate
#If the test data comes with labels, evaluate
evaluation
=
'
aki
'
in
testData
.
columns
if
evaluation
:
...
...
@@ -124,7 +126,6 @@ def main():
#Evaluate
if
evaluation
:
scores
=
evaluate
(
test_labels
,
test_predicted
)
print
(
"
f3 score:
"
,
scores
)
# Write to files
...
...
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