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

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.
@@ -41,6 +41,38 @@ export const XGBoostConfigType = StructType({
41
41
  random_state: OptionType(IntegerType),
42
42
  /** Number of parallel threads (default -1 for all cores) */
43
43
  n_jobs: OptionType(IntegerType),
44
+ /** Sample weights for training (one per sample, default uniform) */
45
+ sample_weight: OptionType(VectorType),
46
+ });
47
+ /**
48
+ * Configuration for XGBoost quantile regression.
49
+ * Trains separate models for each quantile.
50
+ */
51
+ export const XGBoostQuantileConfigType = StructType({
52
+ /** Quantiles to predict (e.g., [0.1, 0.5, 0.9] for 80% interval + median) */
53
+ quantiles: VectorType,
54
+ /** Number of boosting rounds (default 100) */
55
+ n_estimators: OptionType(IntegerType),
56
+ /** Maximum tree depth (default 6) */
57
+ max_depth: OptionType(IntegerType),
58
+ /** Learning rate / step size shrinkage (default 0.3) */
59
+ learning_rate: OptionType(FloatType),
60
+ /** Minimum sum of instance weight needed in a child (default 1) */
61
+ min_child_weight: OptionType(IntegerType),
62
+ /** Subsample ratio of training instances (default 1.0) */
63
+ subsample: OptionType(FloatType),
64
+ /** Subsample ratio of columns when constructing trees (default 1.0) */
65
+ colsample_bytree: OptionType(FloatType),
66
+ /** L1 regularization term (default 0) */
67
+ reg_alpha: OptionType(FloatType),
68
+ /** L2 regularization term (default 1) */
69
+ reg_lambda: OptionType(FloatType),
70
+ /** Random seed for reproducibility */
71
+ random_state: OptionType(IntegerType),
72
+ /** Number of parallel threads (default -1 for all cores) */
73
+ n_jobs: OptionType(IntegerType),
74
+ /** Sample weights for training (one per sample, default uniform) */
75
+ sample_weight: OptionType(VectorType),
44
76
  });
45
77
  // ============================================================================
46
78
  // Model Blob Types
@@ -67,6 +99,24 @@ export const XGBoostModelBlobType = VariantType({
67
99
  /** Number of classes */
68
100
  n_classes: IntegerType,
69
101
  }),
102
+ /** XGBoost quantile regressor (multiple models, one per quantile) */
103
+ xgboost_quantile: StructType({
104
+ /** Cloudpickle serialized dict of {quantile: model} */
105
+ data: BlobType,
106
+ /** Quantiles this model predicts */
107
+ quantiles: VectorType,
108
+ /** Number of input features */
109
+ n_features: IntegerType,
110
+ }),
111
+ });
112
+ /**
113
+ * Result from XGBoost quantile prediction.
114
+ */
115
+ export const XGBoostQuantilePredictResultType = StructType({
116
+ /** Quantile values that were predicted */
117
+ quantiles: VectorType,
118
+ /** Predictions matrix: (n_samples x n_quantiles) */
119
+ predictions: MatrixType,
70
120
  });
71
121
  // ============================================================================
72
122
  // Platform Functions
@@ -113,6 +163,26 @@ export const xgboost_predict_class = East.platform("xgboost_predict_class", [XGB
113
163
  * @returns Probability matrix (n_samples x n_classes)
114
164
  */
115
165
  export const xgboost_predict_proba = East.platform("xgboost_predict_proba", [XGBoostModelBlobType, MatrixType], MatrixType);
166
+ /**
167
+ * Train XGBoost quantile regression models.
168
+ *
169
+ * Trains one model per quantile using pinball loss (reg:quantileerror).
170
+ * This provides prediction intervals and uncertainty quantification.
171
+ *
172
+ * @param X - Feature matrix
173
+ * @param y - Target vector
174
+ * @param config - Quantile regression configuration (includes quantiles array)
175
+ * @returns Model blob containing trained quantile models
176
+ */
177
+ export const xgboost_train_quantile = East.platform("xgboost_train_quantile", [MatrixType, VectorType, XGBoostQuantileConfigType], XGBoostModelBlobType);
178
+ /**
179
+ * Predict quantiles with trained XGBoost quantile regressor.
180
+ *
181
+ * @param model - Trained quantile model blob
182
+ * @param X - Feature matrix
183
+ * @returns Quantiles and predictions matrix (n_samples x n_quantiles)
184
+ */
185
+ export const xgboost_predict_quantile = East.platform("xgboost_predict_quantile", [XGBoostModelBlobType, MatrixType], XGBoostQuantilePredictResultType);
116
186
  // ============================================================================
117
187
  // Grouped Export
118
188
  // ============================================================================
@@ -128,6 +198,10 @@ export const XGBoostTypes = {
128
198
  LabelVectorType,
129
199
  /** XGBoost configuration type */
130
200
  XGBoostConfigType,
201
+ /** XGBoost quantile configuration type */
202
+ XGBoostQuantileConfigType,
203
+ /** Quantile prediction result type */
204
+ XGBoostQuantilePredictResultType,
131
205
  /** Model blob type for XGBoost models */
132
206
  ModelBlobType: XGBoostModelBlobType,
133
207
  };
@@ -155,6 +229,7 @@ export const XGBoostTypes = {
155
229
  * reg_lambda: variant('none', null),
156
230
  * random_state: variant('some', 42n),
157
231
  * n_jobs: variant('none', null),
232
+ * sample_weight: variant('none', null),
158
233
  * });
159
234
  * return $.return(XGBoost.trainRegressor(X, y, config));
160
235
  * });
@@ -165,12 +240,16 @@ export const XGBoost = {
165
240
  trainRegressor: xgboost_train_regressor,
166
241
  /** Train XGBoost classifier */
167
242
  trainClassifier: xgboost_train_classifier,
243
+ /** Train XGBoost quantile regressor */
244
+ trainQuantile: xgboost_train_quantile,
168
245
  /** Make predictions with regressor */
169
246
  predict: xgboost_predict,
170
247
  /** Predict class labels with classifier */
171
248
  predictClass: xgboost_predict_class,
172
249
  /** Get class probabilities from classifier */
173
250
  predictProba: xgboost_predict_proba,
251
+ /** Predict quantiles with quantile regressor */
252
+ predictQuantile: xgboost_predict_quantile,
174
253
  /** Type definitions */
175
254
  Types: XGBoostTypes,
176
255
  };
@@ -1 +1 @@
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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CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,QAAQ,CACjD,0BAA0B,EAC1B,CAAC,oBAAoB,EAAE,UAAU,CAAC,EAClC,gCAAgC,CACnC,CAAC;AAEF,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,oCAAoC;IACpC,UAAU;IACV,uCAAuC;IACvC,UAAU;IACV,4CAA4C;IAC5C,eAAe;IACf,iCAAiC;IACjC,iBAAiB;IACjB,0CAA0C;IAC1C,yBAAyB;IACzB,sCAAsC;IACtC,gCAAgC;IAChC,yCAAyC;IACzC,aAAa,EAAE,oBAAoB;CAC7B,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,8BAA8B;IAC9B,cAAc,EAAE,uBAAuB;IACvC,+BAA+B;IAC/B,eAAe,EAAE,wBAAwB;IACzC,uCAAuC;IACvC,aAAa,EAAE,sBAAsB;IACrC,sCAAsC;IACtC,OAAO,EAAE,eAAe;IACxB,2CAA2C;IAC3C,YAAY,EAAE,qBAAqB;IACnC,8CAA8C;IAC9C,YAAY,EAAE,qBAAqB;IACnC,gDAAgD;IAChD,eAAe,EAAE,wBAAwB;IACzC,uBAAuB;IACvB,KAAK,EAAE,YAAY;CACb,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elaraai/east-py-datascience",
3
- "version": "0.0.2-beta.1",
3
+ "version": "0.0.2-beta.11",
4
4
  "description": "East Data Science - ML/optimization platform functions for East (TypeScript definitions)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -76,7 +76,7 @@
76
76
  "typescript": "~5.9.2"
77
77
  },
78
78
  "dependencies": {
79
- "@elaraai/east": "^0.0.1-beta.5",
80
- "@elaraai/east-node-std": "^0.0.1-beta.4"
79
+ "@elaraai/east": "^0.0.1-beta.16",
80
+ "@elaraai/east-node-std": "^0.0.1-beta.9"
81
81
  }
82
82
  }