@elaraai/east-py-datascience 1.0.1 → 1.0.3

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 (81) hide show
  1. package/dist/src/alns/alns.d.ts +528 -0
  2. package/dist/src/alns/alns.d.ts.map +1 -0
  3. package/dist/src/alns/alns.js +238 -0
  4. package/dist/src/alns/alns.js.map +1 -0
  5. package/dist/src/google_or/google_or.d.ts +2457 -0
  6. package/dist/src/google_or/google_or.d.ts.map +1 -0
  7. package/dist/src/google_or/google_or.js +547 -0
  8. package/dist/src/google_or/google_or.js.map +1 -0
  9. package/dist/src/gp/gp.d.ts +447 -0
  10. package/dist/src/gp/gp.d.ts.map +1 -0
  11. package/dist/src/gp/gp.js +222 -0
  12. package/dist/src/gp/gp.js.map +1 -0
  13. package/dist/src/index.d.ts +34 -0
  14. package/dist/src/index.d.ts.map +1 -0
  15. package/dist/src/index.js +57 -0
  16. package/dist/src/index.js.map +1 -0
  17. package/dist/src/lightgbm/lightgbm.d.ts +575 -0
  18. package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
  19. package/dist/src/lightgbm/lightgbm.js +241 -0
  20. package/dist/src/lightgbm/lightgbm.js.map +1 -0
  21. package/dist/src/lightning/lightning.d.ts +1594 -0
  22. package/dist/src/lightning/lightning.d.ts.map +1 -0
  23. package/dist/src/lightning/lightning.js +468 -0
  24. package/dist/src/lightning/lightning.js.map +1 -0
  25. package/dist/src/mads/mads.d.ts +410 -0
  26. package/dist/src/mads/mads.d.ts.map +1 -0
  27. package/dist/src/mads/mads.js +219 -0
  28. package/dist/src/mads/mads.js.map +1 -0
  29. package/dist/src/mapie/mapie.d.ts +3680 -0
  30. package/dist/src/mapie/mapie.d.ts.map +1 -0
  31. package/dist/src/mapie/mapie.js +616 -0
  32. package/dist/src/mapie/mapie.js.map +1 -0
  33. package/dist/src/ngboost/ngboost.d.ts +483 -0
  34. package/dist/src/ngboost/ngboost.d.ts.map +1 -0
  35. package/dist/src/ngboost/ngboost.js +231 -0
  36. package/dist/src/ngboost/ngboost.js.map +1 -0
  37. package/dist/src/optimization/optimization.d.ts +700 -0
  38. package/dist/src/optimization/optimization.d.ts.map +1 -0
  39. package/dist/src/optimization/optimization.js +411 -0
  40. package/dist/src/optimization/optimization.js.map +1 -0
  41. package/dist/src/optuna/optuna.d.ts +857 -0
  42. package/dist/src/optuna/optuna.d.ts.map +1 -0
  43. package/dist/src/optuna/optuna.js +270 -0
  44. package/dist/src/optuna/optuna.js.map +1 -0
  45. package/dist/src/pymc/pymc.d.ts +2932 -0
  46. package/dist/src/pymc/pymc.d.ts.map +1 -0
  47. package/dist/src/pymc/pymc.js +688 -0
  48. package/dist/src/pymc/pymc.js.map +1 -0
  49. package/dist/src/scipy/scipy.d.ts +2205 -0
  50. package/dist/src/scipy/scipy.d.ts.map +1 -0
  51. package/dist/src/scipy/scipy.js +884 -0
  52. package/dist/src/scipy/scipy.js.map +1 -0
  53. package/dist/src/shap/shap.d.ts +4611 -0
  54. package/dist/src/shap/shap.d.ts.map +1 -0
  55. package/dist/src/shap/shap.js +552 -0
  56. package/dist/src/shap/shap.js.map +1 -0
  57. package/dist/src/simanneal/simanneal.d.ts +628 -0
  58. package/dist/src/simanneal/simanneal.d.ts.map +1 -0
  59. package/dist/src/simanneal/simanneal.js +328 -0
  60. package/dist/src/simanneal/simanneal.js.map +1 -0
  61. package/dist/src/simulation/simulation.d.ts +224 -0
  62. package/dist/src/simulation/simulation.d.ts.map +1 -0
  63. package/dist/src/simulation/simulation.js +189 -0
  64. package/dist/src/simulation/simulation.js.map +1 -0
  65. package/dist/src/sklearn/sklearn.d.ts +6362 -0
  66. package/dist/src/sklearn/sklearn.d.ts.map +1 -0
  67. package/dist/src/sklearn/sklearn.js +1508 -0
  68. package/dist/src/sklearn/sklearn.js.map +1 -0
  69. package/dist/src/torch/torch.d.ts +1205 -0
  70. package/dist/src/torch/torch.d.ts.map +1 -0
  71. package/dist/src/torch/torch.js +440 -0
  72. package/dist/src/torch/torch.js.map +1 -0
  73. package/dist/src/types.d.ts +43 -0
  74. package/dist/src/types.d.ts.map +1 -0
  75. package/dist/src/types.js +44 -0
  76. package/dist/src/types.js.map +1 -0
  77. package/dist/src/xgboost/xgboost.d.ts +1424 -0
  78. package/dist/src/xgboost/xgboost.d.ts.map +1 -0
  79. package/dist/src/xgboost/xgboost.js +432 -0
  80. package/dist/src/xgboost/xgboost.js.map +1 -0
  81. package/package.json +3 -3
@@ -0,0 +1,447 @@
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
+ * Gaussian Process platform functions for East.
7
+ *
8
+ * Provides Gaussian Process regression using scikit-learn.
9
+ * Uses cloudpickle for model serialization.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { StructType, VariantType, OptionType, IntegerType, FloatType, BooleanType, BlobType, StringType, NullType } from "@elaraai/east";
14
+ import { VectorType, MatrixType } from "../types.js";
15
+ export { VectorType, MatrixType } from "../types.js";
16
+ /**
17
+ * Kernel type for Gaussian Process.
18
+ */
19
+ export declare const GPKernelType: VariantType<{
20
+ /** Radial Basis Function (squared exponential) */
21
+ readonly rbf: NullType;
22
+ /** Matern with nu=1/2 (exponential) */
23
+ readonly matern_1_2: NullType;
24
+ /** Matern with nu=3/2 */
25
+ readonly matern_3_2: NullType;
26
+ /** Matern with nu=5/2 */
27
+ readonly matern_5_2: NullType;
28
+ /** Rational Quadratic */
29
+ readonly rational_quadratic: NullType;
30
+ /** Dot Product (linear) */
31
+ readonly dot_product: NullType;
32
+ }>;
33
+ /**
34
+ * Configuration for Gaussian Process Regressor.
35
+ */
36
+ export declare const GPConfigType: StructType<{
37
+ /** Kernel type (default rbf) */
38
+ readonly kernel: OptionType<VariantType<{
39
+ /** Radial Basis Function (squared exponential) */
40
+ readonly rbf: NullType;
41
+ /** Matern with nu=1/2 (exponential) */
42
+ readonly matern_1_2: NullType;
43
+ /** Matern with nu=3/2 */
44
+ readonly matern_3_2: NullType;
45
+ /** Matern with nu=5/2 */
46
+ readonly matern_5_2: NullType;
47
+ /** Rational Quadratic */
48
+ readonly rational_quadratic: NullType;
49
+ /** Dot Product (linear) */
50
+ readonly dot_product: NullType;
51
+ }>>;
52
+ /** Noise level added to diagonal (default 1e-10) */
53
+ readonly alpha: OptionType<FloatType>;
54
+ /** Number of restarts for optimizer (default 0) */
55
+ readonly n_restarts_optimizer: OptionType<IntegerType>;
56
+ /** Whether to normalize target values (default false) */
57
+ readonly normalize_y: OptionType<BooleanType>;
58
+ /** Random seed for reproducibility */
59
+ readonly random_state: OptionType<IntegerType>;
60
+ }>;
61
+ /**
62
+ * Result type for GP prediction with uncertainty.
63
+ */
64
+ export declare const GPPredictResultType: StructType<{
65
+ /** Predicted mean values */
66
+ readonly mean: VectorType<FloatType>;
67
+ /** Predicted standard deviation (uncertainty) */
68
+ readonly std: VectorType<FloatType>;
69
+ }>;
70
+ /**
71
+ * Model blob type for serialized GP models.
72
+ */
73
+ export declare const GPModelBlobType: VariantType<{
74
+ /** Gaussian Process Regressor */
75
+ readonly gp_regressor: StructType<{
76
+ /** Cloudpickle serialized model */
77
+ readonly data: BlobType;
78
+ /** Number of input features */
79
+ readonly n_features: IntegerType;
80
+ /** Kernel type name for reference */
81
+ readonly kernel_type: StringType;
82
+ }>;
83
+ }>;
84
+ /**
85
+ * Train a Gaussian Process Regressor.
86
+ *
87
+ * @param X - Feature matrix
88
+ * @param y - Target vector
89
+ * @param config - GP configuration
90
+ * @returns Trained GP model blob
91
+ */
92
+ export declare const gp_train: import("@elaraai/east").PlatformDefinition<[MatrixType<FloatType>, VectorType<FloatType>, StructType<{
93
+ /** Kernel type (default rbf) */
94
+ readonly kernel: OptionType<VariantType<{
95
+ /** Radial Basis Function (squared exponential) */
96
+ readonly rbf: NullType;
97
+ /** Matern with nu=1/2 (exponential) */
98
+ readonly matern_1_2: NullType;
99
+ /** Matern with nu=3/2 */
100
+ readonly matern_3_2: NullType;
101
+ /** Matern with nu=5/2 */
102
+ readonly matern_5_2: NullType;
103
+ /** Rational Quadratic */
104
+ readonly rational_quadratic: NullType;
105
+ /** Dot Product (linear) */
106
+ readonly dot_product: NullType;
107
+ }>>;
108
+ /** Noise level added to diagonal (default 1e-10) */
109
+ readonly alpha: OptionType<FloatType>;
110
+ /** Number of restarts for optimizer (default 0) */
111
+ readonly n_restarts_optimizer: OptionType<IntegerType>;
112
+ /** Whether to normalize target values (default false) */
113
+ readonly normalize_y: OptionType<BooleanType>;
114
+ /** Random seed for reproducibility */
115
+ readonly random_state: OptionType<IntegerType>;
116
+ }>], VariantType<{
117
+ /** Gaussian Process Regressor */
118
+ readonly gp_regressor: StructType<{
119
+ /** Cloudpickle serialized model */
120
+ readonly data: BlobType;
121
+ /** Number of input features */
122
+ readonly n_features: IntegerType;
123
+ /** Kernel type name for reference */
124
+ readonly kernel_type: StringType;
125
+ }>;
126
+ }>>;
127
+ /**
128
+ * Make predictions with a trained Gaussian Process.
129
+ *
130
+ * Returns point predictions (mean only).
131
+ *
132
+ * @param model - Trained GP model blob
133
+ * @param X - Feature matrix
134
+ * @returns Predicted values
135
+ */
136
+ export declare const gp_predict: import("@elaraai/east").PlatformDefinition<[VariantType<{
137
+ /** Gaussian Process Regressor */
138
+ readonly gp_regressor: StructType<{
139
+ /** Cloudpickle serialized model */
140
+ readonly data: BlobType;
141
+ /** Number of input features */
142
+ readonly n_features: IntegerType;
143
+ /** Kernel type name for reference */
144
+ readonly kernel_type: StringType;
145
+ }>;
146
+ }>, MatrixType<FloatType>], VectorType<FloatType>>;
147
+ /**
148
+ * Make predictions with uncertainty estimates.
149
+ *
150
+ * Returns both mean and standard deviation.
151
+ *
152
+ * @param model - Trained GP model blob
153
+ * @param X - Feature matrix
154
+ * @returns Prediction result with mean and std
155
+ */
156
+ export declare const gp_predict_std: import("@elaraai/east").PlatformDefinition<[VariantType<{
157
+ /** Gaussian Process Regressor */
158
+ readonly gp_regressor: StructType<{
159
+ /** Cloudpickle serialized model */
160
+ readonly data: BlobType;
161
+ /** Number of input features */
162
+ readonly n_features: IntegerType;
163
+ /** Kernel type name for reference */
164
+ readonly kernel_type: StringType;
165
+ }>;
166
+ }>, MatrixType<FloatType>], StructType<{
167
+ /** Predicted mean values */
168
+ readonly mean: VectorType<FloatType>;
169
+ /** Predicted standard deviation (uncertainty) */
170
+ readonly std: VectorType<FloatType>;
171
+ }>>;
172
+ /**
173
+ * Type definitions for GP functions.
174
+ */
175
+ export declare const GPTypes: {
176
+ /** Kernel type */
177
+ readonly GPKernelType: VariantType<{
178
+ /** Radial Basis Function (squared exponential) */
179
+ readonly rbf: NullType;
180
+ /** Matern with nu=1/2 (exponential) */
181
+ readonly matern_1_2: NullType;
182
+ /** Matern with nu=3/2 */
183
+ readonly matern_3_2: NullType;
184
+ /** Matern with nu=5/2 */
185
+ readonly matern_5_2: NullType;
186
+ /** Rational Quadratic */
187
+ readonly rational_quadratic: NullType;
188
+ /** Dot Product (linear) */
189
+ readonly dot_product: NullType;
190
+ }>;
191
+ /** Configuration type */
192
+ readonly GPConfigType: StructType<{
193
+ /** Kernel type (default rbf) */
194
+ readonly kernel: OptionType<VariantType<{
195
+ /** Radial Basis Function (squared exponential) */
196
+ readonly rbf: NullType;
197
+ /** Matern with nu=1/2 (exponential) */
198
+ readonly matern_1_2: NullType;
199
+ /** Matern with nu=3/2 */
200
+ readonly matern_3_2: NullType;
201
+ /** Matern with nu=5/2 */
202
+ readonly matern_5_2: NullType;
203
+ /** Rational Quadratic */
204
+ readonly rational_quadratic: NullType;
205
+ /** Dot Product (linear) */
206
+ readonly dot_product: NullType;
207
+ }>>;
208
+ /** Noise level added to diagonal (default 1e-10) */
209
+ readonly alpha: OptionType<FloatType>;
210
+ /** Number of restarts for optimizer (default 0) */
211
+ readonly n_restarts_optimizer: OptionType<IntegerType>;
212
+ /** Whether to normalize target values (default false) */
213
+ readonly normalize_y: OptionType<BooleanType>;
214
+ /** Random seed for reproducibility */
215
+ readonly random_state: OptionType<IntegerType>;
216
+ }>;
217
+ /** Prediction result type with uncertainty */
218
+ readonly GPPredictResultType: StructType<{
219
+ /** Predicted mean values */
220
+ readonly mean: VectorType<FloatType>;
221
+ /** Predicted standard deviation (uncertainty) */
222
+ readonly std: VectorType<FloatType>;
223
+ }>;
224
+ /** Model blob type for GP models */
225
+ readonly ModelBlobType: VariantType<{
226
+ /** Gaussian Process Regressor */
227
+ readonly gp_regressor: StructType<{
228
+ /** Cloudpickle serialized model */
229
+ readonly data: BlobType;
230
+ /** Number of input features */
231
+ readonly n_features: IntegerType;
232
+ /** Kernel type name for reference */
233
+ readonly kernel_type: StringType;
234
+ }>;
235
+ }>;
236
+ };
237
+ /**
238
+ * Gaussian Process regression.
239
+ *
240
+ * Provides probabilistic regression with uncertainty quantification.
241
+ *
242
+ * @example
243
+ * ```ts
244
+ * import { East, variant } from "@elaraai/east";
245
+ * import { GP } from "@elaraai/east-py-datascience";
246
+ *
247
+ * const train = East.function([], GP.Types.ModelBlobType, $ => {
248
+ * const X = $.let([[1.0], [2.0], [3.0], [4.0]]);
249
+ * const y = $.let([1.0, 4.0, 9.0, 16.0]);
250
+ * const config = $.let({
251
+ * kernel: variant('some', variant('rbf', {})),
252
+ * alpha: variant('some', 1e-10),
253
+ * n_restarts_optimizer: variant('some', 5n),
254
+ * normalize_y: variant('some', true),
255
+ * random_state: variant('some', 42n),
256
+ * });
257
+ * return $.return(GP.train(X, y, config));
258
+ * });
259
+ * ```
260
+ */
261
+ export declare const GP: {
262
+ /**
263
+ * Train a Gaussian Process regression model.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * import { East, FloatType, MatrixType, VectorType, variant } from "@elaraai/east";
268
+ * import { GP, GPConfigType } from "@elaraai/east-py-datascience";
269
+ *
270
+ * const train = East.function([], GP.Types.ModelBlobType, ($) => {
271
+ * const X = $.let([[1.0], [2.0], [3.0], [4.0]]);
272
+ * const y = $.let(new Float64Array([1.0, 4.0, 9.0, 16.0]));
273
+ * const config = $.let({
274
+ * kernel: variant("some", variant("rbf", null)),
275
+ * alpha: variant("some", 1e-10),
276
+ * n_restarts_optimizer: variant("some", 5n),
277
+ * normalize_y: variant("some", true),
278
+ * random_state: variant("some", 42n),
279
+ * }, GPConfigType);
280
+ * return $.return(GP.train(X, y, config));
281
+ * });
282
+ * ```
283
+ */
284
+ readonly train: import("@elaraai/east").PlatformDefinition<[MatrixType<FloatType>, VectorType<FloatType>, StructType<{
285
+ /** Kernel type (default rbf) */
286
+ readonly kernel: OptionType<VariantType<{
287
+ /** Radial Basis Function (squared exponential) */
288
+ readonly rbf: NullType;
289
+ /** Matern with nu=1/2 (exponential) */
290
+ readonly matern_1_2: NullType;
291
+ /** Matern with nu=3/2 */
292
+ readonly matern_3_2: NullType;
293
+ /** Matern with nu=5/2 */
294
+ readonly matern_5_2: NullType;
295
+ /** Rational Quadratic */
296
+ readonly rational_quadratic: NullType;
297
+ /** Dot Product (linear) */
298
+ readonly dot_product: NullType;
299
+ }>>;
300
+ /** Noise level added to diagonal (default 1e-10) */
301
+ readonly alpha: OptionType<FloatType>;
302
+ /** Number of restarts for optimizer (default 0) */
303
+ readonly n_restarts_optimizer: OptionType<IntegerType>;
304
+ /** Whether to normalize target values (default false) */
305
+ readonly normalize_y: OptionType<BooleanType>;
306
+ /** Random seed for reproducibility */
307
+ readonly random_state: OptionType<IntegerType>;
308
+ }>], VariantType<{
309
+ /** Gaussian Process Regressor */
310
+ readonly gp_regressor: StructType<{
311
+ /** Cloudpickle serialized model */
312
+ readonly data: BlobType;
313
+ /** Number of input features */
314
+ readonly n_features: IntegerType;
315
+ /** Kernel type name for reference */
316
+ readonly kernel_type: StringType;
317
+ }>;
318
+ }>>;
319
+ /**
320
+ * Make predictions (mean only) with a trained GP model.
321
+ *
322
+ * @example
323
+ * ```ts
324
+ * import { East, FloatType, MatrixType, VectorType } from "@elaraai/east";
325
+ * import { GP } from "@elaraai/east-py-datascience";
326
+ *
327
+ * const predictFn = East.function(
328
+ * [GP.Types.ModelBlobType, MatrixType(FloatType)],
329
+ * VectorType(FloatType),
330
+ * ($, model, X) => {
331
+ * return $.return(GP.predict(model, X));
332
+ * }
333
+ * );
334
+ * ```
335
+ */
336
+ readonly predict: import("@elaraai/east").PlatformDefinition<[VariantType<{
337
+ /** Gaussian Process Regressor */
338
+ readonly gp_regressor: StructType<{
339
+ /** Cloudpickle serialized model */
340
+ readonly data: BlobType;
341
+ /** Number of input features */
342
+ readonly n_features: IntegerType;
343
+ /** Kernel type name for reference */
344
+ readonly kernel_type: StringType;
345
+ }>;
346
+ }>, MatrixType<FloatType>], VectorType<FloatType>>;
347
+ /**
348
+ * Make predictions with uncertainty estimates (mean + std).
349
+ *
350
+ * @example
351
+ * ```ts
352
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
353
+ * import { GP } from "@elaraai/east-py-datascience";
354
+ *
355
+ * const predictFn = East.function(
356
+ * [GP.Types.ModelBlobType, MatrixType(FloatType)],
357
+ * GP.Types.GPPredictResultType,
358
+ * ($, model, X) => {
359
+ * const result = $.let(GP.predictStd(model, X));
360
+ * // result.mean => predicted values
361
+ * // result.std => uncertainty (standard deviation)
362
+ * return $.return(result);
363
+ * }
364
+ * );
365
+ * ```
366
+ */
367
+ readonly predictStd: import("@elaraai/east").PlatformDefinition<[VariantType<{
368
+ /** Gaussian Process Regressor */
369
+ readonly gp_regressor: StructType<{
370
+ /** Cloudpickle serialized model */
371
+ readonly data: BlobType;
372
+ /** Number of input features */
373
+ readonly n_features: IntegerType;
374
+ /** Kernel type name for reference */
375
+ readonly kernel_type: StringType;
376
+ }>;
377
+ }>, MatrixType<FloatType>], StructType<{
378
+ /** Predicted mean values */
379
+ readonly mean: VectorType<FloatType>;
380
+ /** Predicted standard deviation (uncertainty) */
381
+ readonly std: VectorType<FloatType>;
382
+ }>>;
383
+ /** Type definitions */
384
+ readonly Types: {
385
+ /** Kernel type */
386
+ readonly GPKernelType: VariantType<{
387
+ /** Radial Basis Function (squared exponential) */
388
+ readonly rbf: NullType;
389
+ /** Matern with nu=1/2 (exponential) */
390
+ readonly matern_1_2: NullType;
391
+ /** Matern with nu=3/2 */
392
+ readonly matern_3_2: NullType;
393
+ /** Matern with nu=5/2 */
394
+ readonly matern_5_2: NullType;
395
+ /** Rational Quadratic */
396
+ readonly rational_quadratic: NullType;
397
+ /** Dot Product (linear) */
398
+ readonly dot_product: NullType;
399
+ }>;
400
+ /** Configuration type */
401
+ readonly GPConfigType: StructType<{
402
+ /** Kernel type (default rbf) */
403
+ readonly kernel: OptionType<VariantType<{
404
+ /** Radial Basis Function (squared exponential) */
405
+ readonly rbf: NullType;
406
+ /** Matern with nu=1/2 (exponential) */
407
+ readonly matern_1_2: NullType;
408
+ /** Matern with nu=3/2 */
409
+ readonly matern_3_2: NullType;
410
+ /** Matern with nu=5/2 */
411
+ readonly matern_5_2: NullType;
412
+ /** Rational Quadratic */
413
+ readonly rational_quadratic: NullType;
414
+ /** Dot Product (linear) */
415
+ readonly dot_product: NullType;
416
+ }>>;
417
+ /** Noise level added to diagonal (default 1e-10) */
418
+ readonly alpha: OptionType<FloatType>;
419
+ /** Number of restarts for optimizer (default 0) */
420
+ readonly n_restarts_optimizer: OptionType<IntegerType>;
421
+ /** Whether to normalize target values (default false) */
422
+ readonly normalize_y: OptionType<BooleanType>;
423
+ /** Random seed for reproducibility */
424
+ readonly random_state: OptionType<IntegerType>;
425
+ }>;
426
+ /** Prediction result type with uncertainty */
427
+ readonly GPPredictResultType: StructType<{
428
+ /** Predicted mean values */
429
+ readonly mean: VectorType<FloatType>;
430
+ /** Predicted standard deviation (uncertainty) */
431
+ readonly std: VectorType<FloatType>;
432
+ }>;
433
+ /** Model blob type for GP models */
434
+ readonly ModelBlobType: VariantType<{
435
+ /** Gaussian Process Regressor */
436
+ readonly gp_regressor: StructType<{
437
+ /** Cloudpickle serialized model */
438
+ readonly data: BlobType;
439
+ /** Number of input features */
440
+ readonly n_features: IntegerType;
441
+ /** Kernel type name for reference */
442
+ readonly kernel_type: StringType;
443
+ }>;
444
+ }>;
445
+ };
446
+ };
447
+ //# sourceMappingURL=gp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gp.d.ts","sourceRoot":"","sources":["../../../src/gp/gp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGrD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMrD;;GAEG;AACH,eAAO,MAAM,YAAY;IACrB,kDAAkD;;IAElD,uCAAuC;;IAEvC,yBAAyB;;IAEzB,yBAAyB;;IAEzB,yBAAyB;;IAEzB,2BAA2B;;EAE7B,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,YAAY;IACrB,gCAAgC;;QAtBhC,kDAAkD;;QAElD,uCAAuC;;QAEvC,yBAAyB;;QAEzB,yBAAyB;;QAEzB,yBAAyB;;QAEzB,2BAA2B;;;IAc3B,oDAAoD;;IAEpD,mDAAmD;;IAEnD,yDAAyD;;IAEzD,sCAAsC;;EAExC,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,mBAAmB;IAC5B,4BAA4B;;IAE5B,iDAAiD;;EAEnD,CAAC;AAMH;;GAEG;AACH,eAAO,MAAM,eAAe;IACxB,iCAAiC;;QAE7B,mCAAmC;;QAEnC,+BAA+B;;QAE/B,qCAAqC;;;EAG3C,CAAC;AAMH;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;IAzDjB,gCAAgC;;QAtBhC,kDAAkD;;QAElD,uCAAuC;;QAEvC,yBAAyB;;QAEzB,yBAAyB;;QAEzB,yBAAyB;;QAEzB,2BAA2B;;;IAc3B,oDAAoD;;I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0BtC,iCAAiC;;YAE7B,mCAAmC;;YAEnC,+BAA+B;;YAE/B,qCAAqC;;;;IAwHzC;;;;;;;;;;;;;;;;OAgBG;;QA9IH,iCAAiC;;YAE7B,mCAAmC;;YAEnC,+BAA+B;;YAE/B,qCAAqC;;;;IA2IzC;;;;;;;;;;;;;;;;;;;OAmBG;;QApKH,iCAAiC;;YAE7B,mCAAmC;;YAEnC,+BAA+B;;YAE/B,qCAAqC;;;;QApBzC,4BAA4B;;QAE5B,iDAAiD;;;IAkLjD,uBAAuB;;QAnGvB,kBAAkB;;YA3HlB,kDAAkD;;YAElD,uCAAuC;;YAEvC,yBAAyB;;YAEzB,yBAAyB;;YAEzB,yBAAyB;;YAEzB,2BAA2B;;;QAmH3B,yBAAyB;;YAvGzB,gCAAgC;;gBAtBhC,kDAAkD;;gBAElD,uCAAuC;;gBAEvC,yBAAyB;;gBAEzB,yBAAyB;;gBAEzB,yBAAyB;;gBAEzB,2BAA2B;;;YAc3B,oDAAoD;;YAEpD,mDAAmD;;YAEnD,yDAAyD;;YAEzD,sCAAsC;;;QAiGtC,8CAA8C;;YArF9C,4BAA4B;;YAE5B,iDAAiD;;;QAqFjD,oCAAoC;;YAzEpC,iCAAiC;;gBAE7B,mCAAmC;;gBAEnC,+BAA+B;;gBAE/B,qCAAqC;;;;;CAkKnC,CAAC"}
@@ -0,0 +1,222 @@
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
+ * Gaussian Process platform functions for East.
7
+ *
8
+ * Provides Gaussian Process regression using scikit-learn.
9
+ * Uses cloudpickle for model serialization.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { East, StructType, VariantType, OptionType, IntegerType, FloatType, BooleanType, BlobType, StringType, NullType, } from "@elaraai/east";
14
+ import { VectorType, MatrixType } from "../types.js";
15
+ // Re-export shared types for convenience
16
+ export { VectorType, MatrixType } from "../types.js";
17
+ // ============================================================================
18
+ // Enum Types
19
+ // ============================================================================
20
+ /**
21
+ * Kernel type for Gaussian Process.
22
+ */
23
+ export const GPKernelType = VariantType({
24
+ /** Radial Basis Function (squared exponential) */
25
+ rbf: NullType,
26
+ /** Matern with nu=1/2 (exponential) */
27
+ matern_1_2: NullType,
28
+ /** Matern with nu=3/2 */
29
+ matern_3_2: NullType,
30
+ /** Matern with nu=5/2 */
31
+ matern_5_2: NullType,
32
+ /** Rational Quadratic */
33
+ rational_quadratic: NullType,
34
+ /** Dot Product (linear) */
35
+ dot_product: NullType,
36
+ });
37
+ // ============================================================================
38
+ // Config Types
39
+ // ============================================================================
40
+ /**
41
+ * Configuration for Gaussian Process Regressor.
42
+ */
43
+ export const GPConfigType = StructType({
44
+ /** Kernel type (default rbf) */
45
+ kernel: OptionType(GPKernelType),
46
+ /** Noise level added to diagonal (default 1e-10) */
47
+ alpha: OptionType(FloatType),
48
+ /** Number of restarts for optimizer (default 0) */
49
+ n_restarts_optimizer: OptionType(IntegerType),
50
+ /** Whether to normalize target values (default false) */
51
+ normalize_y: OptionType(BooleanType),
52
+ /** Random seed for reproducibility */
53
+ random_state: OptionType(IntegerType),
54
+ });
55
+ // ============================================================================
56
+ // Result Types
57
+ // ============================================================================
58
+ /**
59
+ * Result type for GP prediction with uncertainty.
60
+ */
61
+ export const GPPredictResultType = StructType({
62
+ /** Predicted mean values */
63
+ mean: VectorType(FloatType),
64
+ /** Predicted standard deviation (uncertainty) */
65
+ std: VectorType(FloatType),
66
+ });
67
+ // ============================================================================
68
+ // Model Blob Types
69
+ // ============================================================================
70
+ /**
71
+ * Model blob type for serialized GP models.
72
+ */
73
+ export const GPModelBlobType = VariantType({
74
+ /** Gaussian Process Regressor */
75
+ gp_regressor: StructType({
76
+ /** Cloudpickle serialized model */
77
+ data: BlobType,
78
+ /** Number of input features */
79
+ n_features: IntegerType,
80
+ /** Kernel type name for reference */
81
+ kernel_type: StringType,
82
+ }),
83
+ });
84
+ // ============================================================================
85
+ // Platform Functions
86
+ // ============================================================================
87
+ /**
88
+ * Train a Gaussian Process Regressor.
89
+ *
90
+ * @param X - Feature matrix
91
+ * @param y - Target vector
92
+ * @param config - GP configuration
93
+ * @returns Trained GP model blob
94
+ */
95
+ export const gp_train = East.platform("gp_train", [MatrixType(FloatType), VectorType(FloatType), GPConfigType], GPModelBlobType);
96
+ /**
97
+ * Make predictions with a trained Gaussian Process.
98
+ *
99
+ * Returns point predictions (mean only).
100
+ *
101
+ * @param model - Trained GP model blob
102
+ * @param X - Feature matrix
103
+ * @returns Predicted values
104
+ */
105
+ export const gp_predict = East.platform("gp_predict", [GPModelBlobType, MatrixType(FloatType)], VectorType(FloatType));
106
+ /**
107
+ * Make predictions with uncertainty estimates.
108
+ *
109
+ * Returns both mean and standard deviation.
110
+ *
111
+ * @param model - Trained GP model blob
112
+ * @param X - Feature matrix
113
+ * @returns Prediction result with mean and std
114
+ */
115
+ export const gp_predict_std = East.platform("gp_predict_std", [GPModelBlobType, MatrixType(FloatType)], GPPredictResultType);
116
+ // ============================================================================
117
+ // Grouped Export
118
+ // ============================================================================
119
+ /**
120
+ * Type definitions for GP functions.
121
+ */
122
+ export const GPTypes = {
123
+ /** Kernel type */
124
+ GPKernelType,
125
+ /** Configuration type */
126
+ GPConfigType,
127
+ /** Prediction result type with uncertainty */
128
+ GPPredictResultType,
129
+ /** Model blob type for GP models */
130
+ ModelBlobType: GPModelBlobType,
131
+ };
132
+ /**
133
+ * Gaussian Process regression.
134
+ *
135
+ * Provides probabilistic regression with uncertainty quantification.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * import { East, variant } from "@elaraai/east";
140
+ * import { GP } from "@elaraai/east-py-datascience";
141
+ *
142
+ * const train = East.function([], GP.Types.ModelBlobType, $ => {
143
+ * const X = $.let([[1.0], [2.0], [3.0], [4.0]]);
144
+ * const y = $.let([1.0, 4.0, 9.0, 16.0]);
145
+ * const config = $.let({
146
+ * kernel: variant('some', variant('rbf', {})),
147
+ * alpha: variant('some', 1e-10),
148
+ * n_restarts_optimizer: variant('some', 5n),
149
+ * normalize_y: variant('some', true),
150
+ * random_state: variant('some', 42n),
151
+ * });
152
+ * return $.return(GP.train(X, y, config));
153
+ * });
154
+ * ```
155
+ */
156
+ export const GP = {
157
+ /**
158
+ * Train a Gaussian Process regression model.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * import { East, FloatType, MatrixType, VectorType, variant } from "@elaraai/east";
163
+ * import { GP, GPConfigType } from "@elaraai/east-py-datascience";
164
+ *
165
+ * const train = East.function([], GP.Types.ModelBlobType, ($) => {
166
+ * const X = $.let([[1.0], [2.0], [3.0], [4.0]]);
167
+ * const y = $.let(new Float64Array([1.0, 4.0, 9.0, 16.0]));
168
+ * const config = $.let({
169
+ * kernel: variant("some", variant("rbf", null)),
170
+ * alpha: variant("some", 1e-10),
171
+ * n_restarts_optimizer: variant("some", 5n),
172
+ * normalize_y: variant("some", true),
173
+ * random_state: variant("some", 42n),
174
+ * }, GPConfigType);
175
+ * return $.return(GP.train(X, y, config));
176
+ * });
177
+ * ```
178
+ */
179
+ train: gp_train,
180
+ /**
181
+ * Make predictions (mean only) with a trained GP model.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * import { East, FloatType, MatrixType, VectorType } from "@elaraai/east";
186
+ * import { GP } from "@elaraai/east-py-datascience";
187
+ *
188
+ * const predictFn = East.function(
189
+ * [GP.Types.ModelBlobType, MatrixType(FloatType)],
190
+ * VectorType(FloatType),
191
+ * ($, model, X) => {
192
+ * return $.return(GP.predict(model, X));
193
+ * }
194
+ * );
195
+ * ```
196
+ */
197
+ predict: gp_predict,
198
+ /**
199
+ * Make predictions with uncertainty estimates (mean + std).
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
204
+ * import { GP } from "@elaraai/east-py-datascience";
205
+ *
206
+ * const predictFn = East.function(
207
+ * [GP.Types.ModelBlobType, MatrixType(FloatType)],
208
+ * GP.Types.GPPredictResultType,
209
+ * ($, model, X) => {
210
+ * const result = $.let(GP.predictStd(model, X));
211
+ * // result.mean => predicted values
212
+ * // result.std => uncertainty (standard deviation)
213
+ * return $.return(result);
214
+ * }
215
+ * );
216
+ * ```
217
+ */
218
+ predictStd: gp_predict_std,
219
+ /** Type definitions */
220
+ Types: GPTypes,
221
+ };
222
+ //# sourceMappingURL=gp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gp.js","sourceRoot":"","sources":["../../../src/gp/gp.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,QAAQ,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,yCAAyC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;IACpC,kDAAkD;IAClD,GAAG,EAAE,QAAQ;IACb,uCAAuC;IACvC,UAAU,EAAE,QAAQ;IACpB,yBAAyB;IACzB,UAAU,EAAE,QAAQ;IACpB,yBAAyB;IACzB,UAAU,EAAE,QAAQ;IACpB,yBAAyB;IACzB,kBAAkB,EAAE,QAAQ;IAC5B,2BAA2B;IAC3B,WAAW,EAAE,QAAQ;CACxB,CAAC,CAAC;AAEH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,UAAU,CAAC;IACnC,gCAAgC;IAChC,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC;IAChC,oDAAoD;IACpD,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC;IAC5B,mDAAmD;IAC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