Skip to content
Snippets Groups Projects
Commit 46060854 authored by Andrei Vasile's avatar Andrei Vasile
Browse files

Updated result saving as per requirements

parent 8900fcaf
No related branches found
No related tags found
No related merge requests found
from pathlib import Path from pathlib import Path
from pandas import read_csv from pandas import read_csv, DataFrame
from autogluon.tabular import TabularDataset, TabularPredictor from autogluon.tabular import TabularDataset, TabularPredictor
from datetime import datetime from datetime import datetime
...@@ -53,9 +53,9 @@ def handlePredict(ds): ...@@ -53,9 +53,9 @@ def handlePredict(ds):
def predict(ds, model): def predict(ds, model):
root = Path(__file__).parent.parent root = Path(__file__).parent.parent
testing = root / "resources" / f"Testing{datasets[ds]}.csv" testing = root / "resources" / "TestingData{}.csv".format("Multi" if ds =='b' else "Binary")
testingData = read_csv(testing, header=None) testingData = read_csv(testing, header=None)
savePath = root / "output" / f"Testing{datasets[ds]}.csv" savePath = root / "output" / "TestingResults{}.csv".format("Multi" if ds =='b' else "Binary")
predictor = TabularPredictor.load(path=model) predictor = TabularPredictor.load(path=model)
...@@ -63,10 +63,12 @@ def predict(ds, model): ...@@ -63,10 +63,12 @@ def predict(ds, model):
testingData[128] = a testingData[128] = a
print(a) print(a)
a = savePath.absolute().as_posix() savePath = savePath.absolute().as_posix()
print(f"Saving to {a}") print(f"Saving to {savePath}")
testingData.to_csv(path_or_buf=a, header=False)
with open(savePath, "w") as f:
for i in a:
f.write(f"{i}\n")
def handleTrain(ds): def handleTrain(ds):
print("Starting training") print("Starting training")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment