Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	ersilia/core/tracking.py
  • Loading branch information
AC-Dap committed Oct 17, 2023
2 parents 5514b7c + 552e615 commit 60bd4c6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ersilia/core/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def track(self, input, result, meta):
time = datetime.now() - self.time_start
print("Time taken:", time)

# checking for mismatched types
nan_count = result_dataframe.isna().sum()
print("\nNAN Count:\n", nan_count)

self.check_types(result_dataframe, meta["metadata"])

self.stats(result)

self.get_file_sizes(input_dataframe, result_dataframe)
Expand All @@ -88,3 +94,23 @@ def read_json(self, result):
data = json.load(result)
self.log_to_console(result)
return data

def check_types(self, resultDf, metadata):
typeDict = {"float64": "Float", "int64": "Int"}
count = 0

# ignore key and input columns
dtypesLst = resultDf.loc[:, ~resultDf.columns.isin(["key", "input"])].dtypes

for i in dtypesLst:
if typeDict[str(i)] != metadata["Output Type"][0]:
count += 1

if len(dtypesLst) > 1 and metadata["Output Shape"] != "List":
print("Not right shape. Expected List but got Single")
elif len(dtypesLst) == 1 and metadata["Output Shape"] != "Single":
print("Not right shape. Expected Single but got List")
else:
print("Output is correct shape.")

print("Output has", count, "mismatched types.\n")

0 comments on commit 60bd4c6

Please sign in to comment.