@elaraai/east-py-datascience 0.0.2-beta.8 → 0.0.2-beta.80

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 (123) hide show
  1. package/README.md +58 -1
  2. package/dist/src/alns/alns.d.ts +528 -0
  3. package/dist/src/alns/alns.d.ts.map +1 -0
  4. package/dist/src/alns/alns.js +238 -0
  5. package/dist/src/alns/alns.js.map +1 -0
  6. package/dist/src/google_or/google_or.d.ts +2422 -0
  7. package/dist/src/google_or/google_or.d.ts.map +1 -0
  8. package/dist/src/google_or/google_or.js +542 -0
  9. package/dist/src/google_or/google_or.js.map +1 -0
  10. package/dist/{gp → src/gp}/gp.d.ts +185 -136
  11. package/dist/src/gp/gp.d.ts.map +1 -0
  12. package/dist/{gp → src/gp}/gp.js +64 -12
  13. package/dist/src/gp/gp.js.map +1 -0
  14. package/dist/src/index.d.ts +34 -0
  15. package/dist/src/index.d.ts.map +1 -0
  16. package/dist/src/index.js +57 -0
  17. package/dist/src/index.js.map +1 -0
  18. package/dist/src/lightgbm/lightgbm.d.ts +575 -0
  19. package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
  20. package/dist/{lightgbm → src/lightgbm}/lightgbm.js +104 -18
  21. package/dist/src/lightgbm/lightgbm.js.map +1 -0
  22. package/dist/src/lightning/lightning.d.ts +1594 -0
  23. package/dist/src/lightning/lightning.d.ts.map +1 -0
  24. package/dist/src/lightning/lightning.js +468 -0
  25. package/dist/src/lightning/lightning.js.map +1 -0
  26. package/dist/{mads → src/mads}/mads.d.ts +109 -112
  27. package/dist/src/mads/mads.d.ts.map +1 -0
  28. package/dist/{mads → src/mads}/mads.js +6 -8
  29. package/dist/src/mads/mads.js.map +1 -0
  30. package/dist/src/mapie/mapie.d.ts +3680 -0
  31. package/dist/src/mapie/mapie.d.ts.map +1 -0
  32. package/dist/src/mapie/mapie.js +616 -0
  33. package/dist/src/mapie/mapie.js.map +1 -0
  34. package/dist/{ngboost → src/ngboost}/ngboost.d.ts +192 -142
  35. package/dist/src/ngboost/ngboost.d.ts.map +1 -0
  36. package/dist/{ngboost → src/ngboost}/ngboost.js +67 -14
  37. package/dist/src/ngboost/ngboost.js.map +1 -0
  38. package/dist/src/optimization/optimization.d.ts +420 -0
  39. package/dist/src/optimization/optimization.d.ts.map +1 -0
  40. package/dist/src/optimization/optimization.js +257 -0
  41. package/dist/src/optimization/optimization.js.map +1 -0
  42. package/dist/{optuna → src/optuna}/optuna.d.ts +374 -314
  43. package/dist/src/optuna/optuna.d.ts.map +1 -0
  44. package/dist/{optuna → src/optuna}/optuna.js +2 -0
  45. package/dist/src/optuna/optuna.js.map +1 -0
  46. package/dist/src/pymc/pymc.d.ts +2932 -0
  47. package/dist/src/pymc/pymc.d.ts.map +1 -0
  48. package/dist/src/pymc/pymc.js +688 -0
  49. package/dist/src/pymc/pymc.js.map +1 -0
  50. package/dist/src/scipy/scipy.d.ts +2205 -0
  51. package/dist/src/scipy/scipy.d.ts.map +1 -0
  52. package/dist/src/scipy/scipy.js +884 -0
  53. package/dist/src/scipy/scipy.js.map +1 -0
  54. package/dist/src/shap/shap.d.ts +2988 -0
  55. package/dist/src/shap/shap.d.ts.map +1 -0
  56. package/dist/src/shap/shap.js +500 -0
  57. package/dist/src/shap/shap.js.map +1 -0
  58. package/dist/{simanneal → src/simanneal}/simanneal.d.ts +257 -160
  59. package/dist/src/simanneal/simanneal.d.ts.map +1 -0
  60. package/dist/{simanneal → src/simanneal}/simanneal.js +105 -8
  61. package/dist/src/simanneal/simanneal.js.map +1 -0
  62. package/dist/src/simulation/simulation.d.ts +431 -0
  63. package/dist/src/simulation/simulation.d.ts.map +1 -0
  64. package/dist/src/simulation/simulation.js +306 -0
  65. package/dist/src/simulation/simulation.js.map +1 -0
  66. package/dist/src/sklearn/sklearn.d.ts +6362 -0
  67. package/dist/src/sklearn/sklearn.d.ts.map +1 -0
  68. package/dist/src/sklearn/sklearn.js +1508 -0
  69. package/dist/src/sklearn/sklearn.js.map +1 -0
  70. package/dist/src/torch/torch.d.ts +1205 -0
  71. package/dist/src/torch/torch.d.ts.map +1 -0
  72. package/dist/{torch → src/torch}/torch.js +109 -18
  73. package/dist/src/torch/torch.js.map +1 -0
  74. package/dist/src/types.d.ts +43 -0
  75. package/dist/src/types.d.ts.map +1 -0
  76. package/dist/src/types.js +44 -0
  77. package/dist/src/types.js.map +1 -0
  78. package/dist/src/xgboost/xgboost.d.ts +1424 -0
  79. package/dist/src/xgboost/xgboost.d.ts.map +1 -0
  80. package/dist/src/xgboost/xgboost.js +432 -0
  81. package/dist/src/xgboost/xgboost.js.map +1 -0
  82. package/package.json +12 -12
  83. package/dist/gp/gp.d.ts.map +0 -1
  84. package/dist/gp/gp.js.map +0 -1
  85. package/dist/index.d.ts +0 -27
  86. package/dist/index.d.ts.map +0 -1
  87. package/dist/index.js +0 -41
  88. package/dist/index.js.map +0 -1
  89. package/dist/lightgbm/lightgbm.d.ts +0 -494
  90. package/dist/lightgbm/lightgbm.d.ts.map +0 -1
  91. package/dist/lightgbm/lightgbm.js.map +0 -1
  92. package/dist/mads/mads.d.ts.map +0 -1
  93. package/dist/mads/mads.js.map +0 -1
  94. package/dist/ngboost/ngboost.d.ts.map +0 -1
  95. package/dist/ngboost/ngboost.js.map +0 -1
  96. package/dist/optuna/optuna.d.ts.map +0 -1
  97. package/dist/optuna/optuna.js.map +0 -1
  98. package/dist/scipy/scipy.d.ts +0 -1260
  99. package/dist/scipy/scipy.d.ts.map +0 -1
  100. package/dist/scipy/scipy.js +0 -413
  101. package/dist/scipy/scipy.js.map +0 -1
  102. package/dist/shap/shap.d.ts +0 -657
  103. package/dist/shap/shap.d.ts.map +0 -1
  104. package/dist/shap/shap.js +0 -241
  105. package/dist/shap/shap.js.map +0 -1
  106. package/dist/simanneal/simanneal.d.ts.map +0 -1
  107. package/dist/simanneal/simanneal.js.map +0 -1
  108. package/dist/sklearn/sklearn.d.ts +0 -2691
  109. package/dist/sklearn/sklearn.d.ts.map +0 -1
  110. package/dist/sklearn/sklearn.js +0 -524
  111. package/dist/sklearn/sklearn.js.map +0 -1
  112. package/dist/torch/torch.d.ts +0 -1081
  113. package/dist/torch/torch.d.ts.map +0 -1
  114. package/dist/torch/torch.js.map +0 -1
  115. package/dist/tsconfig.tsbuildinfo +0 -1
  116. package/dist/types.d.ts +0 -80
  117. package/dist/types.d.ts.map +0 -1
  118. package/dist/types.js +0 -81
  119. package/dist/types.js.map +0 -1
  120. package/dist/xgboost/xgboost.d.ts +0 -504
  121. package/dist/xgboost/xgboost.d.ts.map +0 -1
  122. package/dist/xgboost/xgboost.js +0 -177
  123. package/dist/xgboost/xgboost.js.map +0 -1
@@ -0,0 +1,1594 @@
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
+ * Lightning platform functions for East.
7
+ *
8
+ * Provides production-grade neural network training using PyTorch Lightning.
9
+ * Supports regression, binary classification, multiclass classification,
10
+ * and multi-head categorical outputs.
11
+ *
12
+ * @packageDocumentation
13
+ */
14
+ import { StructType, VariantType, OptionType, IntegerType, FloatType, BlobType, ArrayType, NullType, BooleanType, FunctionType, StringType } from "@elaraai/east";
15
+ import { VectorType, MatrixType } from "../types.js";
16
+ export { VectorType, MatrixType } from "../types.js";
17
+ /**
18
+ * Lightning output mode - determines loss function and output activation.
19
+ */
20
+ export declare const LightningOutputType: VariantType<{
21
+ /** Regression: MSE loss, no activation */
22
+ readonly regression: NullType;
23
+ /** Binary: BCE loss, sigmoid activation */
24
+ readonly binary: StructType<{
25
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
26
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
27
+ }>;
28
+ /** Multiclass: CrossEntropy loss, softmax activation */
29
+ readonly multiclass: StructType<{
30
+ /** Number of classes */
31
+ readonly n_classes: IntegerType;
32
+ /** Optional per-class weights */
33
+ readonly class_weights: OptionType<VectorType<FloatType>>;
34
+ }>;
35
+ /** Multi-head categorical: N independent CrossEntropy heads */
36
+ readonly multi_head: StructType<{
37
+ /** Number of heads (e.g., 84 time slots) */
38
+ readonly n_heads: IntegerType;
39
+ /** Classes per head (e.g., 4 bins) */
40
+ readonly n_classes_per_head: IntegerType;
41
+ /** Optional class weights matrix (n_heads, n_classes) */
42
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
43
+ }>;
44
+ }>;
45
+ /**
46
+ * Cell type for sequential architectures.
47
+ */
48
+ export declare const CellType: VariantType<{
49
+ readonly lstm: NullType;
50
+ readonly gru: NullType;
51
+ }>;
52
+ /**
53
+ * Lightning architecture type.
54
+ */
55
+ export declare const LightningArchitectureType: VariantType<{
56
+ /** Simple MLP: input → hidden → output */
57
+ readonly mlp: StructType<{
58
+ /** Hidden layer sizes */
59
+ readonly hidden_layers: ArrayType<IntegerType>;
60
+ }>;
61
+ /** Autoencoder: input → encoder → latent → decoder → output */
62
+ readonly autoencoder: StructType<{
63
+ /** Encoder hidden layer sizes */
64
+ readonly encoder_layers: ArrayType<IntegerType>;
65
+ /** Latent dimension (bottleneck) */
66
+ readonly latent_dim: IntegerType;
67
+ /** Decoder hidden layer sizes */
68
+ readonly decoder_layers: ArrayType<IntegerType>;
69
+ }>;
70
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
71
+ readonly conv1d: StructType<{
72
+ /** Number of channels (e.g., additive types) */
73
+ readonly n_channels: IntegerType;
74
+ /** Sequence length (e.g., days) */
75
+ readonly sequence_length: IntegerType;
76
+ /** Conv layer channel sizes */
77
+ readonly conv_channels: ArrayType<IntegerType>;
78
+ /** Kernel size for convolutions (must be odd) */
79
+ readonly kernel_size: IntegerType;
80
+ /** Latent dimension after flattening */
81
+ readonly latent_dim: IntegerType;
82
+ /** Optional condition dimension for conditional generation */
83
+ readonly condition_dim: OptionType<IntegerType>;
84
+ }>;
85
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
86
+ readonly sequential: StructType<{
87
+ /** Number of channels (e.g., additive types) */
88
+ readonly n_channels: IntegerType;
89
+ /** Sequence length (e.g., days) */
90
+ readonly sequence_length: IntegerType;
91
+ /** RNN hidden size */
92
+ readonly hidden_size: IntegerType;
93
+ /** Number of RNN layers */
94
+ readonly n_layers: IntegerType;
95
+ /** Cell type: lstm or gru */
96
+ readonly cell_type: VariantType<{
97
+ readonly lstm: NullType;
98
+ readonly gru: NullType;
99
+ }>;
100
+ /** Latent dimension (from final hidden state) */
101
+ readonly latent_dim: IntegerType;
102
+ /** Bidirectional encoder (decoder is always unidirectional) */
103
+ readonly bidirectional: BooleanType;
104
+ /** Optional condition dimension for conditional generation */
105
+ readonly condition_dim: OptionType<IntegerType>;
106
+ }>;
107
+ /** Transformer: attention-based autoencoder for complex patterns */
108
+ readonly transformer: StructType<{
109
+ /** Number of channels (e.g., additive types) */
110
+ readonly n_channels: IntegerType;
111
+ /** Sequence length (e.g., days) */
112
+ readonly sequence_length: IntegerType;
113
+ /** Model dimension */
114
+ readonly d_model: IntegerType;
115
+ /** Number of attention heads (must divide d_model evenly) */
116
+ readonly n_attention_heads: IntegerType;
117
+ /** Number of transformer layers */
118
+ readonly n_layers: IntegerType;
119
+ /** Feedforward dimension (default: 4 * d_model) */
120
+ readonly d_ff: OptionType<IntegerType>;
121
+ /** Latent dimension (mean pooled output) */
122
+ readonly latent_dim: IntegerType;
123
+ /** Optional condition dimension for conditional generation */
124
+ readonly condition_dim: OptionType<IntegerType>;
125
+ }>;
126
+ }>;
127
+ /**
128
+ * Epoch callback function type: (epoch, train_loss, val_loss) -> void
129
+ */
130
+ export declare const LightningEpochCallbackType: FunctionType<[IntegerType, FloatType, FloatType], NullType>;
131
+ /**
132
+ * Lightning training configuration.
133
+ */
134
+ export declare const LightningConfigType: StructType<{
135
+ /** Model architecture */
136
+ readonly architecture: VariantType<{
137
+ /** Simple MLP: input → hidden → output */
138
+ readonly mlp: StructType<{
139
+ /** Hidden layer sizes */
140
+ readonly hidden_layers: ArrayType<IntegerType>;
141
+ }>;
142
+ /** Autoencoder: input → encoder → latent → decoder → output */
143
+ readonly autoencoder: StructType<{
144
+ /** Encoder hidden layer sizes */
145
+ readonly encoder_layers: ArrayType<IntegerType>;
146
+ /** Latent dimension (bottleneck) */
147
+ readonly latent_dim: IntegerType;
148
+ /** Decoder hidden layer sizes */
149
+ readonly decoder_layers: ArrayType<IntegerType>;
150
+ }>;
151
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
152
+ readonly conv1d: StructType<{
153
+ /** Number of channels (e.g., additive types) */
154
+ readonly n_channels: IntegerType;
155
+ /** Sequence length (e.g., days) */
156
+ readonly sequence_length: IntegerType;
157
+ /** Conv layer channel sizes */
158
+ readonly conv_channels: ArrayType<IntegerType>;
159
+ /** Kernel size for convolutions (must be odd) */
160
+ readonly kernel_size: IntegerType;
161
+ /** Latent dimension after flattening */
162
+ readonly latent_dim: IntegerType;
163
+ /** Optional condition dimension for conditional generation */
164
+ readonly condition_dim: OptionType<IntegerType>;
165
+ }>;
166
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
167
+ readonly sequential: StructType<{
168
+ /** Number of channels (e.g., additive types) */
169
+ readonly n_channels: IntegerType;
170
+ /** Sequence length (e.g., days) */
171
+ readonly sequence_length: IntegerType;
172
+ /** RNN hidden size */
173
+ readonly hidden_size: IntegerType;
174
+ /** Number of RNN layers */
175
+ readonly n_layers: IntegerType;
176
+ /** Cell type: lstm or gru */
177
+ readonly cell_type: VariantType<{
178
+ readonly lstm: NullType;
179
+ readonly gru: NullType;
180
+ }>;
181
+ /** Latent dimension (from final hidden state) */
182
+ readonly latent_dim: IntegerType;
183
+ /** Bidirectional encoder (decoder is always unidirectional) */
184
+ readonly bidirectional: BooleanType;
185
+ /** Optional condition dimension for conditional generation */
186
+ readonly condition_dim: OptionType<IntegerType>;
187
+ }>;
188
+ /** Transformer: attention-based autoencoder for complex patterns */
189
+ readonly transformer: StructType<{
190
+ /** Number of channels (e.g., additive types) */
191
+ readonly n_channels: IntegerType;
192
+ /** Sequence length (e.g., days) */
193
+ readonly sequence_length: IntegerType;
194
+ /** Model dimension */
195
+ readonly d_model: IntegerType;
196
+ /** Number of attention heads (must divide d_model evenly) */
197
+ readonly n_attention_heads: IntegerType;
198
+ /** Number of transformer layers */
199
+ readonly n_layers: IntegerType;
200
+ /** Feedforward dimension (default: 4 * d_model) */
201
+ readonly d_ff: OptionType<IntegerType>;
202
+ /** Latent dimension (mean pooled output) */
203
+ readonly latent_dim: IntegerType;
204
+ /** Optional condition dimension for conditional generation */
205
+ readonly condition_dim: OptionType<IntegerType>;
206
+ }>;
207
+ }>;
208
+ /** Output mode (determines loss function) */
209
+ readonly output: VariantType<{
210
+ /** Regression: MSE loss, no activation */
211
+ readonly regression: NullType;
212
+ /** Binary: BCE loss, sigmoid activation */
213
+ readonly binary: StructType<{
214
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
215
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
216
+ }>;
217
+ /** Multiclass: CrossEntropy loss, softmax activation */
218
+ readonly multiclass: StructType<{
219
+ /** Number of classes */
220
+ readonly n_classes: IntegerType;
221
+ /** Optional per-class weights */
222
+ readonly class_weights: OptionType<VectorType<FloatType>>;
223
+ }>;
224
+ /** Multi-head categorical: N independent CrossEntropy heads */
225
+ readonly multi_head: StructType<{
226
+ /** Number of heads (e.g., 84 time slots) */
227
+ readonly n_heads: IntegerType;
228
+ /** Classes per head (e.g., 4 bins) */
229
+ readonly n_classes_per_head: IntegerType;
230
+ /** Optional class weights matrix (n_heads, n_classes) */
231
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
232
+ }>;
233
+ }>;
234
+ /** Learning rate (default: 1e-3) */
235
+ readonly learning_rate: OptionType<FloatType>;
236
+ /** Maximum epochs (default: 100) */
237
+ readonly max_epochs: OptionType<IntegerType>;
238
+ /** Early stopping patience (default: 10) */
239
+ readonly patience: OptionType<IntegerType>;
240
+ /** Batch size (default: 32) */
241
+ readonly batch_size: OptionType<IntegerType>;
242
+ /** Dropout rate (default: 0.1) */
243
+ readonly dropout: OptionType<FloatType>;
244
+ /** Gradient clipping value (default: 1.0) */
245
+ readonly gradient_clip: OptionType<FloatType>;
246
+ /** L2 regularization weight decay (default: 0) */
247
+ readonly weight_decay: OptionType<FloatType>;
248
+ /** Random seed for reproducibility */
249
+ readonly random_state: OptionType<IntegerType>;
250
+ /** Optional callback called each epoch */
251
+ readonly epoch_callback: OptionType<FunctionType<[IntegerType, FloatType, FloatType], NullType>>;
252
+ }>;
253
+ /**
254
+ * Lightning model blob structure.
255
+ */
256
+ export declare const LightningModelBlobType: VariantType<{
257
+ readonly lightning: StructType<{
258
+ /** Serialized model data (state_dict + hparams) */
259
+ readonly data: BlobType;
260
+ /** Input dimension */
261
+ readonly n_features: IntegerType;
262
+ /** Output dimension */
263
+ readonly output_dim: IntegerType;
264
+ /** Architecture type */
265
+ readonly architecture_type: StringType;
266
+ /** Output type */
267
+ readonly output_type: StringType;
268
+ /** Latent dimension (autoencoder only) */
269
+ readonly latent_dim: OptionType<IntegerType>;
270
+ }>;
271
+ }>;
272
+ /**
273
+ * Lightning training result.
274
+ */
275
+ export declare const LightningResultType: StructType<{
276
+ /** Trained model blob */
277
+ readonly model: VariantType<{
278
+ readonly lightning: StructType<{
279
+ /** Serialized model data (state_dict + hparams) */
280
+ readonly data: BlobType;
281
+ /** Input dimension */
282
+ readonly n_features: IntegerType;
283
+ /** Output dimension */
284
+ readonly output_dim: IntegerType;
285
+ /** Architecture type */
286
+ readonly architecture_type: StringType;
287
+ /** Output type */
288
+ readonly output_type: StringType;
289
+ /** Latent dimension (autoencoder only) */
290
+ readonly latent_dim: OptionType<IntegerType>;
291
+ }>;
292
+ }>;
293
+ /** Final training loss */
294
+ readonly train_loss: FloatType;
295
+ /** Final validation loss */
296
+ readonly val_loss: FloatType;
297
+ /** Best epoch (for early stopping) */
298
+ readonly best_epoch: IntegerType;
299
+ }>;
300
+ /**
301
+ * 3D boolean tensor for masks: (n_samples, n_heads, n_classes)
302
+ */
303
+ export declare const Tensor3DBoolType: ArrayType<ArrayType<ArrayType<BooleanType>>>;
304
+ /**
305
+ * Group-based weights for per-sample class weighting.
306
+ *
307
+ * Instead of per-sample weights (memory-intensive), samples belong to discrete
308
+ * groups (e.g., grades) with different weight configurations per group.
309
+ */
310
+ export declare const GroupWeightsType: StructType<{
311
+ /** Weights per group - shape depends on output type */
312
+ readonly weights: VariantType<{
313
+ /** For binary: pos_weight vector per group [n_groups][output_dim] */
314
+ readonly binary: ArrayType<ArrayType<FloatType>>;
315
+ /** For multi_head: class_weight matrix per group [n_groups][n_heads][n_classes] */
316
+ readonly multi_head: ArrayType<ArrayType<ArrayType<FloatType>>>;
317
+ }>;
318
+ /** Group index per sample: [n_samples] */
319
+ readonly sample_groups: ArrayType<IntegerType>;
320
+ }>;
321
+ /**
322
+ * Train a Lightning model.
323
+ *
324
+ * @param X - Input features matrix (n_samples, n_features)
325
+ * @param y - Target matrix (n_samples, output_dim)
326
+ * @param config - Training configuration
327
+ * @param masks - Optional 3D boolean masks (n_samples, n_heads, n_classes)
328
+ * @param group_weights - Optional group-based weights for per-sample weighting
329
+ * @param conditions - Optional condition matrix for conditional generation (n_samples, condition_dim)
330
+ * @returns Training result with model blob and metrics
331
+ */
332
+ export declare const lightning_train: import("@elaraai/east").PlatformDefinition<[MatrixType<FloatType>, MatrixType<FloatType>, StructType<{
333
+ /** Model architecture */
334
+ readonly architecture: VariantType<{
335
+ /** Simple MLP: input → hidden → output */
336
+ readonly mlp: StructType<{
337
+ /** Hidden layer sizes */
338
+ readonly hidden_layers: ArrayType<IntegerType>;
339
+ }>;
340
+ /** Autoencoder: input → encoder → latent → decoder → output */
341
+ readonly autoencoder: StructType<{
342
+ /** Encoder hidden layer sizes */
343
+ readonly encoder_layers: ArrayType<IntegerType>;
344
+ /** Latent dimension (bottleneck) */
345
+ readonly latent_dim: IntegerType;
346
+ /** Decoder hidden layer sizes */
347
+ readonly decoder_layers: ArrayType<IntegerType>;
348
+ }>;
349
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
350
+ readonly conv1d: StructType<{
351
+ /** Number of channels (e.g., additive types) */
352
+ readonly n_channels: IntegerType;
353
+ /** Sequence length (e.g., days) */
354
+ readonly sequence_length: IntegerType;
355
+ /** Conv layer channel sizes */
356
+ readonly conv_channels: ArrayType<IntegerType>;
357
+ /** Kernel size for convolutions (must be odd) */
358
+ readonly kernel_size: IntegerType;
359
+ /** Latent dimension after flattening */
360
+ readonly latent_dim: IntegerType;
361
+ /** Optional condition dimension for conditional generation */
362
+ readonly condition_dim: OptionType<IntegerType>;
363
+ }>;
364
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
365
+ readonly sequential: StructType<{
366
+ /** Number of channels (e.g., additive types) */
367
+ readonly n_channels: IntegerType;
368
+ /** Sequence length (e.g., days) */
369
+ readonly sequence_length: IntegerType;
370
+ /** RNN hidden size */
371
+ readonly hidden_size: IntegerType;
372
+ /** Number of RNN layers */
373
+ readonly n_layers: IntegerType;
374
+ /** Cell type: lstm or gru */
375
+ readonly cell_type: VariantType<{
376
+ readonly lstm: NullType;
377
+ readonly gru: NullType;
378
+ }>;
379
+ /** Latent dimension (from final hidden state) */
380
+ readonly latent_dim: IntegerType;
381
+ /** Bidirectional encoder (decoder is always unidirectional) */
382
+ readonly bidirectional: BooleanType;
383
+ /** Optional condition dimension for conditional generation */
384
+ readonly condition_dim: OptionType<IntegerType>;
385
+ }>;
386
+ /** Transformer: attention-based autoencoder for complex patterns */
387
+ readonly transformer: StructType<{
388
+ /** Number of channels (e.g., additive types) */
389
+ readonly n_channels: IntegerType;
390
+ /** Sequence length (e.g., days) */
391
+ readonly sequence_length: IntegerType;
392
+ /** Model dimension */
393
+ readonly d_model: IntegerType;
394
+ /** Number of attention heads (must divide d_model evenly) */
395
+ readonly n_attention_heads: IntegerType;
396
+ /** Number of transformer layers */
397
+ readonly n_layers: IntegerType;
398
+ /** Feedforward dimension (default: 4 * d_model) */
399
+ readonly d_ff: OptionType<IntegerType>;
400
+ /** Latent dimension (mean pooled output) */
401
+ readonly latent_dim: IntegerType;
402
+ /** Optional condition dimension for conditional generation */
403
+ readonly condition_dim: OptionType<IntegerType>;
404
+ }>;
405
+ }>;
406
+ /** Output mode (determines loss function) */
407
+ readonly output: VariantType<{
408
+ /** Regression: MSE loss, no activation */
409
+ readonly regression: NullType;
410
+ /** Binary: BCE loss, sigmoid activation */
411
+ readonly binary: StructType<{
412
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
413
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
414
+ }>;
415
+ /** Multiclass: CrossEntropy loss, softmax activation */
416
+ readonly multiclass: StructType<{
417
+ /** Number of classes */
418
+ readonly n_classes: IntegerType;
419
+ /** Optional per-class weights */
420
+ readonly class_weights: OptionType<VectorType<FloatType>>;
421
+ }>;
422
+ /** Multi-head categorical: N independent CrossEntropy heads */
423
+ readonly multi_head: StructType<{
424
+ /** Number of heads (e.g., 84 time slots) */
425
+ readonly n_heads: IntegerType;
426
+ /** Classes per head (e.g., 4 bins) */
427
+ readonly n_classes_per_head: IntegerType;
428
+ /** Optional class weights matrix (n_heads, n_classes) */
429
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
430
+ }>;
431
+ }>;
432
+ /** Learning rate (default: 1e-3) */
433
+ readonly learning_rate: OptionType<FloatType>;
434
+ /** Maximum epochs (default: 100) */
435
+ readonly max_epochs: OptionType<IntegerType>;
436
+ /** Early stopping patience (default: 10) */
437
+ readonly patience: OptionType<IntegerType>;
438
+ /** Batch size (default: 32) */
439
+ readonly batch_size: OptionType<IntegerType>;
440
+ /** Dropout rate (default: 0.1) */
441
+ readonly dropout: OptionType<FloatType>;
442
+ /** Gradient clipping value (default: 1.0) */
443
+ readonly gradient_clip: OptionType<FloatType>;
444
+ /** L2 regularization weight decay (default: 0) */
445
+ readonly weight_decay: OptionType<FloatType>;
446
+ /** Random seed for reproducibility */
447
+ readonly random_state: OptionType<IntegerType>;
448
+ /** Optional callback called each epoch */
449
+ readonly epoch_callback: OptionType<FunctionType<[IntegerType, FloatType, FloatType], NullType>>;
450
+ }>, OptionType<ArrayType<ArrayType<ArrayType<BooleanType>>>>, OptionType<StructType<{
451
+ /** Weights per group - shape depends on output type */
452
+ readonly weights: VariantType<{
453
+ /** For binary: pos_weight vector per group [n_groups][output_dim] */
454
+ readonly binary: ArrayType<ArrayType<FloatType>>;
455
+ /** For multi_head: class_weight matrix per group [n_groups][n_heads][n_classes] */
456
+ readonly multi_head: ArrayType<ArrayType<ArrayType<FloatType>>>;
457
+ }>;
458
+ /** Group index per sample: [n_samples] */
459
+ readonly sample_groups: ArrayType<IntegerType>;
460
+ }>>, OptionType<MatrixType<FloatType>>], StructType<{
461
+ /** Trained model blob */
462
+ readonly model: VariantType<{
463
+ readonly lightning: StructType<{
464
+ /** Serialized model data (state_dict + hparams) */
465
+ readonly data: BlobType;
466
+ /** Input dimension */
467
+ readonly n_features: IntegerType;
468
+ /** Output dimension */
469
+ readonly output_dim: IntegerType;
470
+ /** Architecture type */
471
+ readonly architecture_type: StringType;
472
+ /** Output type */
473
+ readonly output_type: StringType;
474
+ /** Latent dimension (autoencoder only) */
475
+ readonly latent_dim: OptionType<IntegerType>;
476
+ }>;
477
+ }>;
478
+ /** Final training loss */
479
+ readonly train_loss: FloatType;
480
+ /** Final validation loss */
481
+ readonly val_loss: FloatType;
482
+ /** Best epoch (for early stopping) */
483
+ readonly best_epoch: IntegerType;
484
+ }>>;
485
+ /**
486
+ * Predict using a Lightning model.
487
+ *
488
+ * @param model - Trained model blob
489
+ * @param X - Input features matrix (n_samples, n_features)
490
+ * @param masks - Optional 3D boolean masks for inference
491
+ * @param conditions - Optional condition matrix for conditional models (n_samples, condition_dim)
492
+ * @returns Predicted probabilities matrix (n_samples, output_dim)
493
+ */
494
+ export declare const lightning_predict: import("@elaraai/east").PlatformDefinition<[VariantType<{
495
+ readonly lightning: StructType<{
496
+ /** Serialized model data (state_dict + hparams) */
497
+ readonly data: BlobType;
498
+ /** Input dimension */
499
+ readonly n_features: IntegerType;
500
+ /** Output dimension */
501
+ readonly output_dim: IntegerType;
502
+ /** Architecture type */
503
+ readonly architecture_type: StringType;
504
+ /** Output type */
505
+ readonly output_type: StringType;
506
+ /** Latent dimension (autoencoder only) */
507
+ readonly latent_dim: OptionType<IntegerType>;
508
+ }>;
509
+ }>, MatrixType<FloatType>, OptionType<ArrayType<ArrayType<ArrayType<BooleanType>>>>, OptionType<MatrixType<FloatType>>], MatrixType<FloatType>>;
510
+ /**
511
+ * Encode input to latent space (autoencoder only).
512
+ *
513
+ * @param model - Trained autoencoder model blob
514
+ * @param X - Input features matrix (n_samples, n_features)
515
+ * @returns Latent embeddings matrix (n_samples, latent_dim)
516
+ */
517
+ export declare const lightning_encode: import("@elaraai/east").PlatformDefinition<[VariantType<{
518
+ readonly lightning: StructType<{
519
+ /** Serialized model data (state_dict + hparams) */
520
+ readonly data: BlobType;
521
+ /** Input dimension */
522
+ readonly n_features: IntegerType;
523
+ /** Output dimension */
524
+ readonly output_dim: IntegerType;
525
+ /** Architecture type */
526
+ readonly architecture_type: StringType;
527
+ /** Output type */
528
+ readonly output_type: StringType;
529
+ /** Latent dimension (autoencoder only) */
530
+ readonly latent_dim: OptionType<IntegerType>;
531
+ }>;
532
+ }>, MatrixType<FloatType>], MatrixType<FloatType>>;
533
+ /**
534
+ * Decode latent to output (autoencoder only).
535
+ *
536
+ * @param model - Trained autoencoder model blob
537
+ * @param z - Latent embeddings matrix (n_samples, latent_dim)
538
+ * @returns Decoded output matrix (n_samples, output_dim)
539
+ */
540
+ export declare const lightning_decode: import("@elaraai/east").PlatformDefinition<[VariantType<{
541
+ readonly lightning: StructType<{
542
+ /** Serialized model data (state_dict + hparams) */
543
+ readonly data: BlobType;
544
+ /** Input dimension */
545
+ readonly n_features: IntegerType;
546
+ /** Output dimension */
547
+ readonly output_dim: IntegerType;
548
+ /** Architecture type */
549
+ readonly architecture_type: StringType;
550
+ /** Output type */
551
+ readonly output_type: StringType;
552
+ /** Latent dimension (autoencoder only) */
553
+ readonly latent_dim: OptionType<IntegerType>;
554
+ }>;
555
+ }>, MatrixType<FloatType>], MatrixType<FloatType>>;
556
+ /**
557
+ * Decode latent to output with condition (temporal architectures with condition_dim).
558
+ *
559
+ * @param model - Trained model with condition_dim set
560
+ * @param z - Latent embeddings matrix (n_samples, latent_dim)
561
+ * @param condition - Condition vectors (n_samples, condition_dim)
562
+ * @returns Decoded output matrix (n_samples, output_dim)
563
+ */
564
+ export declare const lightning_decode_conditional: import("@elaraai/east").PlatformDefinition<[VariantType<{
565
+ readonly lightning: StructType<{
566
+ /** Serialized model data (state_dict + hparams) */
567
+ readonly data: BlobType;
568
+ /** Input dimension */
569
+ readonly n_features: IntegerType;
570
+ /** Output dimension */
571
+ readonly output_dim: IntegerType;
572
+ /** Architecture type */
573
+ readonly architecture_type: StringType;
574
+ /** Output type */
575
+ readonly output_type: StringType;
576
+ /** Latent dimension (autoencoder only) */
577
+ readonly latent_dim: OptionType<IntegerType>;
578
+ }>;
579
+ }>, MatrixType<FloatType>, MatrixType<FloatType>], MatrixType<FloatType>>;
580
+ /**
581
+ * Configuration for autoregressive sequence generation.
582
+ */
583
+ export declare const LightningGenerateConfigType: StructType<{
584
+ /** Number of steps to generate */
585
+ readonly n_steps: IntegerType;
586
+ /** Sampling temperature: 0.0 = argmax, > 0 = scaled sampling */
587
+ readonly temperature: FloatType;
588
+ /** If true, return probabilities. If false, return samples. */
589
+ readonly return_probs: BooleanType;
590
+ }>;
591
+ /**
592
+ * Generate sequence autoregressively from a sequential model.
593
+ *
594
+ * Shapes:
595
+ * - prefix: (n_prefix_steps, n_channels) - partial history to continue from, can be empty []
596
+ * - condition: (1, condition_dim) - conditioning features, or none
597
+ * - returns: (n_steps, n_channels) - generated timesteps only (not including prefix)
598
+ *
599
+ * @param model - Trained sequential model blob
600
+ * @param prefix - Partial history to continue from
601
+ * @param condition - Optional conditioning features
602
+ * @param config - Generation configuration
603
+ * @returns Generated sequence matrix
604
+ */
605
+ export declare const lightning_generate_sequence: import("@elaraai/east").PlatformDefinition<[VariantType<{
606
+ readonly lightning: StructType<{
607
+ /** Serialized model data (state_dict + hparams) */
608
+ readonly data: BlobType;
609
+ /** Input dimension */
610
+ readonly n_features: IntegerType;
611
+ /** Output dimension */
612
+ readonly output_dim: IntegerType;
613
+ /** Architecture type */
614
+ readonly architecture_type: StringType;
615
+ /** Output type */
616
+ readonly output_type: StringType;
617
+ /** Latent dimension (autoencoder only) */
618
+ readonly latent_dim: OptionType<IntegerType>;
619
+ }>;
620
+ }>, MatrixType<FloatType>, OptionType<MatrixType<FloatType>>, StructType<{
621
+ /** Number of steps to generate */
622
+ readonly n_steps: IntegerType;
623
+ /** Sampling temperature: 0.0 = argmax, > 0 = scaled sampling */
624
+ readonly temperature: FloatType;
625
+ /** If true, return probabilities. If false, return samples. */
626
+ readonly return_probs: BooleanType;
627
+ }>], MatrixType<FloatType>>;
628
+ /**
629
+ * Lightning types namespace.
630
+ */
631
+ export declare const LightningTypes: {
632
+ readonly OutputType: VariantType<{
633
+ /** Regression: MSE loss, no activation */
634
+ readonly regression: NullType;
635
+ /** Binary: BCE loss, sigmoid activation */
636
+ readonly binary: StructType<{
637
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
638
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
639
+ }>;
640
+ /** Multiclass: CrossEntropy loss, softmax activation */
641
+ readonly multiclass: StructType<{
642
+ /** Number of classes */
643
+ readonly n_classes: IntegerType;
644
+ /** Optional per-class weights */
645
+ readonly class_weights: OptionType<VectorType<FloatType>>;
646
+ }>;
647
+ /** Multi-head categorical: N independent CrossEntropy heads */
648
+ readonly multi_head: StructType<{
649
+ /** Number of heads (e.g., 84 time slots) */
650
+ readonly n_heads: IntegerType;
651
+ /** Classes per head (e.g., 4 bins) */
652
+ readonly n_classes_per_head: IntegerType;
653
+ /** Optional class weights matrix (n_heads, n_classes) */
654
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
655
+ }>;
656
+ }>;
657
+ readonly ArchitectureType: VariantType<{
658
+ /** Simple MLP: input → hidden → output */
659
+ readonly mlp: StructType<{
660
+ /** Hidden layer sizes */
661
+ readonly hidden_layers: ArrayType<IntegerType>;
662
+ }>;
663
+ /** Autoencoder: input → encoder → latent → decoder → output */
664
+ readonly autoencoder: StructType<{
665
+ /** Encoder hidden layer sizes */
666
+ readonly encoder_layers: ArrayType<IntegerType>;
667
+ /** Latent dimension (bottleneck) */
668
+ readonly latent_dim: IntegerType;
669
+ /** Decoder hidden layer sizes */
670
+ readonly decoder_layers: ArrayType<IntegerType>;
671
+ }>;
672
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
673
+ readonly conv1d: StructType<{
674
+ /** Number of channels (e.g., additive types) */
675
+ readonly n_channels: IntegerType;
676
+ /** Sequence length (e.g., days) */
677
+ readonly sequence_length: IntegerType;
678
+ /** Conv layer channel sizes */
679
+ readonly conv_channels: ArrayType<IntegerType>;
680
+ /** Kernel size for convolutions (must be odd) */
681
+ readonly kernel_size: IntegerType;
682
+ /** Latent dimension after flattening */
683
+ readonly latent_dim: IntegerType;
684
+ /** Optional condition dimension for conditional generation */
685
+ readonly condition_dim: OptionType<IntegerType>;
686
+ }>;
687
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
688
+ readonly sequential: StructType<{
689
+ /** Number of channels (e.g., additive types) */
690
+ readonly n_channels: IntegerType;
691
+ /** Sequence length (e.g., days) */
692
+ readonly sequence_length: IntegerType;
693
+ /** RNN hidden size */
694
+ readonly hidden_size: IntegerType;
695
+ /** Number of RNN layers */
696
+ readonly n_layers: IntegerType;
697
+ /** Cell type: lstm or gru */
698
+ readonly cell_type: VariantType<{
699
+ readonly lstm: NullType;
700
+ readonly gru: NullType;
701
+ }>;
702
+ /** Latent dimension (from final hidden state) */
703
+ readonly latent_dim: IntegerType;
704
+ /** Bidirectional encoder (decoder is always unidirectional) */
705
+ readonly bidirectional: BooleanType;
706
+ /** Optional condition dimension for conditional generation */
707
+ readonly condition_dim: OptionType<IntegerType>;
708
+ }>;
709
+ /** Transformer: attention-based autoencoder for complex patterns */
710
+ readonly transformer: StructType<{
711
+ /** Number of channels (e.g., additive types) */
712
+ readonly n_channels: IntegerType;
713
+ /** Sequence length (e.g., days) */
714
+ readonly sequence_length: IntegerType;
715
+ /** Model dimension */
716
+ readonly d_model: IntegerType;
717
+ /** Number of attention heads (must divide d_model evenly) */
718
+ readonly n_attention_heads: IntegerType;
719
+ /** Number of transformer layers */
720
+ readonly n_layers: IntegerType;
721
+ /** Feedforward dimension (default: 4 * d_model) */
722
+ readonly d_ff: OptionType<IntegerType>;
723
+ /** Latent dimension (mean pooled output) */
724
+ readonly latent_dim: IntegerType;
725
+ /** Optional condition dimension for conditional generation */
726
+ readonly condition_dim: OptionType<IntegerType>;
727
+ }>;
728
+ }>;
729
+ readonly CellType: VariantType<{
730
+ readonly lstm: NullType;
731
+ readonly gru: NullType;
732
+ }>;
733
+ readonly EpochCallbackType: FunctionType<[IntegerType, FloatType, FloatType], NullType>;
734
+ readonly ConfigType: StructType<{
735
+ /** Model architecture */
736
+ readonly architecture: VariantType<{
737
+ /** Simple MLP: input → hidden → output */
738
+ readonly mlp: StructType<{
739
+ /** Hidden layer sizes */
740
+ readonly hidden_layers: ArrayType<IntegerType>;
741
+ }>;
742
+ /** Autoencoder: input → encoder → latent → decoder → output */
743
+ readonly autoencoder: StructType<{
744
+ /** Encoder hidden layer sizes */
745
+ readonly encoder_layers: ArrayType<IntegerType>;
746
+ /** Latent dimension (bottleneck) */
747
+ readonly latent_dim: IntegerType;
748
+ /** Decoder hidden layer sizes */
749
+ readonly decoder_layers: ArrayType<IntegerType>;
750
+ }>;
751
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
752
+ readonly conv1d: StructType<{
753
+ /** Number of channels (e.g., additive types) */
754
+ readonly n_channels: IntegerType;
755
+ /** Sequence length (e.g., days) */
756
+ readonly sequence_length: IntegerType;
757
+ /** Conv layer channel sizes */
758
+ readonly conv_channels: ArrayType<IntegerType>;
759
+ /** Kernel size for convolutions (must be odd) */
760
+ readonly kernel_size: IntegerType;
761
+ /** Latent dimension after flattening */
762
+ readonly latent_dim: IntegerType;
763
+ /** Optional condition dimension for conditional generation */
764
+ readonly condition_dim: OptionType<IntegerType>;
765
+ }>;
766
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
767
+ readonly sequential: StructType<{
768
+ /** Number of channels (e.g., additive types) */
769
+ readonly n_channels: IntegerType;
770
+ /** Sequence length (e.g., days) */
771
+ readonly sequence_length: IntegerType;
772
+ /** RNN hidden size */
773
+ readonly hidden_size: IntegerType;
774
+ /** Number of RNN layers */
775
+ readonly n_layers: IntegerType;
776
+ /** Cell type: lstm or gru */
777
+ readonly cell_type: VariantType<{
778
+ readonly lstm: NullType;
779
+ readonly gru: NullType;
780
+ }>;
781
+ /** Latent dimension (from final hidden state) */
782
+ readonly latent_dim: IntegerType;
783
+ /** Bidirectional encoder (decoder is always unidirectional) */
784
+ readonly bidirectional: BooleanType;
785
+ /** Optional condition dimension for conditional generation */
786
+ readonly condition_dim: OptionType<IntegerType>;
787
+ }>;
788
+ /** Transformer: attention-based autoencoder for complex patterns */
789
+ readonly transformer: StructType<{
790
+ /** Number of channels (e.g., additive types) */
791
+ readonly n_channels: IntegerType;
792
+ /** Sequence length (e.g., days) */
793
+ readonly sequence_length: IntegerType;
794
+ /** Model dimension */
795
+ readonly d_model: IntegerType;
796
+ /** Number of attention heads (must divide d_model evenly) */
797
+ readonly n_attention_heads: IntegerType;
798
+ /** Number of transformer layers */
799
+ readonly n_layers: IntegerType;
800
+ /** Feedforward dimension (default: 4 * d_model) */
801
+ readonly d_ff: OptionType<IntegerType>;
802
+ /** Latent dimension (mean pooled output) */
803
+ readonly latent_dim: IntegerType;
804
+ /** Optional condition dimension for conditional generation */
805
+ readonly condition_dim: OptionType<IntegerType>;
806
+ }>;
807
+ }>;
808
+ /** Output mode (determines loss function) */
809
+ readonly output: VariantType<{
810
+ /** Regression: MSE loss, no activation */
811
+ readonly regression: NullType;
812
+ /** Binary: BCE loss, sigmoid activation */
813
+ readonly binary: StructType<{
814
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
815
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
816
+ }>;
817
+ /** Multiclass: CrossEntropy loss, softmax activation */
818
+ readonly multiclass: StructType<{
819
+ /** Number of classes */
820
+ readonly n_classes: IntegerType;
821
+ /** Optional per-class weights */
822
+ readonly class_weights: OptionType<VectorType<FloatType>>;
823
+ }>;
824
+ /** Multi-head categorical: N independent CrossEntropy heads */
825
+ readonly multi_head: StructType<{
826
+ /** Number of heads (e.g., 84 time slots) */
827
+ readonly n_heads: IntegerType;
828
+ /** Classes per head (e.g., 4 bins) */
829
+ readonly n_classes_per_head: IntegerType;
830
+ /** Optional class weights matrix (n_heads, n_classes) */
831
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
832
+ }>;
833
+ }>;
834
+ /** Learning rate (default: 1e-3) */
835
+ readonly learning_rate: OptionType<FloatType>;
836
+ /** Maximum epochs (default: 100) */
837
+ readonly max_epochs: OptionType<IntegerType>;
838
+ /** Early stopping patience (default: 10) */
839
+ readonly patience: OptionType<IntegerType>;
840
+ /** Batch size (default: 32) */
841
+ readonly batch_size: OptionType<IntegerType>;
842
+ /** Dropout rate (default: 0.1) */
843
+ readonly dropout: OptionType<FloatType>;
844
+ /** Gradient clipping value (default: 1.0) */
845
+ readonly gradient_clip: OptionType<FloatType>;
846
+ /** L2 regularization weight decay (default: 0) */
847
+ readonly weight_decay: OptionType<FloatType>;
848
+ /** Random seed for reproducibility */
849
+ readonly random_state: OptionType<IntegerType>;
850
+ /** Optional callback called each epoch */
851
+ readonly epoch_callback: OptionType<FunctionType<[IntegerType, FloatType, FloatType], NullType>>;
852
+ }>;
853
+ readonly ResultType: StructType<{
854
+ /** Trained model blob */
855
+ readonly model: VariantType<{
856
+ readonly lightning: StructType<{
857
+ /** Serialized model data (state_dict + hparams) */
858
+ readonly data: BlobType;
859
+ /** Input dimension */
860
+ readonly n_features: IntegerType;
861
+ /** Output dimension */
862
+ readonly output_dim: IntegerType;
863
+ /** Architecture type */
864
+ readonly architecture_type: StringType;
865
+ /** Output type */
866
+ readonly output_type: StringType;
867
+ /** Latent dimension (autoencoder only) */
868
+ readonly latent_dim: OptionType<IntegerType>;
869
+ }>;
870
+ }>;
871
+ /** Final training loss */
872
+ readonly train_loss: FloatType;
873
+ /** Final validation loss */
874
+ readonly val_loss: FloatType;
875
+ /** Best epoch (for early stopping) */
876
+ readonly best_epoch: IntegerType;
877
+ }>;
878
+ readonly ModelBlobType: VariantType<{
879
+ readonly lightning: StructType<{
880
+ /** Serialized model data (state_dict + hparams) */
881
+ readonly data: BlobType;
882
+ /** Input dimension */
883
+ readonly n_features: IntegerType;
884
+ /** Output dimension */
885
+ readonly output_dim: IntegerType;
886
+ /** Architecture type */
887
+ readonly architecture_type: StringType;
888
+ /** Output type */
889
+ readonly output_type: StringType;
890
+ /** Latent dimension (autoencoder only) */
891
+ readonly latent_dim: OptionType<IntegerType>;
892
+ }>;
893
+ }>;
894
+ readonly Tensor3DBoolType: ArrayType<ArrayType<ArrayType<BooleanType>>>;
895
+ readonly GroupWeightsType: StructType<{
896
+ /** Weights per group - shape depends on output type */
897
+ readonly weights: VariantType<{
898
+ /** For binary: pos_weight vector per group [n_groups][output_dim] */
899
+ readonly binary: ArrayType<ArrayType<FloatType>>;
900
+ /** For multi_head: class_weight matrix per group [n_groups][n_heads][n_classes] */
901
+ readonly multi_head: ArrayType<ArrayType<ArrayType<FloatType>>>;
902
+ }>;
903
+ /** Group index per sample: [n_samples] */
904
+ readonly sample_groups: ArrayType<IntegerType>;
905
+ }>;
906
+ readonly GenerateConfigType: StructType<{
907
+ /** Number of steps to generate */
908
+ readonly n_steps: IntegerType;
909
+ /** Sampling temperature: 0.0 = argmax, > 0 = scaled sampling */
910
+ readonly temperature: FloatType;
911
+ /** If true, return probabilities. If false, return samples. */
912
+ readonly return_probs: BooleanType;
913
+ }>;
914
+ };
915
+ /**
916
+ * Lightning platform functions namespace.
917
+ *
918
+ * Provides production-grade neural network training using PyTorch Lightning.
919
+ *
920
+ * @example
921
+ * ```typescript
922
+ * const result = Lightning.train(X, y, {
923
+ * architecture: variant("autoencoder", {
924
+ * encoder_layers: [64n],
925
+ * latent_dim: 16n,
926
+ * decoder_layers: [64n],
927
+ * }),
928
+ * output: variant("multi_head", {
929
+ * n_heads: 84n,
930
+ * n_classes_per_head: 4n,
931
+ * class_weights: variant("none", null),
932
+ * }),
933
+ * }, variant("none", null));
934
+ *
935
+ * const embeddings = Lightning.encode(result.model, X);
936
+ * const predictions = Lightning.predict(result.model, X, variant("none", null));
937
+ * ```
938
+ */
939
+ export declare const Lightning: {
940
+ /**
941
+ * Train a Lightning model.
942
+ *
943
+ * Trains a neural network using PyTorch Lightning with early stopping,
944
+ * gradient clipping, and optional epoch callbacks.
945
+ *
946
+ * @example
947
+ * ```ts
948
+ * import { East, FloatType, MatrixType, variant } from "@elaraai/east";
949
+ * import { Lightning, LightningConfigType } from "@elaraai/east-py-datascience";
950
+ *
951
+ * const train = East.function([], Lightning.Types.ResultType, ($) => {
952
+ * const X = $.let([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]]);
953
+ * const y = $.let([[1.0, 0.0], [0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]);
954
+ * const config = $.let({
955
+ * architecture: variant("autoencoder", {
956
+ * encoder_layers: new BigInt64Array([16n]),
957
+ * latent_dim: 4n,
958
+ * decoder_layers: new BigInt64Array([16n]),
959
+ * }),
960
+ * output: variant("regression", null),
961
+ * max_epochs: variant("some", 50n),
962
+ * batch_size: variant("some", 4n),
963
+ * learning_rate: variant("some", 0.001),
964
+ * patience: variant("some", 10n),
965
+ * seed: variant("some", 42n),
966
+ * epoch_callback: variant("none", null),
967
+ * gradient_clip_val: variant("none", null),
968
+ * condition_dim: variant("none", null),
969
+ * }, LightningConfigType);
970
+ * return $.return(Lightning.train(X, y, config, variant("none", null), variant("none", null), variant("none", null)));
971
+ * });
972
+ * ```
973
+ */
974
+ readonly train: import("@elaraai/east").PlatformDefinition<[MatrixType<FloatType>, MatrixType<FloatType>, StructType<{
975
+ /** Model architecture */
976
+ readonly architecture: VariantType<{
977
+ /** Simple MLP: input → hidden → output */
978
+ readonly mlp: StructType<{
979
+ /** Hidden layer sizes */
980
+ readonly hidden_layers: ArrayType<IntegerType>;
981
+ }>;
982
+ /** Autoencoder: input → encoder → latent → decoder → output */
983
+ readonly autoencoder: StructType<{
984
+ /** Encoder hidden layer sizes */
985
+ readonly encoder_layers: ArrayType<IntegerType>;
986
+ /** Latent dimension (bottleneck) */
987
+ readonly latent_dim: IntegerType;
988
+ /** Decoder hidden layer sizes */
989
+ readonly decoder_layers: ArrayType<IntegerType>;
990
+ }>;
991
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
992
+ readonly conv1d: StructType<{
993
+ /** Number of channels (e.g., additive types) */
994
+ readonly n_channels: IntegerType;
995
+ /** Sequence length (e.g., days) */
996
+ readonly sequence_length: IntegerType;
997
+ /** Conv layer channel sizes */
998
+ readonly conv_channels: ArrayType<IntegerType>;
999
+ /** Kernel size for convolutions (must be odd) */
1000
+ readonly kernel_size: IntegerType;
1001
+ /** Latent dimension after flattening */
1002
+ readonly latent_dim: IntegerType;
1003
+ /** Optional condition dimension for conditional generation */
1004
+ readonly condition_dim: OptionType<IntegerType>;
1005
+ }>;
1006
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
1007
+ readonly sequential: StructType<{
1008
+ /** Number of channels (e.g., additive types) */
1009
+ readonly n_channels: IntegerType;
1010
+ /** Sequence length (e.g., days) */
1011
+ readonly sequence_length: IntegerType;
1012
+ /** RNN hidden size */
1013
+ readonly hidden_size: IntegerType;
1014
+ /** Number of RNN layers */
1015
+ readonly n_layers: IntegerType;
1016
+ /** Cell type: lstm or gru */
1017
+ readonly cell_type: VariantType<{
1018
+ readonly lstm: NullType;
1019
+ readonly gru: NullType;
1020
+ }>;
1021
+ /** Latent dimension (from final hidden state) */
1022
+ readonly latent_dim: IntegerType;
1023
+ /** Bidirectional encoder (decoder is always unidirectional) */
1024
+ readonly bidirectional: BooleanType;
1025
+ /** Optional condition dimension for conditional generation */
1026
+ readonly condition_dim: OptionType<IntegerType>;
1027
+ }>;
1028
+ /** Transformer: attention-based autoencoder for complex patterns */
1029
+ readonly transformer: StructType<{
1030
+ /** Number of channels (e.g., additive types) */
1031
+ readonly n_channels: IntegerType;
1032
+ /** Sequence length (e.g., days) */
1033
+ readonly sequence_length: IntegerType;
1034
+ /** Model dimension */
1035
+ readonly d_model: IntegerType;
1036
+ /** Number of attention heads (must divide d_model evenly) */
1037
+ readonly n_attention_heads: IntegerType;
1038
+ /** Number of transformer layers */
1039
+ readonly n_layers: IntegerType;
1040
+ /** Feedforward dimension (default: 4 * d_model) */
1041
+ readonly d_ff: OptionType<IntegerType>;
1042
+ /** Latent dimension (mean pooled output) */
1043
+ readonly latent_dim: IntegerType;
1044
+ /** Optional condition dimension for conditional generation */
1045
+ readonly condition_dim: OptionType<IntegerType>;
1046
+ }>;
1047
+ }>;
1048
+ /** Output mode (determines loss function) */
1049
+ readonly output: VariantType<{
1050
+ /** Regression: MSE loss, no activation */
1051
+ readonly regression: NullType;
1052
+ /** Binary: BCE loss, sigmoid activation */
1053
+ readonly binary: StructType<{
1054
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
1055
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
1056
+ }>;
1057
+ /** Multiclass: CrossEntropy loss, softmax activation */
1058
+ readonly multiclass: StructType<{
1059
+ /** Number of classes */
1060
+ readonly n_classes: IntegerType;
1061
+ /** Optional per-class weights */
1062
+ readonly class_weights: OptionType<VectorType<FloatType>>;
1063
+ }>;
1064
+ /** Multi-head categorical: N independent CrossEntropy heads */
1065
+ readonly multi_head: StructType<{
1066
+ /** Number of heads (e.g., 84 time slots) */
1067
+ readonly n_heads: IntegerType;
1068
+ /** Classes per head (e.g., 4 bins) */
1069
+ readonly n_classes_per_head: IntegerType;
1070
+ /** Optional class weights matrix (n_heads, n_classes) */
1071
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
1072
+ }>;
1073
+ }>;
1074
+ /** Learning rate (default: 1e-3) */
1075
+ readonly learning_rate: OptionType<FloatType>;
1076
+ /** Maximum epochs (default: 100) */
1077
+ readonly max_epochs: OptionType<IntegerType>;
1078
+ /** Early stopping patience (default: 10) */
1079
+ readonly patience: OptionType<IntegerType>;
1080
+ /** Batch size (default: 32) */
1081
+ readonly batch_size: OptionType<IntegerType>;
1082
+ /** Dropout rate (default: 0.1) */
1083
+ readonly dropout: OptionType<FloatType>;
1084
+ /** Gradient clipping value (default: 1.0) */
1085
+ readonly gradient_clip: OptionType<FloatType>;
1086
+ /** L2 regularization weight decay (default: 0) */
1087
+ readonly weight_decay: OptionType<FloatType>;
1088
+ /** Random seed for reproducibility */
1089
+ readonly random_state: OptionType<IntegerType>;
1090
+ /** Optional callback called each epoch */
1091
+ readonly epoch_callback: OptionType<FunctionType<[IntegerType, FloatType, FloatType], NullType>>;
1092
+ }>, OptionType<ArrayType<ArrayType<ArrayType<BooleanType>>>>, OptionType<StructType<{
1093
+ /** Weights per group - shape depends on output type */
1094
+ readonly weights: VariantType<{
1095
+ /** For binary: pos_weight vector per group [n_groups][output_dim] */
1096
+ readonly binary: ArrayType<ArrayType<FloatType>>;
1097
+ /** For multi_head: class_weight matrix per group [n_groups][n_heads][n_classes] */
1098
+ readonly multi_head: ArrayType<ArrayType<ArrayType<FloatType>>>;
1099
+ }>;
1100
+ /** Group index per sample: [n_samples] */
1101
+ readonly sample_groups: ArrayType<IntegerType>;
1102
+ }>>, OptionType<MatrixType<FloatType>>], StructType<{
1103
+ /** Trained model blob */
1104
+ readonly model: VariantType<{
1105
+ readonly lightning: StructType<{
1106
+ /** Serialized model data (state_dict + hparams) */
1107
+ readonly data: BlobType;
1108
+ /** Input dimension */
1109
+ readonly n_features: IntegerType;
1110
+ /** Output dimension */
1111
+ readonly output_dim: IntegerType;
1112
+ /** Architecture type */
1113
+ readonly architecture_type: StringType;
1114
+ /** Output type */
1115
+ readonly output_type: StringType;
1116
+ /** Latent dimension (autoencoder only) */
1117
+ readonly latent_dim: OptionType<IntegerType>;
1118
+ }>;
1119
+ }>;
1120
+ /** Final training loss */
1121
+ readonly train_loss: FloatType;
1122
+ /** Final validation loss */
1123
+ readonly val_loss: FloatType;
1124
+ /** Best epoch (for early stopping) */
1125
+ readonly best_epoch: IntegerType;
1126
+ }>>;
1127
+ /**
1128
+ * Predict using a trained Lightning model.
1129
+ *
1130
+ * Returns predictions with optional mask support for multi-head outputs.
1131
+ *
1132
+ * @example
1133
+ * ```ts
1134
+ * import { East, FloatType, MatrixType, variant } from "@elaraai/east";
1135
+ * import { Lightning } from "@elaraai/east-py-datascience";
1136
+ *
1137
+ * const predictFn = East.function(
1138
+ * [Lightning.Types.ModelBlobType, MatrixType(FloatType)],
1139
+ * MatrixType(FloatType),
1140
+ * ($, model, X) => {
1141
+ * return $.return(Lightning.predict(model, X, variant("none", null), variant("none", null)));
1142
+ * }
1143
+ * );
1144
+ * ```
1145
+ */
1146
+ readonly predict: import("@elaraai/east").PlatformDefinition<[VariantType<{
1147
+ readonly lightning: StructType<{
1148
+ /** Serialized model data (state_dict + hparams) */
1149
+ readonly data: BlobType;
1150
+ /** Input dimension */
1151
+ readonly n_features: IntegerType;
1152
+ /** Output dimension */
1153
+ readonly output_dim: IntegerType;
1154
+ /** Architecture type */
1155
+ readonly architecture_type: StringType;
1156
+ /** Output type */
1157
+ readonly output_type: StringType;
1158
+ /** Latent dimension (autoencoder only) */
1159
+ readonly latent_dim: OptionType<IntegerType>;
1160
+ }>;
1161
+ }>, MatrixType<FloatType>, OptionType<ArrayType<ArrayType<ArrayType<BooleanType>>>>, OptionType<MatrixType<FloatType>>], MatrixType<FloatType>>;
1162
+ /**
1163
+ * Encode inputs to latent space (autoencoder only).
1164
+ *
1165
+ * @example
1166
+ * ```ts
1167
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
1168
+ * import { Lightning } from "@elaraai/east-py-datascience";
1169
+ *
1170
+ * const encodeFn = East.function(
1171
+ * [Lightning.Types.ModelBlobType, MatrixType(FloatType)],
1172
+ * MatrixType(FloatType),
1173
+ * ($, model, X) => {
1174
+ * // Returns (n_samples x latent_dim) embeddings
1175
+ * return $.return(Lightning.encode(model, X));
1176
+ * }
1177
+ * );
1178
+ * ```
1179
+ */
1180
+ readonly encode: import("@elaraai/east").PlatformDefinition<[VariantType<{
1181
+ readonly lightning: StructType<{
1182
+ /** Serialized model data (state_dict + hparams) */
1183
+ readonly data: BlobType;
1184
+ /** Input dimension */
1185
+ readonly n_features: IntegerType;
1186
+ /** Output dimension */
1187
+ readonly output_dim: IntegerType;
1188
+ /** Architecture type */
1189
+ readonly architecture_type: StringType;
1190
+ /** Output type */
1191
+ readonly output_type: StringType;
1192
+ /** Latent dimension (autoencoder only) */
1193
+ readonly latent_dim: OptionType<IntegerType>;
1194
+ }>;
1195
+ }>, MatrixType<FloatType>], MatrixType<FloatType>>;
1196
+ /**
1197
+ * Decode latent embeddings to output space (autoencoder only).
1198
+ *
1199
+ * @example
1200
+ * ```ts
1201
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
1202
+ * import { Lightning } from "@elaraai/east-py-datascience";
1203
+ *
1204
+ * const decodeFn = East.function(
1205
+ * [Lightning.Types.ModelBlobType, MatrixType(FloatType)],
1206
+ * MatrixType(FloatType),
1207
+ * ($, model, z) => {
1208
+ * // z is (n_samples x latent_dim), returns (n_samples x output_dim)
1209
+ * return $.return(Lightning.decode(model, z));
1210
+ * }
1211
+ * );
1212
+ * ```
1213
+ */
1214
+ readonly decode: import("@elaraai/east").PlatformDefinition<[VariantType<{
1215
+ readonly lightning: StructType<{
1216
+ /** Serialized model data (state_dict + hparams) */
1217
+ readonly data: BlobType;
1218
+ /** Input dimension */
1219
+ readonly n_features: IntegerType;
1220
+ /** Output dimension */
1221
+ readonly output_dim: IntegerType;
1222
+ /** Architecture type */
1223
+ readonly architecture_type: StringType;
1224
+ /** Output type */
1225
+ readonly output_type: StringType;
1226
+ /** Latent dimension (autoencoder only) */
1227
+ readonly latent_dim: OptionType<IntegerType>;
1228
+ }>;
1229
+ }>, MatrixType<FloatType>], MatrixType<FloatType>>;
1230
+ /**
1231
+ * Decode latent embeddings with condition vector (temporal architectures).
1232
+ *
1233
+ * @example
1234
+ * ```ts
1235
+ * import { East, FloatType, MatrixType } from "@elaraai/east";
1236
+ * import { Lightning } from "@elaraai/east-py-datascience";
1237
+ *
1238
+ * const decodeFn = East.function(
1239
+ * [Lightning.Types.ModelBlobType, MatrixType(FloatType), MatrixType(FloatType)],
1240
+ * MatrixType(FloatType),
1241
+ * ($, model, z, condition) => {
1242
+ * // z: (n_samples, latent_dim), condition: (n_samples, condition_dim)
1243
+ * return $.return(Lightning.decodeConditional(model, z, condition));
1244
+ * }
1245
+ * );
1246
+ * ```
1247
+ */
1248
+ readonly decodeConditional: import("@elaraai/east").PlatformDefinition<[VariantType<{
1249
+ readonly lightning: StructType<{
1250
+ /** Serialized model data (state_dict + hparams) */
1251
+ readonly data: BlobType;
1252
+ /** Input dimension */
1253
+ readonly n_features: IntegerType;
1254
+ /** Output dimension */
1255
+ readonly output_dim: IntegerType;
1256
+ /** Architecture type */
1257
+ readonly architecture_type: StringType;
1258
+ /** Output type */
1259
+ readonly output_type: StringType;
1260
+ /** Latent dimension (autoencoder only) */
1261
+ readonly latent_dim: OptionType<IntegerType>;
1262
+ }>;
1263
+ }>, MatrixType<FloatType>, MatrixType<FloatType>], MatrixType<FloatType>>;
1264
+ /**
1265
+ * Generate sequence autoregressively from a sequential model.
1266
+ *
1267
+ * @example
1268
+ * ```ts
1269
+ * import { East, FloatType, IntegerType, BooleanType, MatrixType, variant } from "@elaraai/east";
1270
+ * import { Lightning } from "@elaraai/east-py-datascience";
1271
+ *
1272
+ * const generateFn = East.function(
1273
+ * [Lightning.Types.ModelBlobType, MatrixType(FloatType)],
1274
+ * MatrixType(FloatType),
1275
+ * ($, model, prefix) => {
1276
+ * const config = $.let({ n_steps: 10n, temperature: 1.0, return_probs: false });
1277
+ * // prefix: partial history, condition: none
1278
+ * return $.return(Lightning.generateSequence(model, prefix, variant("none", null), config));
1279
+ * }
1280
+ * );
1281
+ * ```
1282
+ */
1283
+ readonly generateSequence: import("@elaraai/east").PlatformDefinition<[VariantType<{
1284
+ readonly lightning: StructType<{
1285
+ /** Serialized model data (state_dict + hparams) */
1286
+ readonly data: BlobType;
1287
+ /** Input dimension */
1288
+ readonly n_features: IntegerType;
1289
+ /** Output dimension */
1290
+ readonly output_dim: IntegerType;
1291
+ /** Architecture type */
1292
+ readonly architecture_type: StringType;
1293
+ /** Output type */
1294
+ readonly output_type: StringType;
1295
+ /** Latent dimension (autoencoder only) */
1296
+ readonly latent_dim: OptionType<IntegerType>;
1297
+ }>;
1298
+ }>, MatrixType<FloatType>, OptionType<MatrixType<FloatType>>, StructType<{
1299
+ /** Number of steps to generate */
1300
+ readonly n_steps: IntegerType;
1301
+ /** Sampling temperature: 0.0 = argmax, > 0 = scaled sampling */
1302
+ readonly temperature: FloatType;
1303
+ /** If true, return probabilities. If false, return samples. */
1304
+ readonly return_probs: BooleanType;
1305
+ }>], MatrixType<FloatType>>;
1306
+ /**
1307
+ * Type definitions for Lightning functions.
1308
+ */
1309
+ readonly Types: {
1310
+ readonly OutputType: VariantType<{
1311
+ /** Regression: MSE loss, no activation */
1312
+ readonly regression: NullType;
1313
+ /** Binary: BCE loss, sigmoid activation */
1314
+ readonly binary: StructType<{
1315
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
1316
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
1317
+ }>;
1318
+ /** Multiclass: CrossEntropy loss, softmax activation */
1319
+ readonly multiclass: StructType<{
1320
+ /** Number of classes */
1321
+ readonly n_classes: IntegerType;
1322
+ /** Optional per-class weights */
1323
+ readonly class_weights: OptionType<VectorType<FloatType>>;
1324
+ }>;
1325
+ /** Multi-head categorical: N independent CrossEntropy heads */
1326
+ readonly multi_head: StructType<{
1327
+ /** Number of heads (e.g., 84 time slots) */
1328
+ readonly n_heads: IntegerType;
1329
+ /** Classes per head (e.g., 4 bins) */
1330
+ readonly n_classes_per_head: IntegerType;
1331
+ /** Optional class weights matrix (n_heads, n_classes) */
1332
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
1333
+ }>;
1334
+ }>;
1335
+ readonly ArchitectureType: VariantType<{
1336
+ /** Simple MLP: input → hidden → output */
1337
+ readonly mlp: StructType<{
1338
+ /** Hidden layer sizes */
1339
+ readonly hidden_layers: ArrayType<IntegerType>;
1340
+ }>;
1341
+ /** Autoencoder: input → encoder → latent → decoder → output */
1342
+ readonly autoencoder: StructType<{
1343
+ /** Encoder hidden layer sizes */
1344
+ readonly encoder_layers: ArrayType<IntegerType>;
1345
+ /** Latent dimension (bottleneck) */
1346
+ readonly latent_dim: IntegerType;
1347
+ /** Decoder hidden layer sizes */
1348
+ readonly decoder_layers: ArrayType<IntegerType>;
1349
+ }>;
1350
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
1351
+ readonly conv1d: StructType<{
1352
+ /** Number of channels (e.g., additive types) */
1353
+ readonly n_channels: IntegerType;
1354
+ /** Sequence length (e.g., days) */
1355
+ readonly sequence_length: IntegerType;
1356
+ /** Conv layer channel sizes */
1357
+ readonly conv_channels: ArrayType<IntegerType>;
1358
+ /** Kernel size for convolutions (must be odd) */
1359
+ readonly kernel_size: IntegerType;
1360
+ /** Latent dimension after flattening */
1361
+ readonly latent_dim: IntegerType;
1362
+ /** Optional condition dimension for conditional generation */
1363
+ readonly condition_dim: OptionType<IntegerType>;
1364
+ }>;
1365
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
1366
+ readonly sequential: StructType<{
1367
+ /** Number of channels (e.g., additive types) */
1368
+ readonly n_channels: IntegerType;
1369
+ /** Sequence length (e.g., days) */
1370
+ readonly sequence_length: IntegerType;
1371
+ /** RNN hidden size */
1372
+ readonly hidden_size: IntegerType;
1373
+ /** Number of RNN layers */
1374
+ readonly n_layers: IntegerType;
1375
+ /** Cell type: lstm or gru */
1376
+ readonly cell_type: VariantType<{
1377
+ readonly lstm: NullType;
1378
+ readonly gru: NullType;
1379
+ }>;
1380
+ /** Latent dimension (from final hidden state) */
1381
+ readonly latent_dim: IntegerType;
1382
+ /** Bidirectional encoder (decoder is always unidirectional) */
1383
+ readonly bidirectional: BooleanType;
1384
+ /** Optional condition dimension for conditional generation */
1385
+ readonly condition_dim: OptionType<IntegerType>;
1386
+ }>;
1387
+ /** Transformer: attention-based autoencoder for complex patterns */
1388
+ readonly transformer: StructType<{
1389
+ /** Number of channels (e.g., additive types) */
1390
+ readonly n_channels: IntegerType;
1391
+ /** Sequence length (e.g., days) */
1392
+ readonly sequence_length: IntegerType;
1393
+ /** Model dimension */
1394
+ readonly d_model: IntegerType;
1395
+ /** Number of attention heads (must divide d_model evenly) */
1396
+ readonly n_attention_heads: IntegerType;
1397
+ /** Number of transformer layers */
1398
+ readonly n_layers: IntegerType;
1399
+ /** Feedforward dimension (default: 4 * d_model) */
1400
+ readonly d_ff: OptionType<IntegerType>;
1401
+ /** Latent dimension (mean pooled output) */
1402
+ readonly latent_dim: IntegerType;
1403
+ /** Optional condition dimension for conditional generation */
1404
+ readonly condition_dim: OptionType<IntegerType>;
1405
+ }>;
1406
+ }>;
1407
+ readonly CellType: VariantType<{
1408
+ readonly lstm: NullType;
1409
+ readonly gru: NullType;
1410
+ }>;
1411
+ readonly EpochCallbackType: FunctionType<[IntegerType, FloatType, FloatType], NullType>;
1412
+ readonly ConfigType: StructType<{
1413
+ /** Model architecture */
1414
+ readonly architecture: VariantType<{
1415
+ /** Simple MLP: input → hidden → output */
1416
+ readonly mlp: StructType<{
1417
+ /** Hidden layer sizes */
1418
+ readonly hidden_layers: ArrayType<IntegerType>;
1419
+ }>;
1420
+ /** Autoencoder: input → encoder → latent → decoder → output */
1421
+ readonly autoencoder: StructType<{
1422
+ /** Encoder hidden layer sizes */
1423
+ readonly encoder_layers: ArrayType<IntegerType>;
1424
+ /** Latent dimension (bottleneck) */
1425
+ readonly latent_dim: IntegerType;
1426
+ /** Decoder hidden layer sizes */
1427
+ readonly decoder_layers: ArrayType<IntegerType>;
1428
+ }>;
1429
+ /** Conv1D: 1D convolutional autoencoder for temporal patterns */
1430
+ readonly conv1d: StructType<{
1431
+ /** Number of channels (e.g., additive types) */
1432
+ readonly n_channels: IntegerType;
1433
+ /** Sequence length (e.g., days) */
1434
+ readonly sequence_length: IntegerType;
1435
+ /** Conv layer channel sizes */
1436
+ readonly conv_channels: ArrayType<IntegerType>;
1437
+ /** Kernel size for convolutions (must be odd) */
1438
+ readonly kernel_size: IntegerType;
1439
+ /** Latent dimension after flattening */
1440
+ readonly latent_dim: IntegerType;
1441
+ /** Optional condition dimension for conditional generation */
1442
+ readonly condition_dim: OptionType<IntegerType>;
1443
+ }>;
1444
+ /** Sequential: LSTM/GRU autoencoder for long-range dependencies */
1445
+ readonly sequential: StructType<{
1446
+ /** Number of channels (e.g., additive types) */
1447
+ readonly n_channels: IntegerType;
1448
+ /** Sequence length (e.g., days) */
1449
+ readonly sequence_length: IntegerType;
1450
+ /** RNN hidden size */
1451
+ readonly hidden_size: IntegerType;
1452
+ /** Number of RNN layers */
1453
+ readonly n_layers: IntegerType;
1454
+ /** Cell type: lstm or gru */
1455
+ readonly cell_type: VariantType<{
1456
+ readonly lstm: NullType;
1457
+ readonly gru: NullType;
1458
+ }>;
1459
+ /** Latent dimension (from final hidden state) */
1460
+ readonly latent_dim: IntegerType;
1461
+ /** Bidirectional encoder (decoder is always unidirectional) */
1462
+ readonly bidirectional: BooleanType;
1463
+ /** Optional condition dimension for conditional generation */
1464
+ readonly condition_dim: OptionType<IntegerType>;
1465
+ }>;
1466
+ /** Transformer: attention-based autoencoder for complex patterns */
1467
+ readonly transformer: StructType<{
1468
+ /** Number of channels (e.g., additive types) */
1469
+ readonly n_channels: IntegerType;
1470
+ /** Sequence length (e.g., days) */
1471
+ readonly sequence_length: IntegerType;
1472
+ /** Model dimension */
1473
+ readonly d_model: IntegerType;
1474
+ /** Number of attention heads (must divide d_model evenly) */
1475
+ readonly n_attention_heads: IntegerType;
1476
+ /** Number of transformer layers */
1477
+ readonly n_layers: IntegerType;
1478
+ /** Feedforward dimension (default: 4 * d_model) */
1479
+ readonly d_ff: OptionType<IntegerType>;
1480
+ /** Latent dimension (mean pooled output) */
1481
+ readonly latent_dim: IntegerType;
1482
+ /** Optional condition dimension for conditional generation */
1483
+ readonly condition_dim: OptionType<IntegerType>;
1484
+ }>;
1485
+ }>;
1486
+ /** Output mode (determines loss function) */
1487
+ readonly output: VariantType<{
1488
+ /** Regression: MSE loss, no activation */
1489
+ readonly regression: NullType;
1490
+ /** Binary: BCE loss, sigmoid activation */
1491
+ readonly binary: StructType<{
1492
+ /** Optional per-position pos_weights for class imbalance [output_dim] */
1493
+ readonly pos_weight: OptionType<VectorType<FloatType>>;
1494
+ }>;
1495
+ /** Multiclass: CrossEntropy loss, softmax activation */
1496
+ readonly multiclass: StructType<{
1497
+ /** Number of classes */
1498
+ readonly n_classes: IntegerType;
1499
+ /** Optional per-class weights */
1500
+ readonly class_weights: OptionType<VectorType<FloatType>>;
1501
+ }>;
1502
+ /** Multi-head categorical: N independent CrossEntropy heads */
1503
+ readonly multi_head: StructType<{
1504
+ /** Number of heads (e.g., 84 time slots) */
1505
+ readonly n_heads: IntegerType;
1506
+ /** Classes per head (e.g., 4 bins) */
1507
+ readonly n_classes_per_head: IntegerType;
1508
+ /** Optional class weights matrix (n_heads, n_classes) */
1509
+ readonly class_weights: OptionType<MatrixType<FloatType>>;
1510
+ }>;
1511
+ }>;
1512
+ /** Learning rate (default: 1e-3) */
1513
+ readonly learning_rate: OptionType<FloatType>;
1514
+ /** Maximum epochs (default: 100) */
1515
+ readonly max_epochs: OptionType<IntegerType>;
1516
+ /** Early stopping patience (default: 10) */
1517
+ readonly patience: OptionType<IntegerType>;
1518
+ /** Batch size (default: 32) */
1519
+ readonly batch_size: OptionType<IntegerType>;
1520
+ /** Dropout rate (default: 0.1) */
1521
+ readonly dropout: OptionType<FloatType>;
1522
+ /** Gradient clipping value (default: 1.0) */
1523
+ readonly gradient_clip: OptionType<FloatType>;
1524
+ /** L2 regularization weight decay (default: 0) */
1525
+ readonly weight_decay: OptionType<FloatType>;
1526
+ /** Random seed for reproducibility */
1527
+ readonly random_state: OptionType<IntegerType>;
1528
+ /** Optional callback called each epoch */
1529
+ readonly epoch_callback: OptionType<FunctionType<[IntegerType, FloatType, FloatType], NullType>>;
1530
+ }>;
1531
+ readonly ResultType: StructType<{
1532
+ /** Trained model blob */
1533
+ readonly model: VariantType<{
1534
+ readonly lightning: StructType<{
1535
+ /** Serialized model data (state_dict + hparams) */
1536
+ readonly data: BlobType;
1537
+ /** Input dimension */
1538
+ readonly n_features: IntegerType;
1539
+ /** Output dimension */
1540
+ readonly output_dim: IntegerType;
1541
+ /** Architecture type */
1542
+ readonly architecture_type: StringType;
1543
+ /** Output type */
1544
+ readonly output_type: StringType;
1545
+ /** Latent dimension (autoencoder only) */
1546
+ readonly latent_dim: OptionType<IntegerType>;
1547
+ }>;
1548
+ }>;
1549
+ /** Final training loss */
1550
+ readonly train_loss: FloatType;
1551
+ /** Final validation loss */
1552
+ readonly val_loss: FloatType;
1553
+ /** Best epoch (for early stopping) */
1554
+ readonly best_epoch: IntegerType;
1555
+ }>;
1556
+ readonly ModelBlobType: VariantType<{
1557
+ readonly lightning: StructType<{
1558
+ /** Serialized model data (state_dict + hparams) */
1559
+ readonly data: BlobType;
1560
+ /** Input dimension */
1561
+ readonly n_features: IntegerType;
1562
+ /** Output dimension */
1563
+ readonly output_dim: IntegerType;
1564
+ /** Architecture type */
1565
+ readonly architecture_type: StringType;
1566
+ /** Output type */
1567
+ readonly output_type: StringType;
1568
+ /** Latent dimension (autoencoder only) */
1569
+ readonly latent_dim: OptionType<IntegerType>;
1570
+ }>;
1571
+ }>;
1572
+ readonly Tensor3DBoolType: ArrayType<ArrayType<ArrayType<BooleanType>>>;
1573
+ readonly GroupWeightsType: StructType<{
1574
+ /** Weights per group - shape depends on output type */
1575
+ readonly weights: VariantType<{
1576
+ /** For binary: pos_weight vector per group [n_groups][output_dim] */
1577
+ readonly binary: ArrayType<ArrayType<FloatType>>;
1578
+ /** For multi_head: class_weight matrix per group [n_groups][n_heads][n_classes] */
1579
+ readonly multi_head: ArrayType<ArrayType<ArrayType<FloatType>>>;
1580
+ }>;
1581
+ /** Group index per sample: [n_samples] */
1582
+ readonly sample_groups: ArrayType<IntegerType>;
1583
+ }>;
1584
+ readonly GenerateConfigType: StructType<{
1585
+ /** Number of steps to generate */
1586
+ readonly n_steps: IntegerType;
1587
+ /** Sampling temperature: 0.0 = argmax, > 0 = scaled sampling */
1588
+ readonly temperature: FloatType;
1589
+ /** If true, return probabilities. If false, return samples. */
1590
+ readonly return_probs: BooleanType;
1591
+ }>;
1592
+ };
1593
+ };
1594
+ //# sourceMappingURL=lightning.d.ts.map