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 ruptures/base.py
35 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 |
|
error(start, end)
abstractmethod
#
Returns the cost on segment [start:end].
Source code in ruptures/base.py
50 51 52 53 |
|
fit(*args, **kwargs)
abstractmethod
#
Set the parameters of the cost function, for instance the Gram matrix, etc.
Source code in ruptures/base.py
44 45 46 47 48 |
|
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 ruptures/base.py
55 56 57 58 59 60 61 62 63 64 65 |
|
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 ruptures/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
|
fit(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in ruptures/base.py
19 20 21 22 |
|
fit_predict(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in ruptures/base.py
29 30 31 32 |
|
predict(*args, **kwargs)
abstractmethod
#
To call the segmentation algorithm.
Source code in ruptures/base.py
24 25 26 27 |
|