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

Dev docstrings #33

Merged
merged 17 commits into from
May 17, 2018
Merged

Dev docstrings #33

merged 17 commits into from
May 17, 2018

Conversation

jakubczakon
Copy link
Collaborator

No description provided.

@kamil-kaczmarek kamil-kaczmarek self-assigned this May 7, 2018
@kamil-kaczmarek kamil-kaczmarek added this to the Steps as Python package milestone May 7, 2018
@kamil-kaczmarek kamil-kaczmarek self-requested a review May 7, 2018 11:48
Copy link

@grzes314 grzes314 left a comment

Choose a reason for hiding this comment

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

Most of my remarks are minor. Some of them follow from dynamic changes in the code. The comments will require rereading anyway once we have a mature version of the library.

@@ -3,51 +3,157 @@

Choose a reason for hiding this comment

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

Since adapter syntax won't allow passing a function any more, purpose of functions in this module should be reconsidered. But for the time being I would leave them as they are.

step_3 = Step(name='step_3',
input_steps=[step_1, step_2],
input_data=['input_2'],
adapter = {'X':([('step_1','X_transformed'),

Choose a reason for hiding this comment

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

Old adapter syntax.

But for now you can leave it as it is. Step API is probably going to change quite a few times before we get a "mature" version. Let's not waste too much time on polishing comments for each temporary version.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed

Args:
name (int): Step name. Each step in a pipeline needs to have a unique name.
Transformers, and Step outputs will be persisted/cached/saved under this exact name.
transformer (obj): Step instance or object that inherits from BaseTransformer.

Choose a reason for hiding this comment

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

transformer (BaseTransformer)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@grzes314 it is either BaseTransformer or Step how would you handle that?

Choose a reason for hiding this comment

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

Do we really have a usecase when we would like to put a Step here instead of Transformer? Anyway, if we incorporate Michal's recent proposition, Step and Transformer will be unified, so let's forget it.

steps/base.py Outdated
self.fit(*args, **kwargs)
return self.transform(*args, **kwargs)

def load(self, filepath):
"""Saves the trainable parameters of the transformer

Choose a reason for hiding this comment

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

Loads

steps/base.py Outdated
kwargs: keyword arguments (can be anything)

Returns:
obj: BaseTransformer instance

Choose a reason for hiding this comment

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

Returns:
    BaseTransformer: self object

steps/utils.py Outdated
It creates logger of name 'steps'

Returns:
obj: logging.Logger object

Choose a reason for hiding this comment

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

Returns:
    logging.Logger: logger object

steps/base.py Outdated
Args:
name (str): name of the step to be fetched
Returns:
obj: Step instance

Choose a reason for hiding this comment

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

Returns:
    Step: extracted step

steps/utils.py Outdated

Returns:
obj: logging.Logger object of name 'steps'

Choose a reason for hiding this comment

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

Returns:
    logging.Logger: logger object

steps/base.py Outdated
kwargs: keyword arguments (can be anything)

Returns:
obj: BaseTransformer instance

Choose a reason for hiding this comment

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

it returns a dictionary with results, not a BaseTransformer instance

transformer (obj): Step instance or object that inherits from BaseTransformer.
When Step instance is passed transformer from that Step will be copied and used to perform transformations.
It is useful when both train and valid data are passed in one pipeline (common situation in deep learnining).
input_steps (list): list of Step instances default []. Current step will combine outputs from input_steps and input_data

Choose a reason for hiding this comment

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

I changed the default to None on one of the branches

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@grzes314 can I change it to None leaving everything else as is ?

Choose a reason for hiding this comment

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

On second thought, it might be cleaner to change such things after merge. Current comment is consistent with code on this branch.

Copy link
Member

@kamil-kaczmarek kamil-kaczmarek left a comment

Choose a reason for hiding this comment

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

ok

@kamil-kaczmarek kamil-kaczmarek merged commit 1e577fa into dev May 17, 2018
@kamil-kaczmarek kamil-kaczmarek deleted the dev-docstrings branch May 17, 2018 12:13
kamil-kaczmarek pushed a commit that referenced this pull request May 23, 2018
* initial

* cleaned up

* updates keras models and callbacks

* added explanation notebook

* renamed notebook

* ran notebook

* transformer loading now to be clicked

* dropped nlp

* fixed typos

* updated whats missing

* updated with dsb and talking data

* added simple pipeline notebook

* imports optimized

* feature_names=None and categorical_features=None

* refactor the way the model parameters are passed

* moved adapters to seperate file, renamed identity/take_first adapters

* Update misc.py

* fit_transform -> transform

* Update base.py

* fixed #10

* fixed typo

* * added: get_upsample_pad, get_downsample_pad
* added: multiclass_segmentation_loss

* *warning added

* Add some user interface messages

* Notebook#3: Adapter for ensembling

* Add example: 1-getting-started.ipynb

* Remove custom adapter; other minor changes after reviewer feedback

* Add example 2-multi-step.ipynb and some minor changes to example 1-getting-started.ipynb

* Cleanup of examples 1 and 2

* Fix a mistake in notebook text

* Add steps/__pycache__ to .gitignore

* Further changes based on Github feedback

* add self.conv_stride parameter in unet definition

* Change steps/__pycache__ to *.pyc in .gitignore

* Changes in Notebook#3 following code review

* train forests on train data and ensembler on ensembling data

* decoupled sklearn preprocessing from text preprocessing with heavy de… (#32)

* decoupled sklearn preprocessing from text preprocessing with heavy dependencies

* fixed import error

* dropped anonymization from text.py, reformatted imports, small refactors

* small refactor for readability

* Change time format (#40)

* Dev docstrings (#33)

* Step halfway done

* Step init args done

* Steps docstrings done

* added docstrings to Step properties

* Step docstring done

* dropped mock transformer addeed docstrings to Base and Dummy Transformers

* base documentation finished, minor refactors

* docstrings added to adapters

* docstrings added

* started refactoring lgbm

* Update base.py

* updated docstrings

* base transformer docstring fix

* fixed logging docstrings

* Notebook #5: Example with Keras (#41)

* Notebook #5: Example with Keras

* Corrected notebook for Keras and necessary refactors in ClassifierGenerator

* Fix issue #28: Unintuitive adapter syntax (#42)

* Write tests for new adapter syntax

* Refactor adapter

* Improve handling of caches and logs in tests

* Fix minor issues mentioned in PR comments

* Rewrite tests in pytest framework

* Move adapting to seperate class, alter behaviour

* Correction: mutable object as default argument in Step initializer

* Issue #16: make_transformer (#50)

* Corrections and tests for Sklearn wrappers

* make_transformer taking arbitrary functions

* fix issues #48 and #49 (#52)

* fix issues #48 and #49

* use of setdefault method

* fix according to Kamil's request

* Fix post merge issues

* Prepare package (#58)

* Remove tutorial notebooks

* Remove modules with heavy dependencies

* Rename steps -> steppy

* Add setup.py

* Tell git to ignore egg files

* Read the docs might output of sphinx-quickstart

* Requirements file

* Try adding sphinx-apidoc output

* Add some requirements

* Add IPython to requirements

* removed intro.ipynb and updated requirements.txt

* corrected setup.py

* refactored NoOperation to IdentityOperation, optimized inputs

* moved misc.py to steppy-toolkit

* simplified ProbabilityCalibation, BaseTransformer small refactor

* prepare setup.py and setup.cfg for PyPI registration

* added install requires to setup.py

* name refactor

* Create README.md
@kamil-kaczmarek kamil-kaczmarek mentioned this pull request May 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants