Skip to content

Commit

Permalink
Add missing documentation (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Geekman authored Sep 16, 2021
1 parent a70f63c commit 2df0793
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
78 changes: 78 additions & 0 deletions etna/models/catboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,45 @@ def __init__(
thread_count: int = 4,
**kwargs,
):
"""Create instance of CatBoostModelPerSegment with given parameters.
Parameters
----------
iterations:
The maximum number of trees that can be built when solving
machine learning problems. When using other parameters that
limit the number of iterations, the final number of trees
may be less than the number specified in this parameter.
depth:
Depth of the tree. The range of supported values depends
on the processing unit type and the type of the selected loss function:
CPU — Any integer up to 16.
GPU — Any integer up to 8 pairwise modes (YetiRank, PairLogitPairwise and
QueryCrossEntropy) and up to 16 for all other loss functions.
learning_rate:
The learning rate. Used for reducing the gradient step.
logging_level:
The logging level to output to stdout.
Possible values:
Silent — Do not output any logging information to stdout.
Verbose — Output the following data to stdout:
optimized metric
elapsed time of training
remaining time of training
Info — Output additional information and the number of trees.
Debug — Output debugging information.
l2_leaf_reg:
Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.
thread_count:
The number of threads to use during the training.
For CPU
Optimizes the speed of execution. This parameter doesn't affect results.
For GPU
The given value is used for reading the data from the hard drive and does
not affect the training.
During the training one main thread and one thread for each GPU are used.
"""
super(CatBoostModelPerSegment, self).__init__(
base_model=_CatBoostModel(
iterations=iterations,
Expand All @@ -83,6 +122,45 @@ def __init__(
thread_count: int = 4,
**kwargs,
):
"""Create instance of CatBoostModelMultiSegment with given parameters.
Parameters
----------
iterations:
The maximum number of trees that can be built when solving
machine learning problems. When using other parameters that
limit the number of iterations, the final number of trees
may be less than the number specified in this parameter.
depth:
Depth of the tree. The range of supported values depends
on the processing unit type and the type of the selected loss function:
CPU — Any integer up to 16.
GPU — Any integer up to 8 pairwise modes (YetiRank, PairLogitPairwise and
QueryCrossEntropy) and up to 16 for all other loss functions.
learning_rate:
The learning rate. Used for reducing the gradient step.
logging_level:
The logging level to output to stdout.
Possible values:
Silent — Do not output any logging information to stdout.
Verbose — Output the following data to stdout:
optimized metric
elapsed time of training
remaining time of training
Info — Output additional information and the number of trees.
Debug — Output debugging information.
l2_leaf_reg:
Coefficient at the L2 regularization term of the cost function.
Any positive value is allowed.
thread_count:
The number of threads to use during the training.
For CPU
Optimizes the speed of execution. This parameter doesn't affect results.
For GPU
The given value is used for reading the data from the hard drive and does
not affect the training.
During the training one main thread and one thread for each GPU are used.
"""
self.iterations = iterations
self.depth = depth
self.learning_rate = learning_rate
Expand Down
16 changes: 16 additions & 0 deletions etna/models/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,29 @@ class SklearnPerSegmentModel(PerSegmentModel):
"""Class for holding per segment Sklearn model."""

def __init__(self, regressor: RegressorMixin):
"""
Create instance of SklearnPerSegmentModel with given parameters.
Parameters
----------
regressor:
sklearn model for regression
"""
super().__init__(base_model=_SklearnModel(regressor=regressor))


class SklearnMultiSegmentModel(Model):
"""Class for holding Sklearn model for all segments."""

def __init__(self, regressor: RegressorMixin):
"""
Create instance of SklearnMultiSegmentModel with given parameters.
Parameters
----------
regressor:
sklearn model for regression
"""
super().__init__()
self._base_model = _SklearnModel(regressor=regressor)

Expand Down

0 comments on commit 2df0793

Please sign in to comment.