Skip to content
Snippets Groups Projects
Commit f8a7f08f authored by Michael's avatar Michael
Browse files

Added some comments

parent ce5aa38e
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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)
cleaned_data = [x for x, nan in zip(patientInfo, isNan) if not nan]
Nan_removed_data = [x for x, nan in zip(patientInfo, isNan) if not nan]
#Add patient to the featurs
processed_features.append(processPatientData(cleaned_data))
processed_features.append(processPatientData(Nan_removed_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
......
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