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

Docs update #79

Merged
merged 10 commits into from
Jul 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cascade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
"""

__version__ = '0.5.2'
__version__ = '0.6.0'
__author__ = 'Ilia Moiseev'
__author_email__ = 'ilia.moiseev.5@yandex.ru'

Expand All @@ -25,7 +25,7 @@
from . import tests

# cascade does not have
# `from . import utils`
# from . import utils
# because it will bring additional dependencies that may not be needed by the user
# if you need to use cascade.utils, you can install utils_requirements.txt and then
# import as any other cascade module
6 changes: 3 additions & 3 deletions cascade/data/pickler.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class Pickler(Modifier):
"""
def __init__(self, path, dataset=None, *args, **kwargs) -> None:
"""
Loads pickled dataset or dumps one depending on parameters passed
Loads pickled dataset or dumps one depending on parameters passed:

If only path is passed - loads dataset from path provided if path exists
if path provided with a dataset dumps dataset to the path
1. If only path is passed - loads dataset from path provided if path exists
2. if path provided with a dataset dumps dataset to the path

Parameters
----------
Expand Down
13 changes: 13 additions & 0 deletions cascade/data/random_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,20 @@


class RandomSampler(Sampler):
"""
Shuffles dataset. Can randomly sample from dataset
if num_samples is not None and less than length of dataset.
"""
def __init__(self, dataset: Dataset, num_samples=None, **kwargs) -> None:
"""
Parameters
----------
dataset: Dataset
Input dataset to sample from
num_samples: int, optional
Should be less than len(dataset), but oversampling can be added in the future.
If None, then just shuffles the dataset.
"""
if num_samples is None:
num_samples = len(dataset)
super().__init__(dataset, num_samples, **kwargs)
Expand Down
10 changes: 0 additions & 10 deletions cascade/docs/source/cascade.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ cascade.data

|


.. autoclass:: cascade.data.FolderDataset
:members:

|

|

|

.. autoclass:: cascade.data.FolderDataset
:members:

Expand Down
16 changes: 13 additions & 3 deletions cascade/docs/source/cascade.meta.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ cascade.meta

|

.. autoclass:: cascade.meta.MetaValidator
:members:

|

|

|


.. autoclass:: cascade.meta.MetaViewer
:members:

Expand All @@ -27,7 +37,7 @@ cascade.meta

|

.. autoclass:: cascade.meta.AggregateValidator
.. autoclass:: cascade.meta.Validator
:members:

|
Expand All @@ -36,7 +46,7 @@ cascade.meta

|

.. autoclass:: cascade.meta.PredicateValidator
.. autoclass:: cascade.meta.AggregateValidator
:members:

|
Expand All @@ -45,7 +55,7 @@ cascade.meta

|

.. autoclass:: cascade.meta.MetaValidator
.. autoclass:: cascade.meta.PredicateValidator
:members:

|
Expand Down
23 changes: 20 additions & 3 deletions cascade/docs/source/cascade.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ cascade.models

|

.. autoclass:: cascade.models.ModelRepo
.. autoclass:: cascade.models.ModelModifier
:members:

Expand All @@ -20,7 +19,7 @@ cascade.models

|

.. autoclass:: cascade.models.ModelLine
.. autoclass:: cascade.models.BasicModel
:members:

|
Expand All @@ -29,7 +28,25 @@ cascade.models

|

.. autoclass:: cascade.models.Model
.. autoclass:: cascade.models.BasicModelModifier
:members:

|

|

|

.. autoclass:: cascade.models.ModelRepo
:members:

|

|

|

.. autoclass:: cascade.models.ModelLine
:members:

|
Expand Down
120 changes: 120 additions & 0 deletions cascade/docs/source/cascade.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
cascade.utils
==============

.. autoclass:: cascade.utils.ConstantBaseline
:members:

|

|

|

.. autoclass:: cascade.utils.FolderImageDataset
:members:

|

|

|

.. autoclass:: cascade.utils.NumpyWrapper
:members:

|

|

|

.. autoclass:: cascade.utils.OverSampler
:members:

|

|

|

.. autoclass:: cascade.utils.PaSchemaValidator
:members:

|

|

|

.. autoclass:: cascade.utils.SkModel
:members:

|

|

|

.. autoclass:: cascade.utils.TableDataset
:members:

|

|

|

.. autoclass:: cascade.utils.TableFilter
:members:

|

|

|

.. autoclass:: cascade.utils.CSVDataset
:members:

|

|

|


.. autoclass:: cascade.utils.PartedTableLoader
:members:

|

|

|

.. autoclass:: cascade.utils.TableIterator
:members:

|

|

|

.. autoclass:: cascade.utils.LargeCSVDataset
:members:

|

|

|

.. autoclass:: cascade.utils.NullValidator
:members:

|

|

|
5 changes: 5 additions & 0 deletions cascade/docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
'nbsphinx'
]

autodoc_default_options = {
'special-members': '__init__',
'undoc-members': False
}

napoleon_include_special_with_doc = True
# napoleon_use_admonition_for_notes = True

Expand Down
6 changes: 6 additions & 0 deletions cascade/docs/source/examples/model_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2505,10 +2505,16 @@
"metadata": {},
"source": [
"## See also:\n",
"- [Pipeline building](pipeline_building.html) - (Previous example)\n",
"- [Documentation](https://oxid15.github.io/cascade/)\n",
"- [Key concepts](https://oxid15.github.io/cascade/concepts.html)\n",
"- [Code reference](https://oxid15.github.io/cascade/modules.html)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
Expand Down
3 changes: 1 addition & 2 deletions cascade/docs/source/examples/pipeline_building.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,7 @@
"metadata": {},
"source": [
"## See also:\n",
"[Train models]() \n",
"[Feature selection]()"
"[Train models](model_training.html) "
]
},
{
Expand Down
1 change: 1 addition & 0 deletions cascade/docs/source/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Cascade modules reference
cascade.data
cascade.models
cascade.meta
cascade.utils
2 changes: 1 addition & 1 deletion cascade/docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ Below are examples of usage of Cascade for some typical tasks.
examples/model_training.ipynb

.. important::
This section is WIP, will be filled in following releases!
New use-cases will be added soon!
2 changes: 1 addition & 1 deletion cascade/meta/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
from .meta_viewer import MetaViewer
from .metric_viewer import MetricViewer
from .validator import DataValidationException, Validator, AggregateValidator, PredicateValidator
from .meta_validator import MetaValidator
from .meta_validator import Validator, MetaValidator
from .history_viewer import HistoryViewer
9 changes: 9 additions & 0 deletions cascade/meta/meta_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ class MetaValidator(Validator):
cascade.data.Modifier
"""
def __init__(self, dataset: Dataset, root=None) -> None:
"""
Parameters
----------
dataset: Dataset
dataset to validate
root: str
path to the folder in which to store meta
default is './.cascade'
"""
super().__init__(dataset, lambda x: True)
self.mh = MetaHandler()
if root is None:
Expand Down
8 changes: 6 additions & 2 deletions cascade/meta/meta_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ def __init__(self, root, filt=None) -> None:
Parameters
----------
root:
path to the folder containing meta files in .json format
to dump and load .json files MetaHandler is used
path to the folder containing metadata files
to dump and load metadata files MetaHandler is used
filt Dict, optional:
dictionary that specifies which values should be present in meta
for example to find all models use `filt={'type': 'model'}`

See also
--------
cascade.meta.ModelRepo
Expand Down
12 changes: 12 additions & 0 deletions cascade/meta/metric_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@ def plot_table(self, show=False):
return fig

def serve(self, page_size=50, include=None, exclude=None, **kwargs) -> None:
"""
Runs dash-based server with interactive table of metrics and parameters.

Parameters
----------
page_size:
Size of the table in rows on one page
include List[str], optional:
List of parameters or metrics to be added. Only them will be present along with some default.
exclude List[str], optional:
List of parameters or metrics to be excluded from table.
"""
# Conditional import
try:
import dash
Expand Down
3 changes: 3 additions & 0 deletions cascade/models/basic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ def fit(self, x, y, *args, **kwargs) -> None:


class BasicModelModifier(ModelModifier, BasicModel):
"""
Interface to unify BasicModel and ModelModifier.
"""
pass
Loading