Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix#317 #484

Merged
merged 29 commits into from Jun 18, 2018
Merged

Fix#317 #484

merged 29 commits into from Jun 18, 2018

Conversation

ahn1340
Copy link
Contributor

@ahn1340 ahn1340 commented May 28, 2018

Fixes #317.

@ahn1340 ahn1340 closed this May 28, 2018
@ahn1340 ahn1340 reopened this May 28, 2018
@codecov-io
Copy link

codecov-io commented May 28, 2018

Codecov Report

Merging #484 into development will decrease coverage by 0.07%.
The diff coverage is 87.5%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #484      +/-   ##
===============================================
- Coverage        78.63%   78.56%   -0.08%     
===============================================
  Files              130      130              
  Lines            10098    10110      +12     
===============================================
+ Hits              7941     7943       +2     
- Misses            2157     2167      +10
Impacted Files Coverage Δ
autosklearn/estimators.py 90.21% <ø> (ø) ⬆️
autosklearn/automl.py 81.11% <100%> (-0.44%) ⬇️
autosklearn/util/backend.py 79.12% <86.95%> (-0.03%) ⬇️
..._preprocessing/select_percentile_classification.py 86.2% <0%> (-3.45%) ⬇️
...e/components/feature_preprocessing/select_rates.py 83.07% <0%> (-3.08%) ⬇️
...ine/components/feature_preprocessing/kernel_pca.py 94.73% <0%> (-1.76%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 61a1cd3...e9c833a. Read the comment docs.

@ahn1340 ahn1340 changed the title [WIP] Fix#317 Fix#317 Jun 11, 2018
@ahn1340 ahn1340 changed the title Fix#317 [WIP]Fix#317 Jun 12, 2018
@ahn1340 ahn1340 changed the title [WIP]Fix#317 Fix#317 Jun 12, 2018
# Check that the names of tmp_dir and output_dir is not the same.
if temporary_directory == output_directory \
and temporary_directory is not None:
raise ValueError("The names of tmp dir and output dir "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please change this to The temporary and the output directory must be different?

# attributes to check that directories were created by autosklearn.
self._tmp_dir_created = False
self._output_dir_created = False
self._prepare_directories(temporary_directory, output_directory)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a line break between the variables and the function calls to make it visually easier to see the difference?

self._logger = logging.get_logger(__name__)
self.create_directories()

@property
def output_directory(self):
return self.__output_directory
# make sure that tilde does not appear on the path.
return os.path.expanduser(self.__output_directory)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add os.path.expandvars.


@property
def temporary_directory(self):
return self.__temporary_directory
# make sure that tilde does not appear on the path.
return os.path.expanduser(self.__temporary_directory)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here as well.


def __del__(self):
self.delete_directories(force=False)

def delete_directories(self, force=True):
if self.delete_output_folder_after_terminate or force:
if self._output_dir_created is False and self.shared_mode is False:
raise OSError("Failed to delete output dir: %s "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not raise OSError here as this is not raised by the operating system. ValueError should be fine.

@@ -86,6 +121,12 @@ def delete_directories(self, force=True):
self.output_directory)

if self.delete_tmp_folder_after_terminate or force:
if self._tmp_dir_created is False and self.shared_mode is False:
raise OSError("Failed to delete tmp dir: % s "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

os.makedirs(output)
except OSError:
pass
# This part is no longer necessary as the directory creating
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please delete these lines.

@@ -43,8 +43,11 @@ def setUp(self):
self.automl._delete_output_directories = lambda: 0

def test_refit_shuffle_on_fail(self):
output = os.path.join(self.test_dir, '..', '.tmp_refit_shuffle_on_fail')
context = BackendContext(output, output, False, False)
tmp = os.path.join(self.test_dir, '..', '.tmp._refit_shuffle_on_fail')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please create a helper function for these lines, which returns a backend object?

@@ -110,6 +116,7 @@ def test_fit(self):
self.assertEqual(automl._task, MULTICLASS_CLASSIFICATION)

del automl
self._tearDown(tmp)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and also a teardown helper function which accepts the backend as input?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants