Base classes (ruptures.base)#
All estimators and cost functions are subclasses of.
BaseEstimator
and
BaseCost
respectively.
BaseCost
#
Bases: object
Base class for all segment cost classes.
Notes
All classes should specify all the parameters that can be set
at the class level in their __init__
as explicit keyword
arguments (no *args
or **kwargs
).
Source code in src/ruptures/base.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
|
error(start, end)
abstractmethod
#
Returns the cost on segment [start:end].
Source code in src/ruptures/base.py
51 52 53 54 |
|
fit(*args, **kwargs)
abstractmethod
#
Set the parameters of the cost function, for instance the Gram matrix, etc.
Source code in src/ruptures/base.py
45 46 47 48 49 |
|
sum_of_costs(bkps)
#
Returns the sum of segments cost for the given segmentation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bkps
|
list
|
list of change points. By convention, bkps[-1]==n_samples. |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
sum of costs |
Source code in src/ruptures/base.py
56 57 58 59 60 61 62 63 64 65 66 |
|
BaseEstimator
#
Base class for all change point detection estimators.
Notes
All estimators should specify all the parameters that can be set
at the class level in their __init__
as explicit keyword
arguments (no *args
or **kwargs
).
Source code in src/ruptures/base.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
fit(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in src/ruptures/base.py
20 21 22 23 |
|
fit_predict(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in src/ruptures/base.py
30 31 32 33 |
|
predict(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in src/ruptures/base.py
25 26 27 28 |
|