-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
RadiusNeighborsTransformer.ts
667 lines (540 loc) · 23 KB
/
RadiusNeighborsTransformer.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
/* 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'
/**
Transform X into a (weighted) graph of neighbors nearer than a radius.
The transformed data is a sparse graph as returned by `radius\_neighbors\_graph`.
Read more in the [User Guide](../neighbors.html#neighbors-transformer).
[Python Reference](https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.RadiusNeighborsTransformer.html)
*/
export class RadiusNeighborsTransformer {
id: string
opts: any
_py: PythonBridge
_isInitialized: boolean = false
_isDisposed: boolean = false
constructor(opts?: {
/**
Type of returned matrix: ‘connectivity’ will return the connectivity matrix with ones and zeros, and ‘distance’ will return the distances between neighbors according to the given metric.
@defaultValue `'distance'`
*/
mode?: 'distance' | 'connectivity'
/**
Radius of neighborhood in the transformed sparse graph.
@defaultValue `1`
*/
radius?: number
/**
Algorithm used to compute the nearest neighbors:
@defaultValue `'auto'`
*/
algorithm?: 'auto' | 'ball_tree' | 'kd_tree' | 'brute'
/**
Leaf size passed to BallTree or KDTree. This can affect the speed of the construction and query, as well as the memory required to store the tree. The optimal value depends on the nature of the problem.
@defaultValue `30`
*/
leaf_size?: number
/**
Metric to use for distance computation. Default is “minkowski”, which results in the standard Euclidean distance when p = 2. See the documentation of [scipy.spatial.distance](https://docs.scipy.org/doc/scipy/reference/spatial.distance.html) and the metrics listed in [`distance\_metrics`](sklearn.metrics.pairwise.distance_metrics.html#sklearn.metrics.pairwise.distance_metrics "sklearn.metrics.pairwise.distance_metrics") for valid metric values.
If metric is a callable function, it takes two arrays representing 1D vectors as inputs and must return one value indicating the distance between those vectors. This works for Scipy’s metrics, but is less efficient than passing the metric name as a string.
Distance matrices are not supported.
@defaultValue `'minkowski'`
*/
metric?: string
/**
Parameter for the Minkowski metric from sklearn.metrics.pairwise.pairwise\_distances. When p = 1, this is equivalent to using manhattan\_distance (l1), and euclidean\_distance (l2) for p = 2. For arbitrary p, minkowski\_distance (l\_p) is used.
@defaultValue `2`
*/
p?: number
/**
Additional keyword arguments for the metric function.
*/
metric_params?: any
/**
The number of parallel jobs to run for neighbors search. If `\-1`, then the number of jobs is set to the number of CPU cores.
*/
n_jobs?: number
}) {
this.id = `RadiusNeighborsTransformer${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 RadiusNeighborsTransformer instance has already been disposed'
)
}
if (this._isInitialized) {
return
}
if (!py) {
throw new Error(
'RadiusNeighborsTransformer.init requires a PythonBridge instance'
)
}
this._py = py
await this._py.ex`
import numpy as np
from sklearn.neighbors import RadiusNeighborsTransformer
try: bridgeRadiusNeighborsTransformer
except NameError: bridgeRadiusNeighborsTransformer = {}
`
// set up constructor params
await this._py.ex`ctor_RadiusNeighborsTransformer = {'mode': ${
this.opts['mode'] ?? undefined
}, 'radius': ${this.opts['radius'] ?? undefined}, 'algorithm': ${
this.opts['algorithm'] ?? undefined
}, 'leaf_size': ${this.opts['leaf_size'] ?? undefined}, 'metric': ${
this.opts['metric'] ?? undefined
}, 'p': ${this.opts['p'] ?? undefined}, 'metric_params': ${
this.opts['metric_params'] ?? undefined
}, 'n_jobs': ${this.opts['n_jobs'] ?? undefined}}
ctor_RadiusNeighborsTransformer = {k: v for k, v in ctor_RadiusNeighborsTransformer.items() if v is not None}`
await this._py
.ex`bridgeRadiusNeighborsTransformer[${this.id}] = RadiusNeighborsTransformer(**ctor_RadiusNeighborsTransformer)`
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 bridgeRadiusNeighborsTransformer[${this.id}]`
this._isDisposed = true
}
/**
Fit the radius neighbors transformer from the training dataset.
*/
async fit(opts: {
/**
Training data.
*/
X?: ArrayLike | SparseMatrix[]
/**
Not used, present for API consistency by convention.
*/
y?: any
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before fit()'
)
}
// set up method params
await this._py.ex`pms_RadiusNeighborsTransformer_fit = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None, 'y': ${opts['y'] ?? undefined}}
pms_RadiusNeighborsTransformer_fit = {k: v for k, v in pms_RadiusNeighborsTransformer_fit.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_fit = bridgeRadiusNeighborsTransformer[${this.id}].fit(**pms_RadiusNeighborsTransformer_fit)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_fit.tolist() if hasattr(res_RadiusNeighborsTransformer_fit, 'tolist') else res_RadiusNeighborsTransformer_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: {
/**
Training set.
*/
X?: ArrayLike[]
/**
Not used, present for API consistency by convention.
*/
y?: any
}): Promise<SparseMatrix[]> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before fit_transform()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_fit_transform = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None, 'y': ${opts['y'] ?? undefined}}
pms_RadiusNeighborsTransformer_fit_transform = {k: v for k, v in pms_RadiusNeighborsTransformer_fit_transform.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_fit_transform = bridgeRadiusNeighborsTransformer[${this.id}].fit_transform(**pms_RadiusNeighborsTransformer_fit_transform)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_fit_transform.tolist() if hasattr(res_RadiusNeighborsTransformer_fit_transform, 'tolist') else res_RadiusNeighborsTransformer_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 RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before get_feature_names_out()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_get_feature_names_out = {'input_features': ${
opts['input_features'] ?? undefined
}}
pms_RadiusNeighborsTransformer_get_feature_names_out = {k: v for k, v in pms_RadiusNeighborsTransformer_get_feature_names_out.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_get_feature_names_out = bridgeRadiusNeighborsTransformer[${this.id}].get_feature_names_out(**pms_RadiusNeighborsTransformer_get_feature_names_out)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_get_feature_names_out.tolist() if hasattr(res_RadiusNeighborsTransformer_get_feature_names_out, 'tolist') else res_RadiusNeighborsTransformer_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 RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before get_metadata_routing()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_get_metadata_routing = {'routing': ${
opts['routing'] ?? undefined
}}
pms_RadiusNeighborsTransformer_get_metadata_routing = {k: v for k, v in pms_RadiusNeighborsTransformer_get_metadata_routing.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_get_metadata_routing = bridgeRadiusNeighborsTransformer[${this.id}].get_metadata_routing(**pms_RadiusNeighborsTransformer_get_metadata_routing)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_get_metadata_routing.tolist() if hasattr(res_RadiusNeighborsTransformer_get_metadata_routing, 'tolist') else res_RadiusNeighborsTransformer_get_metadata_routing`
}
/**
Find the neighbors within a given radius of a point or points.
Return the indices and distances of each point from the dataset lying in a ball with size `radius` around the points of the query array. Points lying on the boundary are included in the results.
The result points are *not* necessarily sorted by distance to their query point.
*/
async radius_neighbors(opts: {
/**
The query point or points. If not provided, neighbors of each indexed point are returned. In this case, the query point is not considered its own neighbor.
*/
X?: any
/**
Limiting distance of neighbors to return. The default is the value passed to the constructor.
*/
radius?: number
/**
Whether or not to return the distances.
@defaultValue `true`
*/
return_distance?: boolean
/**
If `true`, the distances and indices will be sorted by increasing distances before being returned. If `false`, the results may not be sorted. If `return\_distance=False`, setting `sort\_results=True` will result in an error.
@defaultValue `false`
*/
sort_results?: boolean
}): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before radius_neighbors()'
)
}
// set up method params
await this._py.ex`pms_RadiusNeighborsTransformer_radius_neighbors = {'X': ${
opts['X'] ?? undefined
}, 'radius': ${opts['radius'] ?? undefined}, 'return_distance': ${
opts['return_distance'] ?? undefined
}, 'sort_results': ${opts['sort_results'] ?? undefined}}
pms_RadiusNeighborsTransformer_radius_neighbors = {k: v for k, v in pms_RadiusNeighborsTransformer_radius_neighbors.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_radius_neighbors = bridgeRadiusNeighborsTransformer[${this.id}].radius_neighbors(**pms_RadiusNeighborsTransformer_radius_neighbors)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_radius_neighbors.tolist() if hasattr(res_RadiusNeighborsTransformer_radius_neighbors, 'tolist') else res_RadiusNeighborsTransformer_radius_neighbors`
}
/**
Compute the (weighted) graph of Neighbors for points in X.
Neighborhoods are restricted the points at a distance lower than radius.
*/
async radius_neighbors_graph(opts: {
/**
The query point or points. If not provided, neighbors of each indexed point are returned. In this case, the query point is not considered its own neighbor.
*/
X?: ArrayLike | SparseMatrix[]
/**
Radius of neighborhoods. The default is the value passed to the constructor.
*/
radius?: number
/**
Type of returned matrix: ‘connectivity’ will return the connectivity matrix with ones and zeros, in ‘distance’ the edges are distances between points, type of distance depends on the selected metric parameter in NearestNeighbors class.
@defaultValue `'connectivity'`
*/
mode?: 'connectivity' | 'distance'
/**
If `true`, in each row of the result, the non-zero entries will be sorted by increasing distances. If `false`, the non-zero entries may not be sorted. Only used with mode=’distance’.
@defaultValue `false`
*/
sort_results?: boolean
}): Promise<any[]> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before radius_neighbors_graph()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_radius_neighbors_graph = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None, 'radius': ${
opts['radius'] ?? undefined
}, 'mode': ${opts['mode'] ?? undefined}, 'sort_results': ${
opts['sort_results'] ?? undefined
}}
pms_RadiusNeighborsTransformer_radius_neighbors_graph = {k: v for k, v in pms_RadiusNeighborsTransformer_radius_neighbors_graph.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_radius_neighbors_graph = bridgeRadiusNeighborsTransformer[${this.id}].radius_neighbors_graph(**pms_RadiusNeighborsTransformer_radius_neighbors_graph)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_radius_neighbors_graph.tolist() if hasattr(res_RadiusNeighborsTransformer_radius_neighbors_graph, 'tolist') else res_RadiusNeighborsTransformer_radius_neighbors_graph`
}
/**
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 RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before set_output()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_set_output = {'transform': ${
opts['transform'] ?? undefined
}}
pms_RadiusNeighborsTransformer_set_output = {k: v for k, v in pms_RadiusNeighborsTransformer_set_output.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_set_output = bridgeRadiusNeighborsTransformer[${this.id}].set_output(**pms_RadiusNeighborsTransformer_set_output)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_set_output.tolist() if hasattr(res_RadiusNeighborsTransformer_set_output, 'tolist') else res_RadiusNeighborsTransformer_set_output`
}
/**
Compute the (weighted) graph of Neighbors for points in X.
*/
async transform(opts: {
/**
Sample data.
*/
X?: ArrayLike[]
}): Promise<SparseMatrix[]> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before transform()'
)
}
// set up method params
await this._py
.ex`pms_RadiusNeighborsTransformer_transform = {'X': np.array(${
opts['X'] ?? undefined
}) if ${opts['X'] !== undefined} else None}
pms_RadiusNeighborsTransformer_transform = {k: v for k, v in pms_RadiusNeighborsTransformer_transform.items() if v is not None}`
// invoke method
await this._py
.ex`res_RadiusNeighborsTransformer_transform = bridgeRadiusNeighborsTransformer[${this.id}].transform(**pms_RadiusNeighborsTransformer_transform)`
// convert the result from python to node.js
return this
._py`res_RadiusNeighborsTransformer_transform.tolist() if hasattr(res_RadiusNeighborsTransformer_transform, 'tolist') else res_RadiusNeighborsTransformer_transform`
}
/**
The distance metric used. It will be same as the `metric` parameter or a synonym of it, e.g. ‘euclidean’ if the `metric` parameter set to ‘minkowski’ and `p` parameter set to 2.
*/
get effective_metric_(): Promise<string> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before accessing effective_metric_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_RadiusNeighborsTransformer_effective_metric_ = bridgeRadiusNeighborsTransformer[${this.id}].effective_metric_`
// convert the result from python to node.js
return this
._py`attr_RadiusNeighborsTransformer_effective_metric_.tolist() if hasattr(attr_RadiusNeighborsTransformer_effective_metric_, 'tolist') else attr_RadiusNeighborsTransformer_effective_metric_`
})()
}
/**
Additional keyword arguments for the metric function. For most metrics will be same with `metric\_params` parameter, but may also contain the `p` parameter value if the `effective\_metric\_` attribute is set to ‘minkowski’.
*/
get effective_metric_params_(): Promise<any> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before accessing effective_metric_params_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_RadiusNeighborsTransformer_effective_metric_params_ = bridgeRadiusNeighborsTransformer[${this.id}].effective_metric_params_`
// convert the result from python to node.js
return this
._py`attr_RadiusNeighborsTransformer_effective_metric_params_.tolist() if hasattr(attr_RadiusNeighborsTransformer_effective_metric_params_, 'tolist') else attr_RadiusNeighborsTransformer_effective_metric_params_`
})()
}
/**
Number of features seen during [fit](../../glossary.html#term-fit).
*/
get n_features_in_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before accessing n_features_in_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_RadiusNeighborsTransformer_n_features_in_ = bridgeRadiusNeighborsTransformer[${this.id}].n_features_in_`
// convert the result from python to node.js
return this
._py`attr_RadiusNeighborsTransformer_n_features_in_.tolist() if hasattr(attr_RadiusNeighborsTransformer_n_features_in_, 'tolist') else attr_RadiusNeighborsTransformer_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 RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before accessing feature_names_in_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_RadiusNeighborsTransformer_feature_names_in_ = bridgeRadiusNeighborsTransformer[${this.id}].feature_names_in_`
// convert the result from python to node.js
return this
._py`attr_RadiusNeighborsTransformer_feature_names_in_.tolist() if hasattr(attr_RadiusNeighborsTransformer_feature_names_in_, 'tolist') else attr_RadiusNeighborsTransformer_feature_names_in_`
})()
}
/**
Number of samples in the fitted data.
*/
get n_samples_fit_(): Promise<number> {
if (this._isDisposed) {
throw new Error(
'This RadiusNeighborsTransformer instance has already been disposed'
)
}
if (!this._isInitialized) {
throw new Error(
'RadiusNeighborsTransformer must call init() before accessing n_samples_fit_'
)
}
return (async () => {
// invoke accessor
await this._py
.ex`attr_RadiusNeighborsTransformer_n_samples_fit_ = bridgeRadiusNeighborsTransformer[${this.id}].n_samples_fit_`
// convert the result from python to node.js
return this
._py`attr_RadiusNeighborsTransformer_n_samples_fit_.tolist() if hasattr(attr_RadiusNeighborsTransformer_n_samples_fit_, 'tolist') else attr_RadiusNeighborsTransformer_n_samples_fit_`
})()
}
}