@elaraai/east-py-datascience 0.0.2-beta.8 → 0.0.2-beta.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +58 -1
  2. package/dist/src/alns/alns.d.ts +528 -0
  3. package/dist/src/alns/alns.d.ts.map +1 -0
  4. package/dist/src/alns/alns.js +238 -0
  5. package/dist/src/alns/alns.js.map +1 -0
  6. package/dist/src/google_or/google_or.d.ts +2422 -0
  7. package/dist/src/google_or/google_or.d.ts.map +1 -0
  8. package/dist/src/google_or/google_or.js +542 -0
  9. package/dist/src/google_or/google_or.js.map +1 -0
  10. package/dist/{gp → src/gp}/gp.d.ts +185 -136
  11. package/dist/src/gp/gp.d.ts.map +1 -0
  12. package/dist/{gp → src/gp}/gp.js +64 -12
  13. package/dist/src/gp/gp.js.map +1 -0
  14. package/dist/src/index.d.ts +34 -0
  15. package/dist/src/index.d.ts.map +1 -0
  16. package/dist/src/index.js +57 -0
  17. package/dist/src/index.js.map +1 -0
  18. package/dist/src/lightgbm/lightgbm.d.ts +575 -0
  19. package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
  20. package/dist/{lightgbm → src/lightgbm}/lightgbm.js +104 -18
  21. package/dist/src/lightgbm/lightgbm.js.map +1 -0
  22. package/dist/src/lightning/lightning.d.ts +1594 -0
  23. package/dist/src/lightning/lightning.d.ts.map +1 -0
  24. package/dist/src/lightning/lightning.js +468 -0
  25. package/dist/src/lightning/lightning.js.map +1 -0
  26. package/dist/{mads → src/mads}/mads.d.ts +109 -112
  27. package/dist/src/mads/mads.d.ts.map +1 -0
  28. package/dist/{mads → src/mads}/mads.js +6 -8
  29. package/dist/src/mads/mads.js.map +1 -0
  30. package/dist/src/mapie/mapie.d.ts +3680 -0
  31. package/dist/src/mapie/mapie.d.ts.map +1 -0
  32. package/dist/src/mapie/mapie.js +616 -0
  33. package/dist/src/mapie/mapie.js.map +1 -0
  34. package/dist/{ngboost → src/ngboost}/ngboost.d.ts +192 -142
  35. package/dist/src/ngboost/ngboost.d.ts.map +1 -0
  36. package/dist/{ngboost → src/ngboost}/ngboost.js +67 -14
  37. package/dist/src/ngboost/ngboost.js.map +1 -0
  38. package/dist/src/optimization/optimization.d.ts +420 -0
  39. package/dist/src/optimization/optimization.d.ts.map +1 -0
  40. package/dist/src/optimization/optimization.js +257 -0
  41. package/dist/src/optimization/optimization.js.map +1 -0
  42. package/dist/{optuna → src/optuna}/optuna.d.ts +374 -314
  43. package/dist/src/optuna/optuna.d.ts.map +1 -0
  44. package/dist/{optuna → src/optuna}/optuna.js +2 -0
  45. package/dist/src/optuna/optuna.js.map +1 -0
  46. package/dist/src/pymc/pymc.d.ts +2932 -0
  47. package/dist/src/pymc/pymc.d.ts.map +1 -0
  48. package/dist/src/pymc/pymc.js +688 -0
  49. package/dist/src/pymc/pymc.js.map +1 -0
  50. package/dist/src/scipy/scipy.d.ts +2205 -0
  51. package/dist/src/scipy/scipy.d.ts.map +1 -0
  52. package/dist/src/scipy/scipy.js +884 -0
  53. package/dist/src/scipy/scipy.js.map +1 -0
  54. package/dist/src/shap/shap.d.ts +2988 -0
  55. package/dist/src/shap/shap.d.ts.map +1 -0
  56. package/dist/src/shap/shap.js +500 -0
  57. package/dist/src/shap/shap.js.map +1 -0
  58. package/dist/{simanneal → src/simanneal}/simanneal.d.ts +257 -160
  59. package/dist/src/simanneal/simanneal.d.ts.map +1 -0
  60. package/dist/{simanneal → src/simanneal}/simanneal.js +105 -8
  61. package/dist/src/simanneal/simanneal.js.map +1 -0
  62. package/dist/src/simulation/simulation.d.ts +431 -0
  63. package/dist/src/simulation/simulation.d.ts.map +1 -0
  64. package/dist/src/simulation/simulation.js +306 -0
  65. package/dist/src/simulation/simulation.js.map +1 -0
  66. package/dist/src/sklearn/sklearn.d.ts +6362 -0
  67. package/dist/src/sklearn/sklearn.d.ts.map +1 -0
  68. package/dist/src/sklearn/sklearn.js +1508 -0
  69. package/dist/src/sklearn/sklearn.js.map +1 -0
  70. package/dist/src/torch/torch.d.ts +1205 -0
  71. package/dist/src/torch/torch.d.ts.map +1 -0
  72. package/dist/{torch → src/torch}/torch.js +109 -18
  73. package/dist/src/torch/torch.js.map +1 -0
  74. package/dist/src/types.d.ts +43 -0
  75. package/dist/src/types.d.ts.map +1 -0
  76. package/dist/src/types.js +44 -0
  77. package/dist/src/types.js.map +1 -0
  78. package/dist/src/xgboost/xgboost.d.ts +1424 -0
  79. package/dist/src/xgboost/xgboost.d.ts.map +1 -0
  80. package/dist/src/xgboost/xgboost.js +432 -0
  81. package/dist/src/xgboost/xgboost.js.map +1 -0
  82. package/package.json +12 -12
  83. package/dist/gp/gp.d.ts.map +0 -1
  84. package/dist/gp/gp.js.map +0 -1
  85. package/dist/index.d.ts +0 -27
  86. package/dist/index.d.ts.map +0 -1
  87. package/dist/index.js +0 -41
  88. package/dist/index.js.map +0 -1
  89. package/dist/lightgbm/lightgbm.d.ts +0 -494
  90. package/dist/lightgbm/lightgbm.d.ts.map +0 -1
  91. package/dist/lightgbm/lightgbm.js.map +0 -1
  92. package/dist/mads/mads.d.ts.map +0 -1
  93. package/dist/mads/mads.js.map +0 -1
  94. package/dist/ngboost/ngboost.d.ts.map +0 -1
  95. package/dist/ngboost/ngboost.js.map +0 -1
  96. package/dist/optuna/optuna.d.ts.map +0 -1
  97. package/dist/optuna/optuna.js.map +0 -1
  98. package/dist/scipy/scipy.d.ts +0 -1260
  99. package/dist/scipy/scipy.d.ts.map +0 -1
  100. package/dist/scipy/scipy.js +0 -413
  101. package/dist/scipy/scipy.js.map +0 -1
  102. package/dist/shap/shap.d.ts +0 -657
  103. package/dist/shap/shap.d.ts.map +0 -1
  104. package/dist/shap/shap.js +0 -241
  105. package/dist/shap/shap.js.map +0 -1
  106. package/dist/simanneal/simanneal.d.ts.map +0 -1
  107. package/dist/simanneal/simanneal.js.map +0 -1
  108. package/dist/sklearn/sklearn.d.ts +0 -2691
  109. package/dist/sklearn/sklearn.d.ts.map +0 -1
  110. package/dist/sklearn/sklearn.js +0 -524
  111. package/dist/sklearn/sklearn.js.map +0 -1
  112. package/dist/torch/torch.d.ts +0 -1081
  113. package/dist/torch/torch.d.ts.map +0 -1
  114. package/dist/torch/torch.js.map +0 -1
  115. package/dist/tsconfig.tsbuildinfo +0 -1
  116. package/dist/types.d.ts +0 -80
  117. package/dist/types.d.ts.map +0 -1
  118. package/dist/types.js +0 -81
  119. package/dist/types.js.map +0 -1
  120. package/dist/xgboost/xgboost.d.ts +0 -504
  121. package/dist/xgboost/xgboost.d.ts.map +0 -1
  122. package/dist/xgboost/xgboost.js +0 -177
  123. package/dist/xgboost/xgboost.js.map +0 -1
@@ -0,0 +1,884 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * SciPy platform functions for East.
7
+ *
8
+ * Provides scientific computing utilities: statistics, optimization,
9
+ * interpolation, and curve fitting.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { East, StructType, VariantType, OptionType, IntegerType, BooleanType, FloatType, StringType, BlobType, NullType, FunctionType, } from "@elaraai/east";
14
+ import { VectorType, MatrixType, ScalarObjectiveType } from "../types.js";
15
+ // Re-export shared types for convenience
16
+ export { VectorType, MatrixType, ScalarObjectiveType } from "../types.js";
17
+ // ============================================================================
18
+ // Enum Types
19
+ // ============================================================================
20
+ /**
21
+ * Optimization method for scipy.optimize.minimize.
22
+ */
23
+ export const OptimizeMethodType = VariantType({
24
+ /** BFGS algorithm */
25
+ bfgs: NullType,
26
+ /** L-BFGS-B algorithm (default) */
27
+ l_bfgs_b: NullType,
28
+ /** Nelder-Mead simplex */
29
+ nelder_mead: NullType,
30
+ /** Powell's method */
31
+ powell: NullType,
32
+ /** Conjugate gradient */
33
+ cg: NullType,
34
+ });
35
+ /**
36
+ * Interpolation method for scipy.interpolate.interp1d.
37
+ */
38
+ export const InterpolationKindType = VariantType({
39
+ /** Linear interpolation (default) */
40
+ linear: NullType,
41
+ /** Cubic interpolation */
42
+ cubic: NullType,
43
+ /** Quadratic interpolation */
44
+ quadratic: NullType,
45
+ });
46
+ /**
47
+ * Histogram bin selection method for numpy.histogram.
48
+ */
49
+ export const HistogramBinMethodType = VariantType({
50
+ /** Maximum of Sturges and FD estimators */
51
+ auto: NullType,
52
+ /** Freedman-Diaconis estimator */
53
+ fd: NullType,
54
+ /** Sturges estimator */
55
+ sturges: NullType,
56
+ /** Scott's normal reference rule */
57
+ scott: NullType,
58
+ /** Rice estimator */
59
+ rice: NullType,
60
+ /** Square root estimator */
61
+ sqrt: NullType,
62
+ /** Doane's estimator */
63
+ doane: NullType,
64
+ });
65
+ /**
66
+ * Bandwidth selection method for KDE.
67
+ */
68
+ export const KdeBandwidthMethodType = VariantType({
69
+ /** Scott's rule of thumb (default) */
70
+ scott: NullType,
71
+ /** Silverman's rule of thumb */
72
+ silverman: NullType,
73
+ });
74
+ // ============================================================================
75
+ // Config Types
76
+ // ============================================================================
77
+ /**
78
+ * Configuration for scipy.optimize.minimize.
79
+ */
80
+ export const OptimizeConfigType = StructType({
81
+ /** Optimization method */
82
+ method: OptionType(OptimizeMethodType),
83
+ /** Maximum number of iterations */
84
+ max_iter: OptionType(IntegerType),
85
+ /** Tolerance for convergence */
86
+ tol: OptionType(FloatType),
87
+ });
88
+ /**
89
+ * Configuration for scipy.interpolate.interp1d.
90
+ */
91
+ export const InterpolateConfigType = StructType({
92
+ /** Interpolation method */
93
+ kind: OptionType(InterpolationKindType),
94
+ });
95
+ /**
96
+ * Parameter bounds for curve fitting.
97
+ */
98
+ export const ParamBoundsType = StructType({
99
+ /** Lower bounds for each parameter */
100
+ lower: VectorType(FloatType),
101
+ /** Upper bounds for each parameter */
102
+ upper: VectorType(FloatType),
103
+ });
104
+ /**
105
+ * Custom curve function type: (x: Float, params: Vector, fixed_params: Vector) -> Float
106
+ * The params are optimized, fixed_params are passed through unchanged.
107
+ * If no fixed_params provided in config, an empty vector is passed.
108
+ */
109
+ export const CustomCurveFunctionType = FunctionType([FloatType, VectorType(FloatType), VectorType(FloatType)], FloatType);
110
+ /**
111
+ * Curve function type for scipy_curve_fit.
112
+ *
113
+ * Includes built-in standard mathematical functions and a custom option
114
+ * for user-defined functions.
115
+ */
116
+ export const CurveFunctionType = VariantType({
117
+ /** y = a * exp(-b * x), 2 params: [a, b] */
118
+ exponential_decay: NullType,
119
+ /** y = a + b * exp(-c * x), 3 params: [a, b, c] */
120
+ exponential_with_offset: NullType,
121
+ /** y = a * exp(b * x), 2 params: [a, b] */
122
+ exponential_growth: NullType,
123
+ /** y = L / (1 + exp(-k * (x - x0))), 3 params: [L, k, x0] */
124
+ logistic: NullType,
125
+ /** y = a * exp(-b * exp(-c * x)), 3 params: [a, b, c] */
126
+ gompertz: NullType,
127
+ /** y = a * x^b, 2 params: [a, b] */
128
+ power_law: NullType,
129
+ /** y = a + b * x, 2 params: [a, b] */
130
+ linear: NullType,
131
+ /** y = a + b*x + c*x^2, 3 params: [a, b, c] */
132
+ quadratic: NullType,
133
+ /** y = a + b*x + c*x^2 + d*x^3, 4 params: [a, b, c, d] */
134
+ cubic: NullType,
135
+ /** Custom function provided by user */
136
+ custom: StructType({
137
+ /** The curve function: (x, params, fixed_params) -> y */
138
+ fn: CustomCurveFunctionType,
139
+ /** Number of parameters to optimize */
140
+ n_params: IntegerType,
141
+ /** Optional parameter bounds */
142
+ param_bounds: OptionType(ParamBoundsType),
143
+ /** Optional fixed parameters passed to fn but not optimized */
144
+ fixed_params: OptionType(VectorType(FloatType)),
145
+ }),
146
+ });
147
+ /**
148
+ * Configuration for curve fitting.
149
+ */
150
+ export const CurveFitConfigType = StructType({
151
+ /** Maximum number of function evaluations */
152
+ max_iter: OptionType(IntegerType),
153
+ /** Initial guess for parameters */
154
+ initial_guess: OptionType(VectorType(FloatType)),
155
+ });
156
+ /**
157
+ * Configuration for histogram computation.
158
+ */
159
+ export const HistogramConfigType = StructType({
160
+ /** Number of bins (default 10) */
161
+ bins: OptionType(IntegerType),
162
+ /** Auto bin method (overrides bins if set) */
163
+ bin_method: OptionType(HistogramBinMethodType),
164
+ /** Lower bound */
165
+ range_min: OptionType(FloatType),
166
+ /** Upper bound */
167
+ range_max: OptionType(FloatType),
168
+ /** Normalize to probability density */
169
+ density: OptionType(BooleanType),
170
+ /** Per-element weights */
171
+ weights: OptionType(VectorType(FloatType)),
172
+ });
173
+ /**
174
+ * Configuration for Kernel Density Estimation.
175
+ */
176
+ export const KdeConfigType = StructType({
177
+ /** Bandwidth selection method (default scott) */
178
+ bandwidth: OptionType(KdeBandwidthMethodType),
179
+ /** Custom scalar bandwidth (overrides method if set) */
180
+ bandwidth_scalar: OptionType(FloatType),
181
+ /** Per-datapoint weights */
182
+ weights: OptionType(VectorType(FloatType)),
183
+ });
184
+ /**
185
+ * Configuration for quadratic optimization: f(x) = 0.5 * x'Ax + b'x + c
186
+ */
187
+ export const QuadraticConfigType = StructType({
188
+ /** Quadratic term (symmetric positive definite) */
189
+ A: MatrixType(FloatType),
190
+ /** Linear term */
191
+ b: VectorType(FloatType),
192
+ /** Constant term */
193
+ c: FloatType,
194
+ });
195
+ // ============================================================================
196
+ // Result Types
197
+ // ============================================================================
198
+ /**
199
+ * Descriptive statistics result.
200
+ */
201
+ export const StatsDescribeResultType = StructType({
202
+ /** Number of observations */
203
+ count: IntegerType,
204
+ /** Mean value */
205
+ mean: FloatType,
206
+ /** Variance */
207
+ variance: FloatType,
208
+ /** Skewness */
209
+ skewness: FloatType,
210
+ /** Kurtosis */
211
+ kurtosis: FloatType,
212
+ /** Minimum value */
213
+ min: FloatType,
214
+ /** Maximum value */
215
+ max: FloatType,
216
+ });
217
+ /**
218
+ * Robust statistics result (median-based, outlier-resistant).
219
+ */
220
+ export const RobustStatsResultType = StructType({
221
+ /** Median value */
222
+ median: FloatType,
223
+ /** Interquartile range (Q3 - Q1) */
224
+ iqr: FloatType,
225
+ /** Median absolute deviation */
226
+ mad: FloatType,
227
+ /** 25th percentile */
228
+ q1: FloatType,
229
+ /** 75th percentile */
230
+ q3: FloatType,
231
+ });
232
+ /**
233
+ * Correlation result (Pearson or Spearman).
234
+ */
235
+ export const CorrelationResultType = StructType({
236
+ /** Correlation coefficient */
237
+ correlation: FloatType,
238
+ /** P-value for hypothesis test */
239
+ pvalue: FloatType,
240
+ });
241
+ /**
242
+ * Curve fitting result.
243
+ */
244
+ export const CurveFitResultType = StructType({
245
+ /** Fitted parameters */
246
+ params: VectorType(FloatType),
247
+ /** Whether fit converged */
248
+ success: BooleanType,
249
+ /** Coefficient of determination (R²) */
250
+ r_squared: FloatType,
251
+ });
252
+ /**
253
+ * Optimization result.
254
+ */
255
+ export const OptimizeResultType = StructType({
256
+ /** Optimal parameters */
257
+ x: VectorType(FloatType),
258
+ /** Function value at optimum */
259
+ fun: FloatType,
260
+ /** Whether optimization succeeded */
261
+ success: BooleanType,
262
+ /** Number of iterations */
263
+ nit: IntegerType,
264
+ });
265
+ /**
266
+ * Histogram computation result.
267
+ */
268
+ export const HistogramResultType = StructType({
269
+ /** Bin values (float to support density mode) */
270
+ counts: VectorType(FloatType),
271
+ /** Bin edges (length = len(counts) + 1) */
272
+ bin_edges: VectorType(FloatType),
273
+ });
274
+ /**
275
+ * KDE fitting result metadata.
276
+ */
277
+ export const KdeResultType = StructType({
278
+ /** Actual bandwidth factor used */
279
+ bandwidth: FloatType,
280
+ /** Minimum of training data */
281
+ data_min: FloatType,
282
+ /** Maximum of training data */
283
+ data_max: FloatType,
284
+ });
285
+ /**
286
+ * Model blob type for scipy models.
287
+ */
288
+ export const ScipyModelBlobType = VariantType({
289
+ /** 1D interpolator (cloudpickle serialized) */
290
+ scipy_interp_1d: StructType({
291
+ /** Serialized interpolator */
292
+ data: BlobType,
293
+ /** Interpolation method used */
294
+ kind: InterpolationKindType,
295
+ }),
296
+ /** KDE model (cloudpickle serialized) */
297
+ scipy_kde: StructType({
298
+ /** Serialized KDE model */
299
+ data: BlobType,
300
+ /** KDE metadata */
301
+ metadata: KdeResultType,
302
+ }),
303
+ });
304
+ // ============================================================================
305
+ // Dual Annealing Types
306
+ // ============================================================================
307
+ /**
308
+ * Bounds for dual annealing optimization (required).
309
+ */
310
+ export const DualAnnealBoundsType = StructType({
311
+ /** Lower bounds for each variable */
312
+ lower: VectorType(FloatType),
313
+ /** Upper bounds for each variable */
314
+ upper: VectorType(FloatType),
315
+ });
316
+ /**
317
+ * Configuration for scipy.optimize.dual_annealing.
318
+ *
319
+ * Combines generalized simulated annealing with local search.
320
+ * Much faster than pure Python simanneal for continuous optimization.
321
+ */
322
+ export const DualAnnealConfigType = StructType({
323
+ /** Maximum function evaluations (default: 1000) */
324
+ maxfun: OptionType(IntegerType),
325
+ /** Maximum iterations (default: 1000) */
326
+ maxiter: OptionType(IntegerType),
327
+ /** Initial temperature (default: 5230) */
328
+ initial_temp: OptionType(FloatType),
329
+ /** Temperature restart threshold (default: 2e-5) */
330
+ restart_temp_ratio: OptionType(FloatType),
331
+ /** Visiting distribution parameter (default: 2.62) */
332
+ visit: OptionType(FloatType),
333
+ /** Acceptance distribution parameter (default: -5.0) */
334
+ accept: OptionType(FloatType),
335
+ /** Random seed for reproducibility */
336
+ seed: OptionType(IntegerType),
337
+ /** Disable local search for speed (default: false) */
338
+ no_local_search: OptionType(BooleanType),
339
+ });
340
+ /**
341
+ * Result from dual annealing optimization.
342
+ */
343
+ export const DualAnnealResultType = StructType({
344
+ /** Best solution found */
345
+ x: VectorType(FloatType),
346
+ /** Best objective value */
347
+ fun: FloatType,
348
+ /** Number of function evaluations */
349
+ nfev: IntegerType,
350
+ /** Number of iterations */
351
+ nit: IntegerType,
352
+ /** Whether optimization succeeded */
353
+ success: BooleanType,
354
+ /** Status message */
355
+ message: StringType,
356
+ });
357
+ // ============================================================================
358
+ // Platform Functions
359
+ // ============================================================================
360
+ /**
361
+ * Fit a parametric curve to data using nonlinear least squares.
362
+ */
363
+ export const scipy_curve_fit = East.platform("scipy_curve_fit", [CurveFunctionType, VectorType(FloatType), VectorType(FloatType), CurveFitConfigType], CurveFitResultType);
364
+ /**
365
+ * Compute descriptive statistics for data.
366
+ */
367
+ export const scipy_stats_describe = East.platform("scipy_stats_describe", [VectorType(FloatType)], StatsDescribeResultType);
368
+ /**
369
+ * Compute Pearson correlation coefficient.
370
+ */
371
+ export const scipy_stats_pearsonr = East.platform("scipy_stats_pearsonr", [VectorType(FloatType), VectorType(FloatType)], CorrelationResultType);
372
+ /**
373
+ * Compute Spearman rank correlation.
374
+ */
375
+ export const scipy_stats_spearmanr = East.platform("scipy_stats_spearmanr", [VectorType(FloatType), VectorType(FloatType)], CorrelationResultType);
376
+ /**
377
+ * Compute percentiles of data.
378
+ * @param data - Input data vector
379
+ * @param percentiles - Percentile values to compute (0-100)
380
+ * @returns Values at the specified percentiles
381
+ */
382
+ export const scipy_stats_percentile = East.platform("scipy_stats_percentile", [VectorType(FloatType), VectorType(FloatType)], VectorType(FloatType));
383
+ /**
384
+ * Compute the percentile rank of a score relative to a dataset.
385
+ * @param data - Reference data vector
386
+ * @param score - Value to compute the percentile rank for
387
+ * @returns Percentile rank (0-100)
388
+ */
389
+ export const scipy_stats_percentileofscore = East.platform("scipy_stats_percentileofscore", [VectorType(FloatType), FloatType], FloatType);
390
+ /**
391
+ * Compute interquartile range (Q3 - Q1).
392
+ */
393
+ export const scipy_stats_iqr = East.platform("scipy_stats_iqr", [VectorType(FloatType)], FloatType);
394
+ /**
395
+ * Compute median value.
396
+ */
397
+ export const scipy_stats_median = East.platform("scipy_stats_median", [VectorType(FloatType)], FloatType);
398
+ /**
399
+ * Compute median absolute deviation (robust std estimate).
400
+ */
401
+ export const scipy_stats_mad = East.platform("scipy_stats_mad", [VectorType(FloatType)], FloatType);
402
+ /**
403
+ * Compute robust statistics in one call (median, iqr, mad, q1, q3).
404
+ */
405
+ export const scipy_stats_robust = East.platform("scipy_stats_robust", [VectorType(FloatType)], RobustStatsResultType);
406
+ /**
407
+ * Fit 1D interpolator to data.
408
+ */
409
+ export const scipy_interpolate_1d_fit = East.platform("scipy_interpolate_1d_fit", [VectorType(FloatType), VectorType(FloatType), InterpolateConfigType], ScipyModelBlobType);
410
+ /**
411
+ * Evaluate 1D interpolator at given points.
412
+ */
413
+ export const scipy_interpolate_1d_predict = East.platform("scipy_interpolate_1d_predict", [ScipyModelBlobType, VectorType(FloatType)], VectorType(FloatType));
414
+ /**
415
+ * Minimize a scalar function using scipy.optimize.minimize.
416
+ */
417
+ export const scipy_optimize_minimize = East.platform("scipy_optimize_minimize", [ScalarObjectiveType, VectorType(FloatType), OptimizeConfigType], OptimizeResultType);
418
+ /**
419
+ * Minimize a quadratic function with analytical gradient.
420
+ */
421
+ export const scipy_optimize_minimize_quadratic = East.platform("scipy_optimize_minimize_quadratic", [VectorType(FloatType), QuadraticConfigType, OptimizeConfigType], OptimizeResultType);
422
+ /**
423
+ * Global optimization using dual annealing.
424
+ *
425
+ * Combines generalized simulated annealing with local search.
426
+ * Much faster than simanneal for continuous optimization problems.
427
+ * Effective for non-convex problems with many local minima.
428
+ *
429
+ * @param objective_fn - Function to minimize: Vector -> Float
430
+ * @param x0 - Optional initial guess (if none, starts from bounds center)
431
+ * @param bounds - Required bounds for all variables
432
+ * @param config - Algorithm configuration
433
+ * @returns Optimization result with best solution
434
+ */
435
+ export const scipy_optimize_dual_annealing = East.platform("scipy_optimize_dual_annealing", [
436
+ ScalarObjectiveType,
437
+ OptionType(VectorType(FloatType)),
438
+ DualAnnealBoundsType,
439
+ DualAnnealConfigType,
440
+ ], DualAnnealResultType);
441
+ /**
442
+ * Compute histogram of data using numpy.histogram.
443
+ */
444
+ export const scipy_histogram = East.platform("scipy_histogram", [VectorType(FloatType), HistogramConfigType], HistogramResultType);
445
+ /**
446
+ * Fit a Kernel Density Estimator to data.
447
+ */
448
+ export const scipy_kde_fit = East.platform("scipy_kde_fit", [VectorType(FloatType), KdeConfigType], ScipyModelBlobType);
449
+ /**
450
+ * Evaluate a fitted KDE model at given points.
451
+ */
452
+ export const scipy_kde_evaluate = East.platform("scipy_kde_evaluate", [ScipyModelBlobType, VectorType(FloatType)], VectorType(FloatType));
453
+ // ============================================================================
454
+ // Grouped Export
455
+ // ============================================================================
456
+ /**
457
+ * Type definitions for scipy functions.
458
+ */
459
+ export const ScipyTypes = {
460
+ ScalarObjectiveType,
461
+ OptimizeMethodType,
462
+ InterpolationKindType,
463
+ HistogramBinMethodType,
464
+ KdeBandwidthMethodType,
465
+ OptimizeConfigType,
466
+ InterpolateConfigType,
467
+ HistogramConfigType,
468
+ KdeConfigType,
469
+ ParamBoundsType,
470
+ CustomCurveFunctionType,
471
+ CurveFunctionType,
472
+ CurveFitConfigType,
473
+ QuadraticConfigType,
474
+ StatsDescribeResultType,
475
+ RobustStatsResultType,
476
+ CorrelationResultType,
477
+ CurveFitResultType,
478
+ OptimizeResultType,
479
+ HistogramResultType,
480
+ KdeResultType,
481
+ ModelBlobType: ScipyModelBlobType,
482
+ DualAnnealBoundsType,
483
+ DualAnnealConfigType,
484
+ DualAnnealResultType,
485
+ };
486
+ /**
487
+ * SciPy scientific computing utilities.
488
+ *
489
+ * Provides statistics, optimization, interpolation, and curve fitting.
490
+ */
491
+ export const Scipy = {
492
+ /**
493
+ * Fit a parametric curve to data using nonlinear least squares.
494
+ *
495
+ * @example
496
+ * ```ts
497
+ * import { East, FloatType, variant } from "@elaraai/east";
498
+ * import { Scipy, VectorType, CurveFitConfigType } from "@elaraai/east-py-datascience";
499
+ *
500
+ * const fit = East.function(
501
+ * [VectorType(FloatType), VectorType(FloatType)],
502
+ * Scipy.Types.CurveFitResultType,
503
+ * ($, x, y) => {
504
+ * const func = $.let(variant("exponential_decay", null), Scipy.Types.CurveFunctionType);
505
+ * const config = $.let({
506
+ * max_iter: variant("none", null),
507
+ * initial_guess: variant("none", null),
508
+ * }, CurveFitConfigType);
509
+ * return $.return(Scipy.curveFit(func, x, y, config));
510
+ * }
511
+ * );
512
+ * ```
513
+ */
514
+ curveFit: scipy_curve_fit,
515
+ /**
516
+ * Compute descriptive statistics for data.
517
+ *
518
+ * @example
519
+ * ```ts
520
+ * import { East, FloatType } from "@elaraai/east";
521
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
522
+ *
523
+ * const describe = East.function(
524
+ * [VectorType(FloatType)],
525
+ * Scipy.Types.StatsDescribeResultType,
526
+ * ($, data) => {
527
+ * const result = $.let(Scipy.statsDescribe(data));
528
+ * // result.mean, result.variance, result.skewness, etc.
529
+ * return $.return(result);
530
+ * }
531
+ * );
532
+ * ```
533
+ */
534
+ statsDescribe: scipy_stats_describe,
535
+ /**
536
+ * Compute Pearson correlation coefficient.
537
+ *
538
+ * @example
539
+ * ```ts
540
+ * import { East, FloatType } from "@elaraai/east";
541
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
542
+ *
543
+ * const correlate = East.function(
544
+ * [VectorType(FloatType), VectorType(FloatType)],
545
+ * Scipy.Types.CorrelationResultType,
546
+ * ($, x, y) => {
547
+ * const result = $.let(Scipy.statsPearsonr(x, y));
548
+ * // result.correlation, result.pvalue
549
+ * return $.return(result);
550
+ * }
551
+ * );
552
+ * ```
553
+ */
554
+ statsPearsonr: scipy_stats_pearsonr,
555
+ /**
556
+ * Compute Spearman rank correlation.
557
+ *
558
+ * @example
559
+ * ```ts
560
+ * import { East, FloatType } from "@elaraai/east";
561
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
562
+ *
563
+ * const correlate = East.function(
564
+ * [VectorType(FloatType), VectorType(FloatType)],
565
+ * Scipy.Types.CorrelationResultType,
566
+ * ($, x, y) => {
567
+ * const result = $.let(Scipy.statsSpearmanr(x, y));
568
+ * // result.correlation, result.pvalue
569
+ * return $.return(result);
570
+ * }
571
+ * );
572
+ * ```
573
+ */
574
+ statsSpearmanr: scipy_stats_spearmanr,
575
+ /**
576
+ * Compute percentiles of data.
577
+ *
578
+ * @example
579
+ * ```ts
580
+ * import { East, FloatType } from "@elaraai/east";
581
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
582
+ *
583
+ * const getPercentiles = East.function(
584
+ * [VectorType(FloatType)],
585
+ * VectorType(FloatType),
586
+ * ($, data) => {
587
+ * const percentiles = $.let(new Float64Array([25.0, 50.0, 75.0]));
588
+ * return $.return(Scipy.statsPercentile(data, percentiles));
589
+ * }
590
+ * );
591
+ * ```
592
+ */
593
+ statsPercentile: scipy_stats_percentile,
594
+ /**
595
+ * Compute the percentile rank of a score relative to a dataset.
596
+ *
597
+ * @example
598
+ * ```ts
599
+ * import { East, FloatType } from "@elaraai/east";
600
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
601
+ *
602
+ * const getPctRank = East.function(
603
+ * [VectorType(FloatType), FloatType],
604
+ * FloatType,
605
+ * ($, data, score) => {
606
+ * return $.return(Scipy.statsPercentileOfScore(data, score));
607
+ * }
608
+ * );
609
+ * ```
610
+ */
611
+ statsPercentileOfScore: scipy_stats_percentileofscore,
612
+ /**
613
+ * Compute interquartile range (Q3 - Q1).
614
+ *
615
+ * @example
616
+ * ```ts
617
+ * import { East, FloatType } from "@elaraai/east";
618
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
619
+ *
620
+ * const getIqr = East.function(
621
+ * [VectorType(FloatType)],
622
+ * FloatType,
623
+ * ($, data) => {
624
+ * return $.return(Scipy.statsIqr(data));
625
+ * }
626
+ * );
627
+ * ```
628
+ */
629
+ statsIqr: scipy_stats_iqr,
630
+ /**
631
+ * Compute median value.
632
+ *
633
+ * @example
634
+ * ```ts
635
+ * import { East, FloatType } from "@elaraai/east";
636
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
637
+ *
638
+ * const getMedian = East.function(
639
+ * [VectorType(FloatType)],
640
+ * FloatType,
641
+ * ($, data) => {
642
+ * return $.return(Scipy.statsMedian(data));
643
+ * }
644
+ * );
645
+ * ```
646
+ */
647
+ statsMedian: scipy_stats_median,
648
+ /**
649
+ * Compute median absolute deviation (robust std estimate).
650
+ *
651
+ * @example
652
+ * ```ts
653
+ * import { East, FloatType } from "@elaraai/east";
654
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
655
+ *
656
+ * const getMad = East.function(
657
+ * [VectorType(FloatType)],
658
+ * FloatType,
659
+ * ($, data) => {
660
+ * return $.return(Scipy.statsMad(data));
661
+ * }
662
+ * );
663
+ * ```
664
+ */
665
+ statsMad: scipy_stats_mad,
666
+ /**
667
+ * Compute robust statistics in one call (median, iqr, mad, q1, q3).
668
+ *
669
+ * @example
670
+ * ```ts
671
+ * import { East, FloatType } from "@elaraai/east";
672
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
673
+ *
674
+ * const getRobust = East.function(
675
+ * [VectorType(FloatType)],
676
+ * Scipy.Types.RobustStatsResultType,
677
+ * ($, data) => {
678
+ * const result = $.let(Scipy.statsRobust(data));
679
+ * // result.median, result.iqr, result.mad, result.q1, result.q3
680
+ * return $.return(result);
681
+ * }
682
+ * );
683
+ * ```
684
+ */
685
+ statsRobust: scipy_stats_robust,
686
+ /**
687
+ * Fit a 1D interpolator to data.
688
+ *
689
+ * @example
690
+ * ```ts
691
+ * import { East, FloatType, variant } from "@elaraai/east";
692
+ * import { Scipy, VectorType, InterpolateConfigType } from "@elaraai/east-py-datascience";
693
+ *
694
+ * const fitInterp = East.function(
695
+ * [VectorType(FloatType), VectorType(FloatType)],
696
+ * Scipy.Types.ModelBlobType,
697
+ * ($, x, y) => {
698
+ * const config = $.let({
699
+ * kind: variant("some", variant("cubic", null)),
700
+ * }, InterpolateConfigType);
701
+ * return $.return(Scipy.interpolate1dFit(x, y, config));
702
+ * }
703
+ * );
704
+ * ```
705
+ */
706
+ interpolate1dFit: scipy_interpolate_1d_fit,
707
+ /**
708
+ * Evaluate a fitted 1D interpolator at given points.
709
+ *
710
+ * @example
711
+ * ```ts
712
+ * import { East, FloatType } from "@elaraai/east";
713
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
714
+ *
715
+ * const predict = East.function(
716
+ * [Scipy.Types.ModelBlobType, VectorType(FloatType)],
717
+ * VectorType(FloatType),
718
+ * ($, model, x_new) => {
719
+ * return $.return(Scipy.interpolate1dPredict(model, x_new));
720
+ * }
721
+ * );
722
+ * ```
723
+ */
724
+ interpolate1dPredict: scipy_interpolate_1d_predict,
725
+ /**
726
+ * Minimize a scalar function using scipy.optimize.minimize.
727
+ *
728
+ * @example
729
+ * ```ts
730
+ * import { East, FloatType, variant } from "@elaraai/east";
731
+ * import { Scipy, VectorType, ScalarObjectiveType, OptimizeConfigType } from "@elaraai/east-py-datascience";
732
+ *
733
+ * const optimize = East.function(
734
+ * [ScalarObjectiveType, VectorType(FloatType)],
735
+ * Scipy.Types.OptimizeResultType,
736
+ * ($, objective, x0) => {
737
+ * const config = $.let({
738
+ * method: variant("some", variant("l_bfgs_b", null)),
739
+ * max_iter: variant("some", 100n),
740
+ * tol: variant("none", null),
741
+ * }, OptimizeConfigType);
742
+ * return $.return(Scipy.optimizeMinimize(objective, x0, config));
743
+ * }
744
+ * );
745
+ * ```
746
+ */
747
+ optimizeMinimize: scipy_optimize_minimize,
748
+ /**
749
+ * Minimize a quadratic function with analytical gradient.
750
+ *
751
+ * Minimizes f(x) = 0.5 * x'Ax + b'x + c.
752
+ *
753
+ * @example
754
+ * ```ts
755
+ * import { East, FloatType, variant } from "@elaraai/east";
756
+ * import { Scipy, VectorType, MatrixType, QuadraticConfigType, OptimizeConfigType } from "@elaraai/east-py-datascience";
757
+ *
758
+ * const optimize = East.function(
759
+ * [VectorType(FloatType)],
760
+ * Scipy.Types.OptimizeResultType,
761
+ * ($, x0) => {
762
+ * const quadConfig = $.let({
763
+ * A: [[2.0, 0.0], [0.0, 2.0]],
764
+ * b: new Float64Array([-4.0, -6.0]),
765
+ * c: 0.0,
766
+ * }, QuadraticConfigType);
767
+ * const config = $.let({
768
+ * method: variant("some", variant("l_bfgs_b", null)),
769
+ * max_iter: variant("none", null),
770
+ * tol: variant("none", null),
771
+ * }, OptimizeConfigType);
772
+ * return $.return(Scipy.optimizeMinimizeQuadratic(x0, quadConfig, config));
773
+ * }
774
+ * );
775
+ * ```
776
+ */
777
+ optimizeMinimizeQuadratic: scipy_optimize_minimize_quadratic,
778
+ /**
779
+ * Global optimization using dual annealing.
780
+ *
781
+ * Combines generalized simulated annealing with local search.
782
+ *
783
+ * @example
784
+ * ```ts
785
+ * import { East, FloatType, variant } from "@elaraai/east";
786
+ * import { Scipy, VectorType, ScalarObjectiveType, DualAnnealBoundsType, DualAnnealConfigType } from "@elaraai/east-py-datascience";
787
+ *
788
+ * const optimize = East.function(
789
+ * [ScalarObjectiveType],
790
+ * Scipy.Types.DualAnnealResultType,
791
+ * ($, objective) => {
792
+ * const bounds = $.let({
793
+ * lower: new Float64Array([-5.0, -5.0]),
794
+ * upper: new Float64Array([5.0, 5.0]),
795
+ * }, DualAnnealBoundsType);
796
+ * const config = $.let({
797
+ * maxfun: variant("some", 1000n),
798
+ * maxiter: variant("none", null),
799
+ * initial_temp: variant("none", null),
800
+ * restart_temp_ratio: variant("none", null),
801
+ * visit: variant("none", null),
802
+ * accept: variant("none", null),
803
+ * seed: variant("some", 42n),
804
+ * no_local_search: variant("none", null),
805
+ * }, DualAnnealConfigType);
806
+ * return $.return(Scipy.optimizeDualAnnealing(objective, variant("none", null), bounds, config));
807
+ * }
808
+ * );
809
+ * ```
810
+ */
811
+ optimizeDualAnnealing: scipy_optimize_dual_annealing,
812
+ /**
813
+ * Compute histogram of data.
814
+ *
815
+ * @example
816
+ * ```ts
817
+ * import { East, FloatType, variant } from "@elaraai/east";
818
+ * import { Scipy, VectorType, HistogramConfigType } from "@elaraai/east-py-datascience";
819
+ *
820
+ * const computeHist = East.function(
821
+ * [VectorType(FloatType)],
822
+ * Scipy.Types.HistogramResultType,
823
+ * ($, data) => {
824
+ * const config = $.let({
825
+ * bins: variant("some", 20n),
826
+ * bin_method: variant("none", null),
827
+ * range_min: variant("none", null),
828
+ * range_max: variant("none", null),
829
+ * density: variant("some", true),
830
+ * weights: variant("none", null),
831
+ * }, HistogramConfigType);
832
+ * const result = $.let(Scipy.histogram(data, config));
833
+ * // result.counts, result.bin_edges
834
+ * return $.return(result);
835
+ * }
836
+ * );
837
+ * ```
838
+ */
839
+ histogram: scipy_histogram,
840
+ /**
841
+ * Fit a Kernel Density Estimator to data.
842
+ *
843
+ * @example
844
+ * ```ts
845
+ * import { East, FloatType, variant } from "@elaraai/east";
846
+ * import { Scipy, VectorType, KdeConfigType } from "@elaraai/east-py-datascience";
847
+ *
848
+ * const fitKde = East.function(
849
+ * [VectorType(FloatType)],
850
+ * Scipy.Types.ModelBlobType,
851
+ * ($, data) => {
852
+ * const config = $.let({
853
+ * bandwidth: variant("some", variant("scott", null)),
854
+ * bandwidth_scalar: variant("none", null),
855
+ * weights: variant("none", null),
856
+ * }, KdeConfigType);
857
+ * return $.return(Scipy.kdeFit(data, config));
858
+ * }
859
+ * );
860
+ * ```
861
+ */
862
+ kdeFit: scipy_kde_fit,
863
+ /**
864
+ * Evaluate a fitted KDE model at given points.
865
+ *
866
+ * @example
867
+ * ```ts
868
+ * import { East, FloatType } from "@elaraai/east";
869
+ * import { Scipy, VectorType } from "@elaraai/east-py-datascience";
870
+ *
871
+ * const evaluate = East.function(
872
+ * [Scipy.Types.ModelBlobType, VectorType(FloatType)],
873
+ * VectorType(FloatType),
874
+ * ($, model, points) => {
875
+ * return $.return(Scipy.kdeEvaluate(model, points));
876
+ * }
877
+ * );
878
+ * ```
879
+ */
880
+ kdeEvaluate: scipy_kde_evaluate,
881
+ /** Type definitions */
882
+ Types: ScipyTypes,
883
+ };
884
+ //# sourceMappingURL=scipy.js.map