-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
FeatureAgglomeration.ts
680 lines (559 loc) · 22.9 KB
/
FeatureAgglomeration.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
/* eslint-disable */
/* NOTE: This file is auto-generated. Do not edit it directly. */
import crypto from 'node:crypto'
import { PythonBridge, NDArray, ArrayLike, SparseMatrix } from '@/sklearn/types'
/**
Agglomerate features.
Recursively merges pair of clusters of features.
Read more in the [User Guide](../clustering.html#hierarchical-clustering).
[Python Reference](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.FeatureAgglomeration.html)
*/
export class FeatureAgglomeration {
id: string
opts: any
_py: PythonBridge
_isInitialized: boolean = false
_isDisposed: boolean = false
constructor(opts?: {
/**
The number of clusters to find. It must be `undefined` if `distance\_threshold` is not `undefined`.
@defaultValue `2`
*/
n_clusters?: number
/**
The metric to use when calculating distance between instances in a feature array. If metric is a string or callable, it must be one of the options allowed by [`sklearn.metrics.pairwise\_distances`](sklearn.metrics.pairwise_distances.html#sklearn.metrics.pairwise_distances "sklearn.metrics.pairwise_distances") for its metric parameter. If linkage is “ward”, only “euclidean” is accepted. If “precomputed”, a distance matrix (instead of a similarity matrix) is needed as input for the fit method.
@defaultValue `'euclidean'`
*/
affinity?: string
/**
Metric used to compute the linkage. Can be “euclidean”, “l1”, “l2”, “manhattan”, “cosine”, or “precomputed”. If set to `undefined` then “euclidean” is used. If linkage is “ward”, only “euclidean” is accepted. If “precomputed”, a distance matrix is needed as input for the fit method.
*/
metric?: string
/**
Used to cache the output of the computation of the tree. By default, no caching is done. If a string is given, it is the path to the caching directory.
*/
memory?: string
/**
Connectivity matrix. Defines for each feature the neighboring features following a given structure of the data. This can be a connectivity matrix itself or a callable that transforms the data into a connectivity matrix, such as derived from `kneighbors\_graph`. Default is `undefined`, i.e, the hierarchical clustering algorithm is unstructured.
*/
connectivity?: ArrayLike
/**
Stop early the construction of the tree at `n\_clusters`. This is useful to decrease computation time if the number of clusters is not small compared to the number of features. This option is useful only when specifying a connectivity matrix. Note also that when varying the number of clusters and using caching, it may be advantageous to compute the full tree. It must be `true` if `distance\_threshold` is not `undefined`. By default `compute\_full\_tree` is “auto”, which is equivalent to `true` when `distance\_threshold` is not `undefined` or that `n\_clusters` is inferior to the maximum between 100 or `0.02 \* n\_samples`. Otherwise, “auto” is equivalent to `false`.
@defaultValue `'auto'`
*/
compute_full_tree?: 'auto' | boolean
/**
Which linkage criterion to use. The linkage criterion determines which distance to use between sets of features. The algorithm will merge the pairs of cluster that minimize this criterion.
@defaultValue `'ward'`
*/
linkage?: 'ward' | 'complete' | 'average' | 'single'
/**
This combines the values of agglomerated features into a single value, and should accept an array of shape \[M, N\] and the keyword argument `axis=1`, and reduce it to an array of size \[M\].
*/
pooling_func?: any
/**
The linkage distance threshold at or above which clusters will not be merged. If not `undefined`, `n\_clusters` must be `undefined` and `compute\_full\_tree` must be `true`.
*/
distance_threshold?: number
/**
Computes distances between clusters even if `distance\_threshold` is not used. This can be used to make dendrogram visualization, but introduces a computational and memory overhead.
@defaultValue `false`
*/
compute_distances?: boolean
}) {
this.id = `FeatureAgglomeration${crypto.randomUUID().split('-')[0]}`
this.opts = opts || {}
}
get py(): PythonBridge {
return this._py
}
set py(pythonBridge: PythonBridge) {
this._py = pythonBridge
}
/**
Initializes the underlying Python resources.
This instance is not usable until the `Promise` returned by `init()` resolves.
*/
async init(py: PythonBridge): Promise<void> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (this._isInitialized) {
return
}
if (!py) {
throw new Error(
'FeatureAgglomeration.init requires a PythonBridge instance'
)
}
this._py = py
await this._py.ex`
import numpy as np
from sklearn.cluster import FeatureAgglomeration
try: bridgeFeatureAgglomeration
except NameError: bridgeFeatureAgglomeration = {}
`
// set up constructor params
await this._py.ex`ctor_FeatureAgglomeration = {'n_clusters': ${
this.opts['n_clusters'] ?? undefined
}, 'affinity': ${this.opts['affinity'] ?? undefined}, 'metric': ${
this.opts['metric'] ?? undefined
}, 'memory': ${this.opts['memory'] ?? undefined}, 'connectivity': ${
this.opts['connectivity'] ?? undefined
}, 'compute_full_tree': ${
this.opts['compute_full_tree'] ?? undefined
}, 'linkage': ${this.opts['linkage'] ?? undefined}, 'pooling_func': ${
this.opts['pooling_func'] ?? undefined
}, 'distance_threshold': ${
this.opts['distance_threshold'] ?? undefined
}, 'compute_distances': ${this.opts['compute_distances'] ?? undefined}}
ctor_FeatureAgglomeration = {k: v for k, v in ctor_FeatureAgglomeration.items() if v is not None}`
await this._py
.ex`bridgeFeatureAgglomeration[${this.id}] = FeatureAgglomeration(**ctor_FeatureAgglomeration)`
this._isInitialized = true
}
/**
Disposes of the underlying Python resources.
Once `dispose()` is called, the instance is no longer usable.
*/
async dispose() {
if (this._isDisposed) {
return
}
if (!this._isInitialized) {
return
}
await this._py.ex`del bridgeFeatureAgglomeration[${this.id}]`
this._isDisposed = true
}
/**
Fit the hierarchical clustering on the data.
*/
async fit(opts: {
/**
The data.
*/
X?: ArrayLike[]
/**
Not used, present here for API consistency by convention.
*/
y?: any
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error('FeatureAgglomeration must call init() before fit()')
}
// set up method params
await this._py.ex`pms_FeatureAgglomeration_fit = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None, 'y': ${opts['y'] ?? undefined}}
pms_FeatureAgglomeration_fit = {k: v for k, v in pms_FeatureAgglomeration_fit.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_fit = bridgeFeatureAgglomeration[${this.id}].fit(**pms_FeatureAgglomeration_fit)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_fit.tolist() if hasattr(res_FeatureAgglomeration_fit, 'tolist') else res_FeatureAgglomeration_fit`
}
/**
Fit to data, then transform it.
Fits transformer to `X` and `y` with optional parameters `fit\_params` and returns a transformed version of `X`.
*/
async fit_transform(opts: {
/**
Input samples.
*/
X?: ArrayLike[]
/**
Target values (`undefined` for unsupervised transformations).
*/
y?: ArrayLike
/**
Additional fit parameters.
*/
fit_params?: any
}): Promise<any[]> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before fit_transform()'
)
}
// set up method params
await this._py.ex`pms_FeatureAgglomeration_fit_transform = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None, 'y': np.array(${
opts['y'] ?? undefined
}) if ${opts['y'] !== undefined} else None, 'fit_params': ${
opts['fit_params'] ?? undefined
}}
pms_FeatureAgglomeration_fit_transform = {k: v for k, v in pms_FeatureAgglomeration_fit_transform.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_fit_transform = bridgeFeatureAgglomeration[${this.id}].fit_transform(**pms_FeatureAgglomeration_fit_transform)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_fit_transform.tolist() if hasattr(res_FeatureAgglomeration_fit_transform, 'tolist') else res_FeatureAgglomeration_fit_transform`
}
/**
Get output feature names for transformation.
The feature names out will prefixed by the lowercased class name. For example, if the transformer outputs 3 features, then the feature names out are: `\["class\_name0", "class\_name1", "class\_name2"\]`.
*/
async get_feature_names_out(opts: {
/**
Only used to validate feature names with the names seen in `fit`.
*/
input_features?: any
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before get_feature_names_out()'
)
}
// set up method params
await this._py
.ex`pms_FeatureAgglomeration_get_feature_names_out = {'input_features': ${
opts['input_features'] ?? undefined
}}
pms_FeatureAgglomeration_get_feature_names_out = {k: v for k, v in pms_FeatureAgglomeration_get_feature_names_out.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_get_feature_names_out = bridgeFeatureAgglomeration[${this.id}].get_feature_names_out(**pms_FeatureAgglomeration_get_feature_names_out)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_get_feature_names_out.tolist() if hasattr(res_FeatureAgglomeration_get_feature_names_out, 'tolist') else res_FeatureAgglomeration_get_feature_names_out`
}
/**
Get metadata routing of this object.
Please check [User Guide](../../metadata_routing.html#metadata-routing) on how the routing mechanism works.
*/
async get_metadata_routing(opts: {
/**
A [`MetadataRequest`](sklearn.utils.metadata_routing.MetadataRequest.html#sklearn.utils.metadata_routing.MetadataRequest "sklearn.utils.metadata_routing.MetadataRequest") encapsulating routing information.
*/
routing?: any
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before get_metadata_routing()'
)
}
// set up method params
await this._py
.ex`pms_FeatureAgglomeration_get_metadata_routing = {'routing': ${
opts['routing'] ?? undefined
}}
pms_FeatureAgglomeration_get_metadata_routing = {k: v for k, v in pms_FeatureAgglomeration_get_metadata_routing.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_get_metadata_routing = bridgeFeatureAgglomeration[${this.id}].get_metadata_routing(**pms_FeatureAgglomeration_get_metadata_routing)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_get_metadata_routing.tolist() if hasattr(res_FeatureAgglomeration_get_metadata_routing, 'tolist') else res_FeatureAgglomeration_get_metadata_routing`
}
/**
Inverse the transformation and return a vector of size `n\_features`.
*/
async inverse_transform(opts: {
/**
The values to be assigned to each cluster of samples.
*/
Xt?: ArrayLike[]
/**
Use `Xt` instead.
*/
Xred?: any
}): Promise<NDArray[]> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before inverse_transform()'
)
}
// set up method params
await this._py
.ex`pms_FeatureAgglomeration_inverse_transform = {'Xt': np.array(${
opts['Xt'] ?? undefined
}) if ${opts['Xt'] !== undefined} else None, 'Xred': ${
opts['Xred'] ?? undefined
}}
pms_FeatureAgglomeration_inverse_transform = {k: v for k, v in pms_FeatureAgglomeration_inverse_transform.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_inverse_transform = bridgeFeatureAgglomeration[${this.id}].inverse_transform(**pms_FeatureAgglomeration_inverse_transform)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_inverse_transform.tolist() if hasattr(res_FeatureAgglomeration_inverse_transform, 'tolist') else res_FeatureAgglomeration_inverse_transform`
}
/**
Set output container.
See [Introducing the set\_output API](../../auto_examples/miscellaneous/plot_set_output.html#sphx-glr-auto-examples-miscellaneous-plot-set-output-py) for an example on how to use the API.
*/
async set_output(opts: {
/**
Configure output of `transform` and `fit\_transform`.
*/
transform?: 'default' | 'pandas'
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before set_output()'
)
}
// set up method params
await this._py.ex`pms_FeatureAgglomeration_set_output = {'transform': ${
opts['transform'] ?? undefined
}}
pms_FeatureAgglomeration_set_output = {k: v for k, v in pms_FeatureAgglomeration_set_output.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_set_output = bridgeFeatureAgglomeration[${this.id}].set_output(**pms_FeatureAgglomeration_set_output)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_set_output.tolist() if hasattr(res_FeatureAgglomeration_set_output, 'tolist') else res_FeatureAgglomeration_set_output`
}
/**
Transform a new matrix using the built clustering.
*/
async transform(opts: {
/**
A M by N array of M observations in N dimensions or a length M array of M one-dimensional observations.
*/
X?: ArrayLike[]
}): Promise<NDArray[]> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before transform()'
)
}
// set up method params
await this._py.ex`pms_FeatureAgglomeration_transform = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None}
pms_FeatureAgglomeration_transform = {k: v for k, v in pms_FeatureAgglomeration_transform.items() if v is not None}`
// invoke method
await this._py
.ex`res_FeatureAgglomeration_transform = bridgeFeatureAgglomeration[${this.id}].transform(**pms_FeatureAgglomeration_transform)`
// convert the result from python to node.js
return this
._py`res_FeatureAgglomeration_transform.tolist() if hasattr(res_FeatureAgglomeration_transform, 'tolist') else res_FeatureAgglomeration_transform`
}
/**
The number of clusters found by the algorithm. If `distance\_threshold=None`, it will be equal to the given `n\_clusters`.
*/
get n_clusters_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing n_clusters_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_n_clusters_ = bridgeFeatureAgglomeration[${this.id}].n_clusters_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_n_clusters_.tolist() if hasattr(attr_FeatureAgglomeration_n_clusters_, 'tolist') else attr_FeatureAgglomeration_n_clusters_`
})()
}
/**
Cluster labels for each feature.
*/
get labels_(): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing labels_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_labels_ = bridgeFeatureAgglomeration[${this.id}].labels_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_labels_.tolist() if hasattr(attr_FeatureAgglomeration_labels_, 'tolist') else attr_FeatureAgglomeration_labels_`
})()
}
/**
Number of leaves in the hierarchical tree.
*/
get n_leaves_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing n_leaves_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_n_leaves_ = bridgeFeatureAgglomeration[${this.id}].n_leaves_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_n_leaves_.tolist() if hasattr(attr_FeatureAgglomeration_n_leaves_, 'tolist') else attr_FeatureAgglomeration_n_leaves_`
})()
}
/**
The estimated number of connected components in the graph.
*/
get n_connected_components_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing n_connected_components_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_n_connected_components_ = bridgeFeatureAgglomeration[${this.id}].n_connected_components_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_n_connected_components_.tolist() if hasattr(attr_FeatureAgglomeration_n_connected_components_, 'tolist') else attr_FeatureAgglomeration_n_connected_components_`
})()
}
/**
Number of features seen during [fit](../../glossary.html#term-fit).
*/
get n_features_in_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing n_features_in_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_n_features_in_ = bridgeFeatureAgglomeration[${this.id}].n_features_in_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_n_features_in_.tolist() if hasattr(attr_FeatureAgglomeration_n_features_in_, 'tolist') else attr_FeatureAgglomeration_n_features_in_`
})()
}
/**
Names of features seen during [fit](../../glossary.html#term-fit). Defined only when `X` has feature names that are all strings.
*/
get feature_names_in_(): Promise<NDArray> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing feature_names_in_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_feature_names_in_ = bridgeFeatureAgglomeration[${this.id}].feature_names_in_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_feature_names_in_.tolist() if hasattr(attr_FeatureAgglomeration_feature_names_in_, 'tolist') else attr_FeatureAgglomeration_feature_names_in_`
})()
}
/**
The children of each non-leaf node. Values less than `n\_features` correspond to leaves of the tree which are the original samples. A node `i` greater than or equal to `n\_features` is a non-leaf node and has children `children\_\[i \- n\_features\]`. Alternatively at the i-th iteration, children\[i\]\[0\] and children\[i\]\[1\] are merged to form node `n\_features + i`.
*/
get children_(): Promise<ArrayLike[]> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing children_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_children_ = bridgeFeatureAgglomeration[${this.id}].children_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_children_.tolist() if hasattr(attr_FeatureAgglomeration_children_, 'tolist') else attr_FeatureAgglomeration_children_`
})()
}
/**
Distances between nodes in the corresponding place in `children\_`. Only computed if `distance\_threshold` is used or `compute\_distances` is set to `true`.
*/
get distances_(): Promise<ArrayLike> {
if (this._isDisposed) {
throw new Error(
'This FeatureAgglomeration instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'FeatureAgglomeration must call init() before accessing distances_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_FeatureAgglomeration_distances_ = bridgeFeatureAgglomeration[${this.id}].distances_`
// convert the result from python to node.js
return this
._py`attr_FeatureAgglomeration_distances_.tolist() if hasattr(attr_FeatureAgglomeration_distances_, 'tolist') else attr_FeatureAgglomeration_distances_`
})()
}
}