Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Dev 015 (#116)
Browse files Browse the repository at this point in the history
* allow to chain operations i.e. preprocessing_block = preprocessing_steps(cfg=cfg).set_mode_inference().set_parameters_upstream(steps_config)

* allow to chained operations
  • Loading branch information
Kamil A. Kaczmarek authored and jakubczakon committed Oct 18, 2018
1 parent 5f1816d commit 55d4672
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version
version = '0.1'
# The full version, including alpha/beta/rc tags
release = '0.1.14'
release = '0.1.15'


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

setup(name='steppy',
packages=['steppy'],
version='0.1.14',
version='0.1.15',
description='A lightweight, open-source, Python library for fast and reproducible experimentation',
long_description=long_description,
url='https://github.com/minerva-ml/steppy',
download_url='https://github.com/minerva-ml/steppy/archive/0.1.14.tar.gz',
download_url='https://github.com/minerva-ml/steppy/archive/0.1.15.tar.gz',
author='Kamil A. Kaczmarek, Jakub Czakon',
author_email='[email protected], [email protected]',
keywords=['machine-learning', 'reproducibility', 'pipeline', 'data-science'],
Expand Down
6 changes: 6 additions & 0 deletions steppy/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,14 @@ def set_mode_train(self):
and cleans cache for all upstream Steps including this Step.
"""
self._set_mode('train')
return self

def set_mode_inference(self):
"""Applies 'inference' mode to all upstream Steps including this Step
and cleans cache for all upstream Steps including this Step.
"""
self._set_mode('inference')
return self

def reset(self):
"""Reset all upstream Steps to the default training parameters and
Expand All @@ -442,6 +444,7 @@ def reset(self):
step_obj.load_persisted_output = DEFAULT_TRAINING_SETUP['load_persisted_output']
logger.info('Step {}, reset all upstream Steps to default training parameters, '
'including this Step'.format(self.name))
return self

def set_parameters_upstream(self, parameters):
"""Set parameters to all upstream Steps including this Step.
Expand All @@ -455,12 +458,14 @@ def set_parameters_upstream(self, parameters):
if key == 'experiment_directory':
step_obj._prepare_experiment_directories()
logger.info('set new values to all upstream Steps including this Step.')
return self

def clean_cache_step(self):
"""Clean cache for current step.
"""
logger.info('Step {}, cleaning cache'.format(self.name))
self.output = None
return self

def clean_cache_upstream(self):
"""Clean cache for all steps that are upstream to `self`.
Expand All @@ -469,6 +474,7 @@ def clean_cache_upstream(self):
for step in self.all_upstream_steps.values():
logger.info('Step {}, cleaning cache'.format(step.name))
step.output = None
return self

def get_step_by_name(self, name):
"""Extracts step by name from the pipeline.
Expand Down

0 comments on commit 55d4672

Please sign in to comment.