@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,241 @@
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
+ * LightGBM platform functions for East.
7
+ *
8
+ * Provides fast gradient boosting for regression and classification.
9
+ * Uses cloudpickle for model serialization.
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { East, StructType, VariantType, OptionType, IntegerType, FloatType, BlobType, } 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
+ // Config Types
19
+ // ============================================================================
20
+ /**
21
+ * Configuration for LightGBM models.
22
+ */
23
+ export const LightGBMConfigType = StructType({
24
+ /** Number of boosting rounds (default 100) */
25
+ n_estimators: OptionType(IntegerType),
26
+ /** Maximum tree depth, -1 for unlimited (default -1) */
27
+ max_depth: OptionType(IntegerType),
28
+ /** Learning rate / step size shrinkage (default 0.1) */
29
+ learning_rate: OptionType(FloatType),
30
+ /** Maximum number of leaves in one tree (default 31) */
31
+ num_leaves: OptionType(IntegerType),
32
+ /** Minimum number of samples required in a leaf (default 20) */
33
+ min_child_samples: OptionType(IntegerType),
34
+ /** Subsample ratio of training instances (default 1.0) */
35
+ subsample: OptionType(FloatType),
36
+ /** Subsample ratio of columns when constructing trees (default 1.0) */
37
+ colsample_bytree: OptionType(FloatType),
38
+ /** L1 regularization term (default 0) */
39
+ reg_alpha: OptionType(FloatType),
40
+ /** L2 regularization term (default 0) */
41
+ reg_lambda: OptionType(FloatType),
42
+ /** Random seed for reproducibility */
43
+ random_state: OptionType(IntegerType),
44
+ /** Number of parallel threads (default -1 for all cores) */
45
+ n_jobs: OptionType(IntegerType),
46
+ });
47
+ // ============================================================================
48
+ // Model Blob Types
49
+ // ============================================================================
50
+ /**
51
+ * Model blob type for serialized LightGBM models.
52
+ *
53
+ * Each model type has its own variant case containing cloudpickle bytes and metadata.
54
+ */
55
+ export const LightGBMModelBlobType = VariantType({
56
+ /** LightGBM regressor model */
57
+ lightgbm_regressor: StructType({
58
+ /** Cloudpickle serialized model */
59
+ data: BlobType,
60
+ /** Number of input features */
61
+ n_features: IntegerType,
62
+ }),
63
+ /** LightGBM classifier model */
64
+ lightgbm_classifier: StructType({
65
+ /** Cloudpickle serialized model */
66
+ data: BlobType,
67
+ /** Number of input features */
68
+ n_features: IntegerType,
69
+ /** Number of classes */
70
+ n_classes: IntegerType,
71
+ }),
72
+ });
73
+ // ============================================================================
74
+ // Platform Functions
75
+ // ============================================================================
76
+ /**
77
+ * Train a LightGBM regression model.
78
+ *
79
+ * @param X - Feature matrix
80
+ * @param y - Target vector
81
+ * @param config - LightGBM configuration
82
+ * @returns Model blob containing trained regressor
83
+ */
84
+ export const lightgbm_train_regressor = East.platform("lightgbm_train_regressor", [MatrixType(FloatType), VectorType(FloatType), LightGBMConfigType], LightGBMModelBlobType);
85
+ /**
86
+ * Train a LightGBM classification model.
87
+ *
88
+ * @param X - Feature matrix
89
+ * @param y - Label vector (integer class labels)
90
+ * @param config - LightGBM configuration
91
+ * @returns Model blob containing trained classifier
92
+ */
93
+ export const lightgbm_train_classifier = East.platform("lightgbm_train_classifier", [MatrixType(FloatType), VectorType(IntegerType), LightGBMConfigType], LightGBMModelBlobType);
94
+ /**
95
+ * Make predictions with a trained LightGBM regressor.
96
+ *
97
+ * @param model - Trained regressor model blob
98
+ * @param X - Feature matrix
99
+ * @returns Predicted values
100
+ */
101
+ export const lightgbm_predict = East.platform("lightgbm_predict", [LightGBMModelBlobType, MatrixType(FloatType)], VectorType(FloatType));
102
+ /**
103
+ * Predict class labels with a trained LightGBM classifier.
104
+ *
105
+ * @param model - Trained classifier model blob
106
+ * @param X - Feature matrix
107
+ * @returns Predicted class labels
108
+ */
109
+ export const lightgbm_predict_class = East.platform("lightgbm_predict_class", [LightGBMModelBlobType, MatrixType(FloatType)], VectorType(IntegerType));
110
+ /**
111
+ * Get class probabilities from a trained LightGBM classifier.
112
+ *
113
+ * @param model - Trained classifier model blob
114
+ * @param X - Feature matrix
115
+ * @returns Probability matrix (n_samples x n_classes)
116
+ */
117
+ export const lightgbm_predict_proba = East.platform("lightgbm_predict_proba", [LightGBMModelBlobType, MatrixType(FloatType)], MatrixType(FloatType));
118
+ // ============================================================================
119
+ // Grouped Export
120
+ // ============================================================================
121
+ /**
122
+ * Type definitions for LightGBM functions.
123
+ */
124
+ export const LightGBMTypes = {
125
+ /** LightGBM configuration type */
126
+ LightGBMConfigType,
127
+ /** Model blob type for LightGBM models */
128
+ ModelBlobType: LightGBMModelBlobType,
129
+ };
130
+ /**
131
+ * LightGBM gradient boosting.
132
+ *
133
+ * Provides fast regression and classification with gradient boosted decision trees.
134
+ */
135
+ export const LightGBM = {
136
+ /**
137
+ * Train a LightGBM regression model.
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * import { East, FloatType, MatrixType, VectorType, variant } from "@elaraai/east";
142
+ * import { LightGBM, LightGBMConfigType } from "@elaraai/east-py-datascience";
143
+ *
144
+ * const train = East.function([], LightGBM.Types.ModelBlobType, ($) => {
145
+ * const X = $.let([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]]);
146
+ * const y = $.let(new Float64Array([1.0, 2.0, 3.0, 4.0]));
147
+ * const config = $.let({
148
+ * n_estimators: variant("some", 100n), max_depth: variant("some", 3n),
149
+ * learning_rate: variant("some", 0.1), num_leaves: variant("none", null),
150
+ * min_child_samples: variant("none", null), subsample: variant("none", null),
151
+ * colsample_bytree: variant("none", null), reg_alpha: variant("none", null),
152
+ * reg_lambda: variant("none", null), random_state: variant("some", 42n),
153
+ * n_jobs: variant("none", null),
154
+ * }, LightGBMConfigType);
155
+ * return $.return(LightGBM.trainRegressor(X, y, config));
156
+ * });
157
+ * ```
158
+ */
159
+ trainRegressor: lightgbm_train_regressor,
160
+ /**
161
+ * Train a LightGBM classification model.
162
+ *
163
+ * @example
164
+ * ```ts
165
+ * import { East, FloatType, IntegerType, MatrixType, VectorType, variant } from "@elaraai/east";
166
+ * import { LightGBM, LightGBMConfigType } from "@elaraai/east-py-datascience";
167
+ *
168
+ * const train = East.function([], LightGBM.Types.ModelBlobType, ($) => {
169
+ * const X = $.let([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]]);
170
+ * const y = $.let(new BigInt64Array([0n, 1n, 0n, 1n]));
171
+ * const config = $.let({
172
+ * n_estimators: variant("some", 50n), max_depth: variant("some", 3n),
173
+ * learning_rate: variant("some", 0.1), num_leaves: variant("none", null),
174
+ * min_child_samples: variant("none", null), subsample: variant("none", null),
175
+ * colsample_bytree: variant("none", null), reg_alpha: variant("none", null),
176
+ * reg_lambda: variant("none", null), random_state: variant("some", 42n),
177
+ * n_jobs: variant("none", null),
178
+ * }, LightGBMConfigType);
179
+ * return $.return(LightGBM.trainClassifier(X, y, config));
180
+ * });
181
+ * ```
182
+ */
183
+ trainClassifier: lightgbm_train_classifier,
184
+ /**
185
+ * Make predictions with a trained LightGBM regressor.
186
+ *
187
+ * @example
188
+ * ```ts
189
+ * import { East, FloatType, MatrixType, VectorType } from "@elaraai/east";
190
+ * import { LightGBM } from "@elaraai/east-py-datascience";
191
+ *
192
+ * const predictFn = East.function(
193
+ * [LightGBM.Types.ModelBlobType, MatrixType(FloatType)],
194
+ * VectorType(FloatType),
195
+ * ($, model, X) => {
196
+ * return $.return(LightGBM.predict(model, X));
197
+ * }
198
+ * );
199
+ * ```
200
+ */
201
+ predict: lightgbm_predict,
202
+ /**
203
+ * Predict class labels with a trained LightGBM classifier.
204
+ *
205
+ * @example
206
+ * ```ts
207
+ * import { East, FloatType, IntegerType, MatrixType, VectorType } from "@elaraai/east";
208
+ * import { LightGBM } from "@elaraai/east-py-datascience";
209
+ *
210
+ * const predictFn = East.function(
211
+ * [LightGBM.Types.ModelBlobType, MatrixType(FloatType)],
212
+ * VectorType(IntegerType),
213
+ * ($, model, X) => {
214
+ * return $.return(LightGBM.predictClass(model, X));
215
+ * }
216
+ * );
217
+ * ```
218
+ */
219
+ predictClass: lightgbm_predict_class,
220
+ /**
221
+ * Get class probabilities from a trained LightGBM classifier.
222
+ *
223
+ * @example
224
+ * ```ts
225
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
226
+ * import { LightGBM } from "@elaraai/east-py-datascience";
227
+ *
228
+ * const predictFn = East.function(
229
+ * [LightGBM.Types.ModelBlobType, MatrixType(FloatType)],
230
+ * MatrixType(FloatType),
231
+ * ($, model, X) => {
232
+ * return $.return(LightGBM.predictProba(model, X));
233
+ * }
234
+ * );
235
+ * ```
236
+ */
237
+ predictProba: lightgbm_predict_proba,
238
+ /** Type definitions */
239
+ Types: LightGBMTypes,
240
+ };
241
+ //# sourceMappingURL=lightgbm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lightgbm.js","sourceRoot":"","sources":["../../../src/lightgbm/lightgbm.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AAEH,OAAO,EACH,IAAI,EACJ,UAAU,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,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,eAAe;AACf,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,kBAA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