@elaraai/east-py-datascience 0.0.2-beta.1

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 (56) hide show
  1. package/LICENSE.md +18 -0
  2. package/README.md +104 -0
  3. package/dist/gp/gp.d.ts +398 -0
  4. package/dist/gp/gp.d.ts.map +1 -0
  5. package/dist/gp/gp.js +170 -0
  6. package/dist/gp/gp.js.map +1 -0
  7. package/dist/index.d.ts +27 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +39 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/lightgbm/lightgbm.d.ts +494 -0
  12. package/dist/lightgbm/lightgbm.d.ts.map +1 -0
  13. package/dist/lightgbm/lightgbm.js +155 -0
  14. package/dist/lightgbm/lightgbm.js.map +1 -0
  15. package/dist/mads/mads.d.ts +413 -0
  16. package/dist/mads/mads.d.ts.map +1 -0
  17. package/dist/mads/mads.js +221 -0
  18. package/dist/mads/mads.js.map +1 -0
  19. package/dist/ngboost/ngboost.d.ts +433 -0
  20. package/dist/ngboost/ngboost.d.ts.map +1 -0
  21. package/dist/ngboost/ngboost.js +178 -0
  22. package/dist/ngboost/ngboost.js.map +1 -0
  23. package/dist/optuna/optuna.d.ts +797 -0
  24. package/dist/optuna/optuna.d.ts.map +1 -0
  25. package/dist/optuna/optuna.js +268 -0
  26. package/dist/optuna/optuna.js.map +1 -0
  27. package/dist/scipy/scipy.d.ts +954 -0
  28. package/dist/scipy/scipy.d.ts.map +1 -0
  29. package/dist/scipy/scipy.js +287 -0
  30. package/dist/scipy/scipy.js.map +1 -0
  31. package/dist/shap/shap.d.ts +657 -0
  32. package/dist/shap/shap.d.ts.map +1 -0
  33. package/dist/shap/shap.js +241 -0
  34. package/dist/shap/shap.js.map +1 -0
  35. package/dist/simanneal/simanneal.d.ts +531 -0
  36. package/dist/simanneal/simanneal.d.ts.map +1 -0
  37. package/dist/simanneal/simanneal.js +231 -0
  38. package/dist/simanneal/simanneal.js.map +1 -0
  39. package/dist/sklearn/sklearn.d.ts +1272 -0
  40. package/dist/sklearn/sklearn.d.ts.map +1 -0
  41. package/dist/sklearn/sklearn.js +307 -0
  42. package/dist/sklearn/sklearn.js.map +1 -0
  43. package/dist/torch/torch.d.ts +658 -0
  44. package/dist/torch/torch.d.ts.map +1 -0
  45. package/dist/torch/torch.js +233 -0
  46. package/dist/torch/torch.js.map +1 -0
  47. package/dist/tsconfig.tsbuildinfo +1 -0
  48. package/dist/types.d.ts +80 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/dist/types.js +81 -0
  51. package/dist/types.js.map +1 -0
  52. package/dist/xgboost/xgboost.d.ts +504 -0
  53. package/dist/xgboost/xgboost.d.ts.map +1 -0
  54. package/dist/xgboost/xgboost.js +177 -0
  55. package/dist/xgboost/xgboost.js.map +1 -0
  56. package/package.json +82 -0
@@ -0,0 +1,657 @@
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
+ * SHAP platform functions for East.
7
+ *
8
+ * Provides model-agnostic feature importance and explainability using SHAP values.
9
+ * Uses cloudpickle for explainer serialization.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { StructType, VariantType, OptionType, IntegerType, FloatType, StringType, ArrayType, BlobType } from "@elaraai/east";
14
+ export { VectorType, MatrixType } from "../types.js";
15
+ /** String vector type for feature names */
16
+ export declare const StringVectorType: ArrayType<StringType>;
17
+ /**
18
+ * Result type for SHAP value computation.
19
+ */
20
+ export declare const ShapResultType: StructType<{
21
+ /** SHAP values matrix (n_samples x n_features) */
22
+ shap_values: ArrayType<ArrayType<FloatType>>;
23
+ /** Base value (expected model output) */
24
+ base_value: FloatType;
25
+ /** Feature names */
26
+ feature_names: ArrayType<StringType>;
27
+ }>;
28
+ /**
29
+ * Result type for feature importance.
30
+ */
31
+ export declare const FeatureImportanceType: StructType<{
32
+ /** Feature names */
33
+ feature_names: ArrayType<StringType>;
34
+ /** Mean absolute SHAP value for each feature */
35
+ importances: ArrayType<FloatType>;
36
+ /** Standard deviation of absolute SHAP values */
37
+ std: OptionType<ArrayType<FloatType>>;
38
+ }>;
39
+ /**
40
+ * Model blob type for serialized SHAP explainers.
41
+ */
42
+ export declare const ShapModelBlobType: VariantType<{
43
+ /** SHAP TreeExplainer for tree-based models */
44
+ shap_tree_explainer: StructType<{
45
+ /** Cloudpickle serialized explainer */
46
+ data: BlobType;
47
+ /** Number of input features */
48
+ n_features: IntegerType;
49
+ }>;
50
+ /** SHAP KernelExplainer for any model */
51
+ shap_kernel_explainer: StructType<{
52
+ /** Cloudpickle serialized explainer */
53
+ data: BlobType;
54
+ /** Number of input features */
55
+ n_features: IntegerType;
56
+ }>;
57
+ }>;
58
+ /**
59
+ * Tree-based model blob type - accepts XGBoost and LightGBM models.
60
+ */
61
+ export declare const TreeModelBlobType: VariantType<{
62
+ /** XGBoost regressor */
63
+ xgboost_regressor: StructType<{
64
+ data: BlobType;
65
+ n_features: IntegerType;
66
+ }>;
67
+ /** XGBoost classifier */
68
+ xgboost_classifier: StructType<{
69
+ data: BlobType;
70
+ n_features: IntegerType;
71
+ n_classes: IntegerType;
72
+ }>;
73
+ /** LightGBM regressor */
74
+ lightgbm_regressor: StructType<{
75
+ data: BlobType;
76
+ n_features: IntegerType;
77
+ }>;
78
+ /** LightGBM classifier */
79
+ lightgbm_classifier: StructType<{
80
+ data: BlobType;
81
+ n_features: IntegerType;
82
+ n_classes: IntegerType;
83
+ }>;
84
+ }>;
85
+ /**
86
+ * Any model blob type - accepts any model for kernel explainer.
87
+ * Includes all tree-based models plus NGBoost, GP, and Torch.
88
+ */
89
+ export declare const AnyModelBlobType: VariantType<{
90
+ xgboost_regressor: StructType<{
91
+ data: BlobType;
92
+ n_features: IntegerType;
93
+ }>;
94
+ xgboost_classifier: StructType<{
95
+ data: BlobType;
96
+ n_features: IntegerType;
97
+ n_classes: IntegerType;
98
+ }>;
99
+ lightgbm_regressor: StructType<{
100
+ data: BlobType;
101
+ n_features: IntegerType;
102
+ }>;
103
+ lightgbm_classifier: StructType<{
104
+ data: BlobType;
105
+ n_features: IntegerType;
106
+ n_classes: IntegerType;
107
+ }>;
108
+ ngboost_regressor: StructType<{
109
+ data: BlobType;
110
+ distribution: VariantType<{
111
+ normal: StructType<{}>;
112
+ lognormal: StructType<{}>;
113
+ }>;
114
+ n_features: IntegerType;
115
+ }>;
116
+ gp_regressor: StructType<{
117
+ data: BlobType;
118
+ n_features: IntegerType;
119
+ kernel_type: StringType;
120
+ }>;
121
+ torch_mlp: StructType<{
122
+ data: BlobType;
123
+ n_features: IntegerType;
124
+ hidden_layers: ArrayType<IntegerType>;
125
+ output_dim: IntegerType;
126
+ }>;
127
+ }>;
128
+ /**
129
+ * Create a SHAP TreeExplainer for tree-based models.
130
+ *
131
+ * Works with XGBoost and LightGBM models (regressor and classifier).
132
+ *
133
+ * @param model - Tree-based model blob (XGBoost or LightGBM)
134
+ * @returns SHAP TreeExplainer blob
135
+ */
136
+ export declare const shap_tree_explainer_create: import("@elaraai/east").PlatformDefinition<[VariantType<{
137
+ /** XGBoost regressor */
138
+ xgboost_regressor: StructType<{
139
+ data: BlobType;
140
+ n_features: IntegerType;
141
+ }>;
142
+ /** XGBoost classifier */
143
+ xgboost_classifier: StructType<{
144
+ data: BlobType;
145
+ n_features: IntegerType;
146
+ n_classes: IntegerType;
147
+ }>;
148
+ /** LightGBM regressor */
149
+ lightgbm_regressor: StructType<{
150
+ data: BlobType;
151
+ n_features: IntegerType;
152
+ }>;
153
+ /** LightGBM classifier */
154
+ lightgbm_classifier: StructType<{
155
+ data: BlobType;
156
+ n_features: IntegerType;
157
+ n_classes: IntegerType;
158
+ }>;
159
+ }>], VariantType<{
160
+ /** SHAP TreeExplainer for tree-based models */
161
+ shap_tree_explainer: StructType<{
162
+ /** Cloudpickle serialized explainer */
163
+ data: BlobType;
164
+ /** Number of input features */
165
+ n_features: IntegerType;
166
+ }>;
167
+ /** SHAP KernelExplainer for any model */
168
+ shap_kernel_explainer: StructType<{
169
+ /** Cloudpickle serialized explainer */
170
+ data: BlobType;
171
+ /** Number of input features */
172
+ n_features: IntegerType;
173
+ }>;
174
+ }>>;
175
+ /**
176
+ * Create a SHAP KernelExplainer for any model.
177
+ *
178
+ * Works with any model that has a predict method (NGBoost, GP, Torch, etc.).
179
+ * Requires background data for computing expected values.
180
+ *
181
+ * @param model - Any model blob
182
+ * @param X_background - Background data for computing expected values
183
+ * @returns SHAP KernelExplainer blob
184
+ */
185
+ export declare const shap_kernel_explainer_create: import("@elaraai/east").PlatformDefinition<[VariantType<{
186
+ xgboost_regressor: StructType<{
187
+ data: BlobType;
188
+ n_features: IntegerType;
189
+ }>;
190
+ xgboost_classifier: StructType<{
191
+ data: BlobType;
192
+ n_features: IntegerType;
193
+ n_classes: IntegerType;
194
+ }>;
195
+ lightgbm_regressor: StructType<{
196
+ data: BlobType;
197
+ n_features: IntegerType;
198
+ }>;
199
+ lightgbm_classifier: StructType<{
200
+ data: BlobType;
201
+ n_features: IntegerType;
202
+ n_classes: IntegerType;
203
+ }>;
204
+ ngboost_regressor: StructType<{
205
+ data: BlobType;
206
+ distribution: VariantType<{
207
+ normal: StructType<{}>;
208
+ lognormal: StructType<{}>;
209
+ }>;
210
+ n_features: IntegerType;
211
+ }>;
212
+ gp_regressor: StructType<{
213
+ data: BlobType;
214
+ n_features: IntegerType;
215
+ kernel_type: StringType;
216
+ }>;
217
+ torch_mlp: StructType<{
218
+ data: BlobType;
219
+ n_features: IntegerType;
220
+ hidden_layers: ArrayType<IntegerType>;
221
+ output_dim: IntegerType;
222
+ }>;
223
+ }>, ArrayType<ArrayType<FloatType>>], VariantType<{
224
+ /** SHAP TreeExplainer for tree-based models */
225
+ shap_tree_explainer: StructType<{
226
+ /** Cloudpickle serialized explainer */
227
+ data: BlobType;
228
+ /** Number of input features */
229
+ n_features: IntegerType;
230
+ }>;
231
+ /** SHAP KernelExplainer for any model */
232
+ shap_kernel_explainer: StructType<{
233
+ /** Cloudpickle serialized explainer */
234
+ data: BlobType;
235
+ /** Number of input features */
236
+ n_features: IntegerType;
237
+ }>;
238
+ }>>;
239
+ /**
240
+ * Compute SHAP values for samples.
241
+ *
242
+ * @param explainer - SHAP explainer blob
243
+ * @param X - Feature matrix to explain
244
+ * @param feature_names - Names of features
245
+ * @returns SHAP values, base value, and feature names
246
+ */
247
+ export declare const shap_compute_values: import("@elaraai/east").PlatformDefinition<[VariantType<{
248
+ /** SHAP TreeExplainer for tree-based models */
249
+ shap_tree_explainer: StructType<{
250
+ /** Cloudpickle serialized explainer */
251
+ data: BlobType;
252
+ /** Number of input features */
253
+ n_features: IntegerType;
254
+ }>;
255
+ /** SHAP KernelExplainer for any model */
256
+ shap_kernel_explainer: StructType<{
257
+ /** Cloudpickle serialized explainer */
258
+ data: BlobType;
259
+ /** Number of input features */
260
+ n_features: IntegerType;
261
+ }>;
262
+ }>, ArrayType<ArrayType<FloatType>>, ArrayType<StringType>], StructType<{
263
+ /** SHAP values matrix (n_samples x n_features) */
264
+ shap_values: ArrayType<ArrayType<FloatType>>;
265
+ /** Base value (expected model output) */
266
+ base_value: FloatType;
267
+ /** Feature names */
268
+ feature_names: ArrayType<StringType>;
269
+ }>>;
270
+ /**
271
+ * Compute global feature importance from SHAP values.
272
+ *
273
+ * @param shap_values - SHAP values matrix
274
+ * @param feature_names - Names of features
275
+ * @returns Feature importance with mean |SHAP| values
276
+ */
277
+ export declare const shap_feature_importance: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<StringType>], StructType<{
278
+ /** Feature names */
279
+ feature_names: ArrayType<StringType>;
280
+ /** Mean absolute SHAP value for each feature */
281
+ importances: ArrayType<FloatType>;
282
+ /** Standard deviation of absolute SHAP values */
283
+ std: OptionType<ArrayType<FloatType>>;
284
+ }>>;
285
+ /**
286
+ * Type definitions for SHAP functions.
287
+ */
288
+ export declare const ShapTypes: {
289
+ /** Vector type (array of floats) */
290
+ readonly VectorType: ArrayType<FloatType>;
291
+ /** Matrix type (2D array of floats) */
292
+ readonly MatrixType: ArrayType<ArrayType<FloatType>>;
293
+ /** String vector type */
294
+ readonly StringVectorType: ArrayType<StringType>;
295
+ /** SHAP result type */
296
+ readonly ShapResultType: StructType<{
297
+ /** SHAP values matrix (n_samples x n_features) */
298
+ shap_values: ArrayType<ArrayType<FloatType>>;
299
+ /** Base value (expected model output) */
300
+ base_value: FloatType;
301
+ /** Feature names */
302
+ feature_names: ArrayType<StringType>;
303
+ }>;
304
+ /** Feature importance type */
305
+ readonly FeatureImportanceType: StructType<{
306
+ /** Feature names */
307
+ feature_names: ArrayType<StringType>;
308
+ /** Mean absolute SHAP value for each feature */
309
+ importances: ArrayType<FloatType>;
310
+ /** Standard deviation of absolute SHAP values */
311
+ std: OptionType<ArrayType<FloatType>>;
312
+ }>;
313
+ /** SHAP explainer model blob type */
314
+ readonly ShapModelBlobType: VariantType<{
315
+ /** SHAP TreeExplainer for tree-based models */
316
+ shap_tree_explainer: StructType<{
317
+ /** Cloudpickle serialized explainer */
318
+ data: BlobType;
319
+ /** Number of input features */
320
+ n_features: IntegerType;
321
+ }>;
322
+ /** SHAP KernelExplainer for any model */
323
+ shap_kernel_explainer: StructType<{
324
+ /** Cloudpickle serialized explainer */
325
+ data: BlobType;
326
+ /** Number of input features */
327
+ n_features: IntegerType;
328
+ }>;
329
+ }>;
330
+ /** Tree model blob type for input */
331
+ readonly TreeModelBlobType: VariantType<{
332
+ /** XGBoost regressor */
333
+ xgboost_regressor: StructType<{
334
+ data: BlobType;
335
+ n_features: IntegerType;
336
+ }>;
337
+ /** XGBoost classifier */
338
+ xgboost_classifier: StructType<{
339
+ data: BlobType;
340
+ n_features: IntegerType;
341
+ n_classes: IntegerType;
342
+ }>;
343
+ /** LightGBM regressor */
344
+ lightgbm_regressor: StructType<{
345
+ data: BlobType;
346
+ n_features: IntegerType;
347
+ }>;
348
+ /** LightGBM classifier */
349
+ lightgbm_classifier: StructType<{
350
+ data: BlobType;
351
+ n_features: IntegerType;
352
+ n_classes: IntegerType;
353
+ }>;
354
+ }>;
355
+ /** Any model blob type for kernel explainer */
356
+ readonly AnyModelBlobType: VariantType<{
357
+ xgboost_regressor: StructType<{
358
+ data: BlobType;
359
+ n_features: IntegerType;
360
+ }>;
361
+ xgboost_classifier: StructType<{
362
+ data: BlobType;
363
+ n_features: IntegerType;
364
+ n_classes: IntegerType;
365
+ }>;
366
+ lightgbm_regressor: StructType<{
367
+ data: BlobType;
368
+ n_features: IntegerType;
369
+ }>;
370
+ lightgbm_classifier: StructType<{
371
+ data: BlobType;
372
+ n_features: IntegerType;
373
+ n_classes: IntegerType;
374
+ }>;
375
+ ngboost_regressor: StructType<{
376
+ data: BlobType;
377
+ distribution: VariantType<{
378
+ normal: StructType<{}>;
379
+ lognormal: StructType<{}>;
380
+ }>;
381
+ n_features: IntegerType;
382
+ }>;
383
+ gp_regressor: StructType<{
384
+ data: BlobType;
385
+ n_features: IntegerType;
386
+ kernel_type: StringType;
387
+ }>;
388
+ torch_mlp: StructType<{
389
+ data: BlobType;
390
+ n_features: IntegerType;
391
+ hidden_layers: ArrayType<IntegerType>;
392
+ output_dim: IntegerType;
393
+ }>;
394
+ }>;
395
+ };
396
+ /**
397
+ * SHAP explainability functions.
398
+ *
399
+ * Provides model-agnostic feature importance and SHAP value computation.
400
+ *
401
+ * @example
402
+ * ```ts
403
+ * import { East, variant } from "@elaraai/east";
404
+ * import { Shap, LightGBM } from "@elaraai/east-py-datascience";
405
+ *
406
+ * const explain = East.function([LightGBM.Types.ModelBlobType, Shap.Types.MatrixType], Shap.Types.ShapResultType, ($, model, X) => {
407
+ * // Create explainer
408
+ * const explainer = $.let(Shap.treeExplainerCreate(model));
409
+ *
410
+ * // Compute SHAP values
411
+ * const feature_names = $.let(["feature1", "feature2"]);
412
+ * const result = $.let(Shap.computeValues(explainer, X, feature_names));
413
+ *
414
+ * return $.return(result);
415
+ * });
416
+ * ```
417
+ */
418
+ export declare const Shap: {
419
+ /** Create TreeExplainer for tree-based models */
420
+ readonly treeExplainerCreate: import("@elaraai/east").PlatformDefinition<[VariantType<{
421
+ /** XGBoost regressor */
422
+ xgboost_regressor: StructType<{
423
+ data: BlobType;
424
+ n_features: IntegerType;
425
+ }>;
426
+ /** XGBoost classifier */
427
+ xgboost_classifier: StructType<{
428
+ data: BlobType;
429
+ n_features: IntegerType;
430
+ n_classes: IntegerType;
431
+ }>;
432
+ /** LightGBM regressor */
433
+ lightgbm_regressor: StructType<{
434
+ data: BlobType;
435
+ n_features: IntegerType;
436
+ }>;
437
+ /** LightGBM classifier */
438
+ lightgbm_classifier: StructType<{
439
+ data: BlobType;
440
+ n_features: IntegerType;
441
+ n_classes: IntegerType;
442
+ }>;
443
+ }>], VariantType<{
444
+ /** SHAP TreeExplainer for tree-based models */
445
+ shap_tree_explainer: StructType<{
446
+ /** Cloudpickle serialized explainer */
447
+ data: BlobType;
448
+ /** Number of input features */
449
+ n_features: IntegerType;
450
+ }>;
451
+ /** SHAP KernelExplainer for any model */
452
+ shap_kernel_explainer: StructType<{
453
+ /** Cloudpickle serialized explainer */
454
+ data: BlobType;
455
+ /** Number of input features */
456
+ n_features: IntegerType;
457
+ }>;
458
+ }>>;
459
+ /** Create KernelExplainer for any model */
460
+ readonly kernelExplainerCreate: import("@elaraai/east").PlatformDefinition<[VariantType<{
461
+ xgboost_regressor: StructType<{
462
+ data: BlobType;
463
+ n_features: IntegerType;
464
+ }>;
465
+ xgboost_classifier: StructType<{
466
+ data: BlobType;
467
+ n_features: IntegerType;
468
+ n_classes: IntegerType;
469
+ }>;
470
+ lightgbm_regressor: StructType<{
471
+ data: BlobType;
472
+ n_features: IntegerType;
473
+ }>;
474
+ lightgbm_classifier: StructType<{
475
+ data: BlobType;
476
+ n_features: IntegerType;
477
+ n_classes: IntegerType;
478
+ }>;
479
+ ngboost_regressor: StructType<{
480
+ data: BlobType;
481
+ distribution: VariantType<{
482
+ normal: StructType<{}>;
483
+ lognormal: StructType<{}>;
484
+ }>;
485
+ n_features: IntegerType;
486
+ }>;
487
+ gp_regressor: StructType<{
488
+ data: BlobType;
489
+ n_features: IntegerType;
490
+ kernel_type: StringType;
491
+ }>;
492
+ torch_mlp: StructType<{
493
+ data: BlobType;
494
+ n_features: IntegerType;
495
+ hidden_layers: ArrayType<IntegerType>;
496
+ output_dim: IntegerType;
497
+ }>;
498
+ }>, ArrayType<ArrayType<FloatType>>], VariantType<{
499
+ /** SHAP TreeExplainer for tree-based models */
500
+ shap_tree_explainer: StructType<{
501
+ /** Cloudpickle serialized explainer */
502
+ data: BlobType;
503
+ /** Number of input features */
504
+ n_features: IntegerType;
505
+ }>;
506
+ /** SHAP KernelExplainer for any model */
507
+ shap_kernel_explainer: StructType<{
508
+ /** Cloudpickle serialized explainer */
509
+ data: BlobType;
510
+ /** Number of input features */
511
+ n_features: IntegerType;
512
+ }>;
513
+ }>>;
514
+ /** Compute SHAP values */
515
+ readonly computeValues: import("@elaraai/east").PlatformDefinition<[VariantType<{
516
+ /** SHAP TreeExplainer for tree-based models */
517
+ shap_tree_explainer: StructType<{
518
+ /** Cloudpickle serialized explainer */
519
+ data: BlobType;
520
+ /** Number of input features */
521
+ n_features: IntegerType;
522
+ }>;
523
+ /** SHAP KernelExplainer for any model */
524
+ shap_kernel_explainer: StructType<{
525
+ /** Cloudpickle serialized explainer */
526
+ data: BlobType;
527
+ /** Number of input features */
528
+ n_features: IntegerType;
529
+ }>;
530
+ }>, ArrayType<ArrayType<FloatType>>, ArrayType<StringType>], StructType<{
531
+ /** SHAP values matrix (n_samples x n_features) */
532
+ shap_values: ArrayType<ArrayType<FloatType>>;
533
+ /** Base value (expected model output) */
534
+ base_value: FloatType;
535
+ /** Feature names */
536
+ feature_names: ArrayType<StringType>;
537
+ }>>;
538
+ /** Compute feature importance from SHAP values */
539
+ readonly featureImportance: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<StringType>], StructType<{
540
+ /** Feature names */
541
+ feature_names: ArrayType<StringType>;
542
+ /** Mean absolute SHAP value for each feature */
543
+ importances: ArrayType<FloatType>;
544
+ /** Standard deviation of absolute SHAP values */
545
+ std: OptionType<ArrayType<FloatType>>;
546
+ }>>;
547
+ /** Type definitions */
548
+ readonly Types: {
549
+ /** Vector type (array of floats) */
550
+ readonly VectorType: ArrayType<FloatType>;
551
+ /** Matrix type (2D array of floats) */
552
+ readonly MatrixType: ArrayType<ArrayType<FloatType>>;
553
+ /** String vector type */
554
+ readonly StringVectorType: ArrayType<StringType>;
555
+ /** SHAP result type */
556
+ readonly ShapResultType: StructType<{
557
+ /** SHAP values matrix (n_samples x n_features) */
558
+ shap_values: ArrayType<ArrayType<FloatType>>;
559
+ /** Base value (expected model output) */
560
+ base_value: FloatType;
561
+ /** Feature names */
562
+ feature_names: ArrayType<StringType>;
563
+ }>;
564
+ /** Feature importance type */
565
+ readonly FeatureImportanceType: StructType<{
566
+ /** Feature names */
567
+ feature_names: ArrayType<StringType>;
568
+ /** Mean absolute SHAP value for each feature */
569
+ importances: ArrayType<FloatType>;
570
+ /** Standard deviation of absolute SHAP values */
571
+ std: OptionType<ArrayType<FloatType>>;
572
+ }>;
573
+ /** SHAP explainer model blob type */
574
+ readonly ShapModelBlobType: VariantType<{
575
+ /** SHAP TreeExplainer for tree-based models */
576
+ shap_tree_explainer: StructType<{
577
+ /** Cloudpickle serialized explainer */
578
+ data: BlobType;
579
+ /** Number of input features */
580
+ n_features: IntegerType;
581
+ }>;
582
+ /** SHAP KernelExplainer for any model */
583
+ shap_kernel_explainer: StructType<{
584
+ /** Cloudpickle serialized explainer */
585
+ data: BlobType;
586
+ /** Number of input features */
587
+ n_features: IntegerType;
588
+ }>;
589
+ }>;
590
+ /** Tree model blob type for input */
591
+ readonly TreeModelBlobType: VariantType<{
592
+ /** XGBoost regressor */
593
+ xgboost_regressor: StructType<{
594
+ data: BlobType;
595
+ n_features: IntegerType;
596
+ }>;
597
+ /** XGBoost classifier */
598
+ xgboost_classifier: StructType<{
599
+ data: BlobType;
600
+ n_features: IntegerType;
601
+ n_classes: IntegerType;
602
+ }>;
603
+ /** LightGBM regressor */
604
+ lightgbm_regressor: StructType<{
605
+ data: BlobType;
606
+ n_features: IntegerType;
607
+ }>;
608
+ /** LightGBM classifier */
609
+ lightgbm_classifier: StructType<{
610
+ data: BlobType;
611
+ n_features: IntegerType;
612
+ n_classes: IntegerType;
613
+ }>;
614
+ }>;
615
+ /** Any model blob type for kernel explainer */
616
+ readonly AnyModelBlobType: VariantType<{
617
+ xgboost_regressor: StructType<{
618
+ data: BlobType;
619
+ n_features: IntegerType;
620
+ }>;
621
+ xgboost_classifier: StructType<{
622
+ data: BlobType;
623
+ n_features: IntegerType;
624
+ n_classes: IntegerType;
625
+ }>;
626
+ lightgbm_regressor: StructType<{
627
+ data: BlobType;
628
+ n_features: IntegerType;
629
+ }>;
630
+ lightgbm_classifier: StructType<{
631
+ data: BlobType;
632
+ n_features: IntegerType;
633
+ n_classes: IntegerType;
634
+ }>;
635
+ ngboost_regressor: StructType<{
636
+ data: BlobType;
637
+ distribution: VariantType<{
638
+ normal: StructType<{}>;
639
+ lognormal: StructType<{}>;
640
+ }>;
641
+ n_features: IntegerType;
642
+ }>;
643
+ gp_regressor: StructType<{
644
+ data: BlobType;
645
+ n_features: IntegerType;
646
+ kernel_type: StringType;
647
+ }>;
648
+ torch_mlp: StructType<{
649
+ data: BlobType;
650
+ n_features: IntegerType;
651
+ hidden_layers: ArrayType<IntegerType>;
652
+ output_dim: IntegerType;
653
+ }>;
654
+ }>;
655
+ };
656
+ };
657
+ //# sourceMappingURL=shap.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shap.d.ts","sourceRoot":"","sources":["../../src/shap/shap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EAEH,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,UAAU,EACV,SAAS,EACT,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