@@ -75,21 +75,50 @@ class BallCover(ProximityCover):
7575 Cover algorithm based on `ball proximity function` implemented as
7676 :class:`tdamapper.proximity.BallProximity`.
7777
78- :param radius: The radius of the open balls, must be positive.
78+ :param radius: The radius of the open balls. Must be a positive value .
7979 :type radius: float
80- :param metric: The (pseudo-)metric function that defines the distance
81- between points, must be symmetric, positive, and satisfy the
82- triangle-inequality, i.e.
83- :math:`metric(x, z) \leq metric(x, y) + metric(y, z)` for every x, y, z
84- in the dataset.
85- :type metric: Callable
86- :param flat: A flag that indicates whether to use a flat or a hierarchical
87- vantage point tree, defaults to False.
88- :type flat: bool, optional
80+ :param metric: The metric used to define the distance between points.
81+ Accepts any value compatible with `tdamapper.utils.metrics.get_metric`.
82+ Defaults to 'euclidean'.
83+ :type metric: str or callable
84+ :param metric_params: Additional parameters for the metric function, to be
85+ passed to `tdamapper.utils.metrics.get_metric`. Defaults to None.
86+ :type metric_params: dict, optional
87+ :param kind: Specifies whether to use a flat or a hierarchical vantage
88+ point tree. Acceptable values are 'flat' or 'hierarchical'. Defaults
89+ to 'flat'.
90+ :type kind: str
91+ :param leaf_capacity: The maximum number of points in a leaf node of the
92+ vantage point tree. Must be a positive value. Defaults to 1.
93+ :type leaf_capacity: int
94+ :param leaf_radius: The radius of the leaf nodes. If not specified, it
95+ defaults to the value of `radius`. Must be a positive value. Defaults
96+ to None.
97+ :type leaf_radius: float, optional
98+ :param pivoting: The method used for pivoting in the vantage point tree.
99+ Acceptable values are None, 'random', or 'furthest'. Defaults to None.
100+ :type pivoting: str or callable, optional
89101 """
90102
91- def __init__ (self , radius , metric , flat = True ):
92- prox = BallProximity (radius = radius , metric = metric , flat = flat )
103+ def __init__ (
104+ self ,
105+ radius ,
106+ metric = 'euclidean' ,
107+ metric_params = None ,
108+ kind = 'flat' ,
109+ leaf_capacity = 1 ,
110+ leaf_radius = None ,
111+ pivoting = None ,
112+ ):
113+ prox = BallProximity (
114+ radius = radius ,
115+ metric = metric ,
116+ metric_params = metric_params ,
117+ kind = kind ,
118+ leaf_capacity = leaf_capacity ,
119+ leaf_radius = leaf_radius ,
120+ pivoting = pivoting ,
121+ )
93122 super ().__init__ (proximity = prox )
94123
95124
@@ -101,19 +130,48 @@ class KNNCover(ProximityCover):
101130 :param neighbors: The number of neighbors to use for the KNN Proximity
102131 function, must be positive and less than the length of the dataset.
103132 :type neighbors: int
104- :param metric: The (pseudo-)metric function that defines the distance
105- between points, must be symmetric, positive, and satisfy the
106- triangle-inequality, i.e.
107- :math:`metric(x, z) \leq metric(x, y) + metric(y, z)` for every x, y, z
108- in the dataset.
109- :type metric: Callable
110- :param flat: A flag that indicates whether to use a flat or a hierarchical
111- vantage point tree, defaults to False.
112- :type flat: bool, optional
133+ :param metric: The metric used to define the distance between points.
134+ Accepts any value compatible with `tdamapper.utils.metrics.get_metric`.
135+ Defaults to 'euclidean'.
136+ :type metric: str or callable
137+ :param metric_params: Additional parameters for the metric function, to be
138+ passed to `tdamapper.utils.metrics.get_metric`. Defaults to None.
139+ :type metric_params: dict, optional
140+ :param kind: Specifies whether to use a flat or a hierarchical vantage
141+ point tree. Acceptable values are 'flat' or 'hierarchical'. Defaults
142+ to 'flat'.
143+ :type kind: str
144+ :param leaf_capacity: The maximum number of points in a leaf node of the
145+ vantage point tree. If not specified, it defaults to the value of
146+ `neighbors`. Must be a positive value. Defaults to None.
147+ :type leaf_capacity: int, optional
148+ :param leaf_radius: The radius of the leaf nodes. Must be a positive value.
149+ Defaults to 0.0.
150+ :type leaf_radius: float
151+ :param pivoting: The method used for pivoting in the vantage point tree.
152+ Acceptable values are None, 'random', or 'furthest'. Defaults to None.
153+ :type pivoting: str or callable, optional
113154 """
114155
115- def __init__ (self , neighbors , metric , flat = True ):
116- prox = KNNProximity (neighbors = neighbors , metric = metric , flat = flat )
156+ def __init__ (
157+ self ,
158+ neighbors ,
159+ metric = 'euclidean' ,
160+ metric_params = None ,
161+ kind = 'flat' ,
162+ leaf_capacity = None ,
163+ leaf_radius = 0.0 ,
164+ pivoting = None ,
165+ ):
166+ prox = KNNProximity (
167+ neighbors = neighbors ,
168+ metric = metric ,
169+ metric_params = metric_params ,
170+ kind = kind ,
171+ leaf_capacity = leaf_capacity ,
172+ leaf_radius = leaf_radius ,
173+ pivoting = pivoting ,
174+ )
117175 super ().__init__ (proximity = prox )
118176
119177
@@ -122,22 +180,52 @@ class CubicalCover(ProximityCover):
122180 Cover algorithm based on the `cubical proximity function` implemented as
123181 :class:`tdamapper.proximity.CubicalProximity`.
124182
125- :param n_intervals: The number of intervals to use for each dimension, must
126- be positive and less than or equal to the length of the dataset.
183+ :param n_intervals: The number of intervals to use for each dimension.
184+ Must be positive and less than or equal to the length of the dataset.
127185 :type n_intervals: int
128186 :param overlap_frac: The fraction of overlap between adjacent intervals on
129187 each dimension, must be in the range (0.0, 1.0).
130188 :type overlap_frac: float
131- :param flat: A flag that indicates whether to use a flat or a hierarchical
132- vantage point tree, defaults to False.
133- :type flat: bool, optional
189+ :param metric: The metric used to define the distance between points.
190+ Accepts any value compatible with `tdamapper.utils.metrics.get_metric`.
191+ Defaults to 'euclidean'.
192+ :type metric: str or callable
193+ :param metric_params: Additional parameters for the metric function, to be
194+ passed to `tdamapper.utils.metrics.get_metric`. Defaults to None.
195+ :type metric_params: dict, optional
196+ :param kind: Specifies whether to use a flat or a hierarchical vantage
197+ point tree. Acceptable values are 'flat' or 'hierarchical'. Defaults
198+ to 'flat'.
199+ :type kind: str
200+ :param leaf_capacity: The maximum number of points in a leaf node of the
201+ vantage point tree. Must be a positive value. Defaults to 1.
202+ :type leaf_capacity: int
203+ :param leaf_radius: The radius of the leaf nodes. If not specified, it
204+ defaults to the value of `radius`. Must be a positive value. Defaults
205+ to None.
206+ :type leaf_radius: float, optional
207+ :param pivoting: The method used for pivoting in the vantage point tree.
208+ Acceptable values are None, 'random', or 'furthest'. Defaults to None.
209+ :type pivoting: str or callable, optional
134210 """
135211
136- def __init__ (self , n_intervals , overlap_frac , flat = True ):
212+ def __init__ (
213+ self ,
214+ n_intervals ,
215+ overlap_frac ,
216+ kind = 'flat' ,
217+ leaf_capacity = 1 ,
218+ leaf_radius = None ,
219+ pivoting = None ,
220+ ):
137221 prox = CubicalProximity (
138222 n_intervals = n_intervals ,
139223 overlap_frac = overlap_frac ,
140- flat = flat )
224+ kind = kind ,
225+ leaf_capacity = leaf_capacity ,
226+ leaf_radius = leaf_radius ,
227+ pivoting = pivoting ,
228+ )
141229 super ().__init__ (proximity = prox )
142230
143231
0 commit comments