@elaraai/east-py-datascience 0.0.2-beta.9 → 1.0.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 (58) hide show
  1. package/CLA.md +26 -0
  2. package/CONTRIBUTING.md +28 -0
  3. package/LICENSE.md +2 -2
  4. package/README.md +108 -15
  5. package/package.json +21 -42
  6. package/dist/gp/gp.d.ts +0 -398
  7. package/dist/gp/gp.d.ts.map +0 -1
  8. package/dist/gp/gp.js +0 -170
  9. package/dist/gp/gp.js.map +0 -1
  10. package/dist/index.d.ts +0 -27
  11. package/dist/index.d.ts.map +0 -1
  12. package/dist/index.js +0 -41
  13. package/dist/index.js.map +0 -1
  14. package/dist/lightgbm/lightgbm.d.ts +0 -494
  15. package/dist/lightgbm/lightgbm.d.ts.map +0 -1
  16. package/dist/lightgbm/lightgbm.js +0 -155
  17. package/dist/lightgbm/lightgbm.js.map +0 -1
  18. package/dist/mads/mads.d.ts +0 -413
  19. package/dist/mads/mads.d.ts.map +0 -1
  20. package/dist/mads/mads.js +0 -221
  21. package/dist/mads/mads.js.map +0 -1
  22. package/dist/ngboost/ngboost.d.ts +0 -433
  23. package/dist/ngboost/ngboost.d.ts.map +0 -1
  24. package/dist/ngboost/ngboost.js +0 -178
  25. package/dist/ngboost/ngboost.js.map +0 -1
  26. package/dist/optuna/optuna.d.ts +0 -797
  27. package/dist/optuna/optuna.d.ts.map +0 -1
  28. package/dist/optuna/optuna.js +0 -268
  29. package/dist/optuna/optuna.js.map +0 -1
  30. package/dist/scipy/scipy.d.ts +0 -1260
  31. package/dist/scipy/scipy.d.ts.map +0 -1
  32. package/dist/scipy/scipy.js +0 -413
  33. package/dist/scipy/scipy.js.map +0 -1
  34. package/dist/shap/shap.d.ts +0 -657
  35. package/dist/shap/shap.d.ts.map +0 -1
  36. package/dist/shap/shap.js +0 -241
  37. package/dist/shap/shap.js.map +0 -1
  38. package/dist/simanneal/simanneal.d.ts +0 -531
  39. package/dist/simanneal/simanneal.d.ts.map +0 -1
  40. package/dist/simanneal/simanneal.js +0 -231
  41. package/dist/simanneal/simanneal.js.map +0 -1
  42. package/dist/sklearn/sklearn.d.ts +0 -2691
  43. package/dist/sklearn/sklearn.d.ts.map +0 -1
  44. package/dist/sklearn/sklearn.js +0 -524
  45. package/dist/sklearn/sklearn.js.map +0 -1
  46. package/dist/torch/torch.d.ts +0 -1081
  47. package/dist/torch/torch.d.ts.map +0 -1
  48. package/dist/torch/torch.js +0 -349
  49. package/dist/torch/torch.js.map +0 -1
  50. package/dist/tsconfig.tsbuildinfo +0 -1
  51. package/dist/types.d.ts +0 -80
  52. package/dist/types.d.ts.map +0 -1
  53. package/dist/types.js +0 -81
  54. package/dist/types.js.map +0 -1
  55. package/dist/xgboost/xgboost.d.ts +0 -504
  56. package/dist/xgboost/xgboost.d.ts.map +0 -1
  57. package/dist/xgboost/xgboost.js +0 -177
  58. package/dist/xgboost/xgboost.js.map +0 -1
@@ -1,177 +0,0 @@
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
- * XGBoost platform functions for East.
7
- *
8
- * Provides gradient boosting for regression and classification.
9
- * Uses ONNX for model serialization to enable portable inference.
10
- *
11
- * @packageDocumentation
12
- */
13
- import { East, StructType, VariantType, OptionType, IntegerType, FloatType, BlobType, } from "@elaraai/east";
14
- import { VectorType, MatrixType, LabelVectorType } from "../types.js";
15
- // Re-export shared types for convenience
16
- export { VectorType, MatrixType, LabelVectorType } from "../types.js";
17
- // ============================================================================
18
- // Config Types
19
- // ============================================================================
20
- /**
21
- * Configuration for XGBoost models.
22
- */
23
- export const XGBoostConfigType = StructType({
24
- /** Number of boosting rounds (default 100) */
25
- n_estimators: OptionType(IntegerType),
26
- /** Maximum tree depth (default 6) */
27
- max_depth: OptionType(IntegerType),
28
- /** Learning rate / step size shrinkage (default 0.3) */
29
- learning_rate: OptionType(FloatType),
30
- /** Minimum sum of instance weight needed in a child (default 1) */
31
- min_child_weight: OptionType(IntegerType),
32
- /** Subsample ratio of training instances (default 1.0) */
33
- subsample: OptionType(FloatType),
34
- /** Subsample ratio of columns when constructing trees (default 1.0) */
35
- colsample_bytree: OptionType(FloatType),
36
- /** L1 regularization term (default 0) */
37
- reg_alpha: OptionType(FloatType),
38
- /** L2 regularization term (default 1) */
39
- reg_lambda: OptionType(FloatType),
40
- /** Random seed for reproducibility */
41
- random_state: OptionType(IntegerType),
42
- /** Number of parallel threads (default -1 for all cores) */
43
- n_jobs: OptionType(IntegerType),
44
- });
45
- // ============================================================================
46
- // Model Blob Types
47
- // ============================================================================
48
- /**
49
- * Model blob type for serialized XGBoost models.
50
- *
51
- * Each model type has its own variant case containing cloudpickle bytes and metadata.
52
- */
53
- export const XGBoostModelBlobType = VariantType({
54
- /** XGBoost regressor model */
55
- xgboost_regressor: StructType({
56
- /** Cloudpickle serialized model */
57
- data: BlobType,
58
- /** Number of input features */
59
- n_features: IntegerType,
60
- }),
61
- /** XGBoost classifier model */
62
- xgboost_classifier: StructType({
63
- /** Cloudpickle serialized model */
64
- data: BlobType,
65
- /** Number of input features */
66
- n_features: IntegerType,
67
- /** Number of classes */
68
- n_classes: IntegerType,
69
- }),
70
- });
71
- // ============================================================================
72
- // Platform Functions
73
- // ============================================================================
74
- /**
75
- * Train an XGBoost regression model.
76
- *
77
- * @param X - Feature matrix
78
- * @param y - Target vector
79
- * @param config - XGBoost configuration
80
- * @returns Model blob containing trained regressor
81
- */
82
- export const xgboost_train_regressor = East.platform("xgboost_train_regressor", [MatrixType, VectorType, XGBoostConfigType], XGBoostModelBlobType);
83
- /**
84
- * Train an XGBoost classification model.
85
- *
86
- * @param X - Feature matrix
87
- * @param y - Label vector (integer class labels)
88
- * @param config - XGBoost configuration
89
- * @returns Model blob containing trained classifier
90
- */
91
- export const xgboost_train_classifier = East.platform("xgboost_train_classifier", [MatrixType, LabelVectorType, XGBoostConfigType], XGBoostModelBlobType);
92
- /**
93
- * Make predictions with a trained XGBoost regressor.
94
- *
95
- * @param model - Trained regressor model blob
96
- * @param X - Feature matrix
97
- * @returns Predicted values
98
- */
99
- export const xgboost_predict = East.platform("xgboost_predict", [XGBoostModelBlobType, MatrixType], VectorType);
100
- /**
101
- * Predict class labels with a trained XGBoost classifier.
102
- *
103
- * @param model - Trained classifier model blob
104
- * @param X - Feature matrix
105
- * @returns Predicted class labels
106
- */
107
- export const xgboost_predict_class = East.platform("xgboost_predict_class", [XGBoostModelBlobType, MatrixType], LabelVectorType);
108
- /**
109
- * Get class probabilities from a trained XGBoost classifier.
110
- *
111
- * @param model - Trained classifier model blob
112
- * @param X - Feature matrix
113
- * @returns Probability matrix (n_samples x n_classes)
114
- */
115
- export const xgboost_predict_proba = East.platform("xgboost_predict_proba", [XGBoostModelBlobType, MatrixType], MatrixType);
116
- // ============================================================================
117
- // Grouped Export
118
- // ============================================================================
119
- /**
120
- * Type definitions for XGBoost functions.
121
- */
122
- export const XGBoostTypes = {
123
- /** Vector type (array of floats) */
124
- VectorType,
125
- /** Matrix type (2D array of floats) */
126
- MatrixType,
127
- /** Label vector type (array of integers) */
128
- LabelVectorType,
129
- /** XGBoost configuration type */
130
- XGBoostConfigType,
131
- /** Model blob type for XGBoost models */
132
- ModelBlobType: XGBoostModelBlobType,
133
- };
134
- /**
135
- * XGBoost gradient boosting.
136
- *
137
- * Provides regression and classification with gradient boosted decision trees.
138
- *
139
- * @example
140
- * ```ts
141
- * import { East, variant } from "@elaraai/east";
142
- * import { XGBoost } from "@elaraai/east-py-datascience";
143
- *
144
- * const train = East.function([], XGBoost.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([1.0, 2.0, 3.0, 4.0]);
147
- * const config = $.let({
148
- * n_estimators: variant('some', 100n),
149
- * max_depth: variant('some', 3n),
150
- * learning_rate: variant('some', 0.1),
151
- * min_child_weight: variant('none', null),
152
- * subsample: variant('none', null),
153
- * colsample_bytree: variant('none', null),
154
- * reg_alpha: variant('none', null),
155
- * reg_lambda: variant('none', null),
156
- * random_state: variant('some', 42n),
157
- * n_jobs: variant('none', null),
158
- * });
159
- * return $.return(XGBoost.trainRegressor(X, y, config));
160
- * });
161
- * ```
162
- */
163
- export const XGBoost = {
164
- /** Train XGBoost regressor */
165
- trainRegressor: xgboost_train_regressor,
166
- /** Train XGBoost classifier */
167
- trainClassifier: xgboost_train_classifier,
168
- /** Make predictions with regressor */
169
- predict: xgboost_predict,
170
- /** Predict class labels with classifier */
171
- predictClass: xgboost_predict_class,
172
- /** Get class probabilities from classifier */
173
- predictProba: xgboost_predict_proba,
174
- /** Type definitions */
175
- Types: XGBoostTypes,
176
- };
177
- //# sourceMappingURL=xgboost.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xgboost.js","sourceRoot":"","sources":["../../src/xgboost/xgboost.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,eAAe,EAAE,MAAM,aAAa,CAAC;AAEtE,yCAAyC;AACzC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEtE,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;IACxC,8CAA8C;IAC9C,YAAY,EAAE,UAAU,CAAC,WAAW,CAAC;IACrC,qCAAqC;IACrC,SAAS,EAAE,UAAU,CAAC,WAAW,CAAC;IAClC,wDAAwD;IACxD,aAAa,EAAE,UAAU,CAAC,SAAS,CAAC;IACpC,mEAAmE;IACnE,gBAAgB,EAAE,UAAU,CAAC,WAAW,C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