Skip to content

Commit

Permalink
Fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
h-0-0 committed Oct 5, 2023
1 parent eac393d commit 7aa9d28
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ So early I haven't even written the docs yet! Will be adding a quick example her

## Coming soon
Currently very much in early stages, first things still to do:
- Get Searcher to check which tunings have been done and which haven't and only submit the ones that haven't been done yet. Depending on a flag, ie. if you want to re-run a tuning you can set a flag to re-run all tunings.
- What happens if multiple results files? reading from them and not rerunning jobs already done.

- Refine package structure and sort out github actions like test coverage, running tests etc.
- Get Searcher to check which tunings have been done and which haven't and only submit the ones that haven't been done yet. Depending on a flag, ie. if you want to re-run a tuning you can set a flag to re-run all tunings.
- Add more tests and documentation.
- Auto sbatch job naming and job output naming.
- Auto save when finished a tuning run.
Expand All @@ -25,6 +27,7 @@ To install latest dev version use:
```bash
# With https
pip install "git+https://github.com/h-aze/slune.git#egg=slune-lib"
# TODO: don't think this is working, need to put working version of this
# or with SSH
pip install "git+ssh://@github.com:h-aze/slune.git#egg=slune-lib"
```
5 changes: 4 additions & 1 deletion slune/savers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_path(self, params: List[str]):
csv_file_path = os.path.join(dir_path, f'results_{csv_file_number}.csv')
return csv_file_path

def save_collated(self, results: pd.DataFrame):
def save_collated_from_results(self, results: pd.DataFrame):
"""
We add results onto the end of the current results in the csv file if it already exists,
if not then we create a new csv file and save the results there
Expand All @@ -99,6 +99,9 @@ def save_collated(self, results: pd.DataFrame):
# If csv file does not exist, create it
else:
results.to_csv(self.current_path, index=False)

def save_collated(self):
return self.save_collated_from_results(self.logger.results)

def read(self, params: List[str], metric_name: str, min_max: str ='max'):
"""
Expand Down
4 changes: 2 additions & 2 deletions slune/slune.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def single_garg(arg_name):
else:
return single_garg(arg_names)

def get_csv_slog(params, root_directory='.'):
return SaverCsv(LoggerDefault(), params, root_directory=root_directory)
def get_csv_slog(params, root_dir='.'):
return SaverCsv(LoggerDefault(), params, root_dir=root_dir)

# TODO: add functions for reading results
6 changes: 3 additions & 3 deletions tests/test_savers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_save_collated(self):
# Create a data frame with some results
results = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]})
# Save the results
saver.save_collated(results)
saver.save_collated_from_results(results)
# Check if the results were saved correctly
read_results = pd.read_csv(os.path.join(self.test_dir, "--folder1=0.1/--folder2=0.2/--folder3=0.3/results_1.csv"))
self.assertEqual(read_results.shape, (3,2))
Expand All @@ -104,7 +104,7 @@ def test_save_collated(self):
# Create another data frame with more results
results = pd.DataFrame({'a': [7,8,9], 'd': [10,11,12]})
# Save the results
saver.save_collated(results)
saver.save_collated_from_results(results)
# Check if the results were saved correctly
read_results = pd.read_csv(os.path.join(self.test_dir, "--folder1=0.1/--folder2=0.2/--folder3=0.3/results_1.csv"))
results = pd.concat([pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]}), results], ignore_index=True)
Expand All @@ -122,7 +122,7 @@ def test_creates_path_if_no_full_match(self):
# Create a data frame with some results
results = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6]})
# Save the results
saver.save_collated(results)
saver.save_collated_from_results(results)
# Check if the results were saved correctly
read_results = pd.read_csv(os.path.join(self.test_dir, "--folder1=0.01/--folder2=0.02/--folder3=0.03/results_0.csv"))
self.assertEqual(read_results.shape, (3,2))
Expand Down

0 comments on commit 7aa9d28

Please sign in to comment.