Skip to content

Commit

Permalink
Merge pull request #12 from hcs-t4sg/margo/stats
Browse files Browse the repository at this point in the history
Margo/stats
  • Loading branch information
AC-Dap committed Oct 17, 2023
2 parents 48c4007 + 143c92a commit b390f64
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,6 @@ dmypy.json

# Cython debug symbols
cython_debug/

# Don't commit .csv output files
*.csv
20 changes: 19 additions & 1 deletion ersilia/core/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,27 @@ def __init__(self):
def start_tracking(self):
self.time_start = datetime.now()

def stats(self, result):
dat = self.read_csv(result)

# drop first two columns (key, input)
dat = dat.drop(["key", "input"], axis=1)

# calculate and print statistics
for column in dat:
print("Mean %s: %s" % (column, dat[column].mean()))
if len(dat[column].mode()) == 1:
print("Mode %s: %s" % (column, dat[column].mode()))
else:
print("No mode")
print("Min %s: %s" % (column, dat[column].min()))
print("Max %s: %s" % (column, dat[column].max()))
print("Standard deviation %s: %s" % (column, dat[column].std()))

def track(self, input, result, meta):
"""
Tracks the results after a model run.
"""

print("Run input file:", input)
print(read_csv(input))

Expand All @@ -48,6 +64,8 @@ def track(self, input, result, meta):
time = datetime.now() - self.time_start
print("Time taken:", time)

self.stats(result)

input_dataframe = self.read_csv(input)
result_dataframe = self.read_csv(result)

Expand Down

0 comments on commit b390f64

Please sign in to comment.