@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.
- package/README.md +58 -1
- package/dist/src/alns/alns.d.ts +528 -0
- package/dist/src/alns/alns.d.ts.map +1 -0
- package/dist/src/alns/alns.js +238 -0
- package/dist/src/alns/alns.js.map +1 -0
- package/dist/src/google_or/google_or.d.ts +2422 -0
- package/dist/src/google_or/google_or.d.ts.map +1 -0
- package/dist/src/google_or/google_or.js +542 -0
- package/dist/src/google_or/google_or.js.map +1 -0
- package/dist/{gp → src/gp}/gp.d.ts +185 -136
- package/dist/src/gp/gp.d.ts.map +1 -0
- package/dist/{gp → src/gp}/gp.js +64 -12
- package/dist/src/gp/gp.js.map +1 -0
- package/dist/src/index.d.ts +34 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +57 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lightgbm/lightgbm.d.ts +575 -0
- package/dist/src/lightgbm/lightgbm.d.ts.map +1 -0
- package/dist/{lightgbm → src/lightgbm}/lightgbm.js +104 -18
- package/dist/src/lightgbm/lightgbm.js.map +1 -0
- package/dist/src/lightning/lightning.d.ts +1594 -0
- package/dist/src/lightning/lightning.d.ts.map +1 -0
- package/dist/src/lightning/lightning.js +468 -0
- package/dist/src/lightning/lightning.js.map +1 -0
- package/dist/{mads → src/mads}/mads.d.ts +109 -112
- package/dist/src/mads/mads.d.ts.map +1 -0
- package/dist/{mads → src/mads}/mads.js +6 -8
- package/dist/src/mads/mads.js.map +1 -0
- package/dist/src/mapie/mapie.d.ts +3680 -0
- package/dist/src/mapie/mapie.d.ts.map +1 -0
- package/dist/src/mapie/mapie.js +616 -0
- package/dist/src/mapie/mapie.js.map +1 -0
- package/dist/{ngboost → src/ngboost}/ngboost.d.ts +192 -142
- package/dist/src/ngboost/ngboost.d.ts.map +1 -0
- package/dist/{ngboost → src/ngboost}/ngboost.js +67 -14
- package/dist/src/ngboost/ngboost.js.map +1 -0
- package/dist/src/optimization/optimization.d.ts +420 -0
- package/dist/src/optimization/optimization.d.ts.map +1 -0
- package/dist/src/optimization/optimization.js +257 -0
- package/dist/src/optimization/optimization.js.map +1 -0
- package/dist/{optuna → src/optuna}/optuna.d.ts +374 -314
- package/dist/src/optuna/optuna.d.ts.map +1 -0
- package/dist/{optuna → src/optuna}/optuna.js +2 -0
- package/dist/src/optuna/optuna.js.map +1 -0
- package/dist/src/pymc/pymc.d.ts +2932 -0
- package/dist/src/pymc/pymc.d.ts.map +1 -0
- package/dist/src/pymc/pymc.js +688 -0
- package/dist/src/pymc/pymc.js.map +1 -0
- package/dist/src/scipy/scipy.d.ts +2205 -0
- package/dist/src/scipy/scipy.d.ts.map +1 -0
- package/dist/src/scipy/scipy.js +884 -0
- package/dist/src/scipy/scipy.js.map +1 -0
- package/dist/src/shap/shap.d.ts +2988 -0
- package/dist/src/shap/shap.d.ts.map +1 -0
- package/dist/src/shap/shap.js +500 -0
- package/dist/src/shap/shap.js.map +1 -0
- package/dist/{simanneal → src/simanneal}/simanneal.d.ts +257 -160
- package/dist/src/simanneal/simanneal.d.ts.map +1 -0
- package/dist/{simanneal → src/simanneal}/simanneal.js +105 -8
- package/dist/src/simanneal/simanneal.js.map +1 -0
- package/dist/src/simulation/simulation.d.ts +431 -0
- package/dist/src/simulation/simulation.d.ts.map +1 -0
- package/dist/src/simulation/simulation.js +306 -0
- package/dist/src/simulation/simulation.js.map +1 -0
- package/dist/src/sklearn/sklearn.d.ts +6362 -0
- package/dist/src/sklearn/sklearn.d.ts.map +1 -0
- package/dist/src/sklearn/sklearn.js +1508 -0
- package/dist/src/sklearn/sklearn.js.map +1 -0
- package/dist/src/torch/torch.d.ts +1205 -0
- package/dist/src/torch/torch.d.ts.map +1 -0
- package/dist/{torch → src/torch}/torch.js +109 -18
- package/dist/src/torch/torch.js.map +1 -0
- package/dist/src/types.d.ts +43 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +44 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/xgboost/xgboost.d.ts +1424 -0
- package/dist/src/xgboost/xgboost.d.ts.map +1 -0
- package/dist/src/xgboost/xgboost.js +432 -0
- package/dist/src/xgboost/xgboost.js.map +1 -0
- package/package.json +12 -12
- package/dist/gp/gp.d.ts.map +0 -1
- package/dist/gp/gp.js.map +0 -1
- package/dist/index.d.ts +0 -27
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -41
- package/dist/index.js.map +0 -1
- package/dist/lightgbm/lightgbm.d.ts +0 -494
- package/dist/lightgbm/lightgbm.d.ts.map +0 -1
- package/dist/lightgbm/lightgbm.js.map +0 -1
- package/dist/mads/mads.d.ts.map +0 -1
- package/dist/mads/mads.js.map +0 -1
- package/dist/ngboost/ngboost.d.ts.map +0 -1
- package/dist/ngboost/ngboost.js.map +0 -1
- package/dist/optuna/optuna.d.ts.map +0 -1
- package/dist/optuna/optuna.js.map +0 -1
- package/dist/scipy/scipy.d.ts +0 -1260
- package/dist/scipy/scipy.d.ts.map +0 -1
- package/dist/scipy/scipy.js +0 -413
- package/dist/scipy/scipy.js.map +0 -1
- package/dist/shap/shap.d.ts +0 -657
- package/dist/shap/shap.d.ts.map +0 -1
- package/dist/shap/shap.js +0 -241
- package/dist/shap/shap.js.map +0 -1
- package/dist/simanneal/simanneal.d.ts.map +0 -1
- package/dist/simanneal/simanneal.js.map +0 -1
- package/dist/sklearn/sklearn.d.ts +0 -2691
- package/dist/sklearn/sklearn.d.ts.map +0 -1
- package/dist/sklearn/sklearn.js +0 -524
- package/dist/sklearn/sklearn.js.map +0 -1
- package/dist/torch/torch.d.ts +0 -1081
- package/dist/torch/torch.d.ts.map +0 -1
- package/dist/torch/torch.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -80
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -81
- package/dist/types.js.map +0 -1
- package/dist/xgboost/xgboost.d.ts +0 -504
- package/dist/xgboost/xgboost.d.ts.map +0 -1
- package/dist/xgboost/xgboost.js +0 -177
- package/dist/xgboost/xgboost.js.map +0 -1
package/dist/torch/torch.d.ts
DELETED
|
@@ -1,1081 +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
|
-
* PyTorch platform functions for East.
|
|
7
|
-
*
|
|
8
|
-
* Provides neural network models using PyTorch.
|
|
9
|
-
* Uses cloudpickle for model serialization.
|
|
10
|
-
*
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
|
-
import { StructType, VariantType, OptionType, IntegerType, FloatType, BlobType, ArrayType, NullType } from "@elaraai/east";
|
|
14
|
-
export { VectorType, MatrixType } from "../types.js";
|
|
15
|
-
/**
|
|
16
|
-
* Activation function type for hidden layers.
|
|
17
|
-
*/
|
|
18
|
-
export declare const TorchActivationType: VariantType<{
|
|
19
|
-
/** Rectified Linear Unit */
|
|
20
|
-
relu: NullType;
|
|
21
|
-
/** Hyperbolic tangent */
|
|
22
|
-
tanh: NullType;
|
|
23
|
-
/** Sigmoid function */
|
|
24
|
-
sigmoid: NullType;
|
|
25
|
-
/** Leaky ReLU */
|
|
26
|
-
leaky_relu: NullType;
|
|
27
|
-
}>;
|
|
28
|
-
/**
|
|
29
|
-
* Loss function type for training.
|
|
30
|
-
*/
|
|
31
|
-
export declare const TorchLossType: VariantType<{
|
|
32
|
-
/** Mean Squared Error (regression) */
|
|
33
|
-
mse: NullType;
|
|
34
|
-
/** Mean Absolute Error (regression) */
|
|
35
|
-
mae: NullType;
|
|
36
|
-
/** Cross Entropy (classification) */
|
|
37
|
-
cross_entropy: NullType;
|
|
38
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
39
|
-
kl_div: NullType;
|
|
40
|
-
}>;
|
|
41
|
-
/**
|
|
42
|
-
* Optimizer type for training.
|
|
43
|
-
*/
|
|
44
|
-
export declare const TorchOptimizerType: VariantType<{
|
|
45
|
-
/** Adam optimizer */
|
|
46
|
-
adam: NullType;
|
|
47
|
-
/** Stochastic Gradient Descent */
|
|
48
|
-
sgd: NullType;
|
|
49
|
-
/** AdamW with weight decay */
|
|
50
|
-
adamw: NullType;
|
|
51
|
-
/** RMSprop optimizer */
|
|
52
|
-
rmsprop: NullType;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Output activation function type for the final layer.
|
|
56
|
-
* Applied only to the output layer, not hidden layers.
|
|
57
|
-
*/
|
|
58
|
-
export declare const TorchOutputActivationType: VariantType<{
|
|
59
|
-
/** No activation (linear output) - default */
|
|
60
|
-
none: NullType;
|
|
61
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
62
|
-
softmax: NullType;
|
|
63
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
64
|
-
sigmoid: NullType;
|
|
65
|
-
}>;
|
|
66
|
-
/**
|
|
67
|
-
* Configuration for MLP architecture.
|
|
68
|
-
*/
|
|
69
|
-
export declare const TorchMLPConfigType: StructType<{
|
|
70
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
71
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
72
|
-
/** Activation function for hidden layers (default relu) */
|
|
73
|
-
activation: OptionType<VariantType<{
|
|
74
|
-
/** Rectified Linear Unit */
|
|
75
|
-
relu: NullType;
|
|
76
|
-
/** Hyperbolic tangent */
|
|
77
|
-
tanh: NullType;
|
|
78
|
-
/** Sigmoid function */
|
|
79
|
-
sigmoid: NullType;
|
|
80
|
-
/** Leaky ReLU */
|
|
81
|
-
leaky_relu: NullType;
|
|
82
|
-
}>>;
|
|
83
|
-
/** Output activation function (default none/linear) */
|
|
84
|
-
output_activation: OptionType<VariantType<{
|
|
85
|
-
/** No activation (linear output) - default */
|
|
86
|
-
none: NullType;
|
|
87
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
88
|
-
softmax: NullType;
|
|
89
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
90
|
-
sigmoid: NullType;
|
|
91
|
-
}>>;
|
|
92
|
-
/** Dropout rate (default 0.0) */
|
|
93
|
-
dropout: OptionType<FloatType>;
|
|
94
|
-
/** Output dimension (default 1) */
|
|
95
|
-
output_dim: OptionType<IntegerType>;
|
|
96
|
-
}>;
|
|
97
|
-
/**
|
|
98
|
-
* Configuration for training.
|
|
99
|
-
*/
|
|
100
|
-
export declare const TorchTrainConfigType: StructType<{
|
|
101
|
-
/** Number of epochs (default 100) */
|
|
102
|
-
epochs: OptionType<IntegerType>;
|
|
103
|
-
/** Batch size (default 32) */
|
|
104
|
-
batch_size: OptionType<IntegerType>;
|
|
105
|
-
/** Learning rate (default 0.001) */
|
|
106
|
-
learning_rate: OptionType<FloatType>;
|
|
107
|
-
/** Loss function (default mse) */
|
|
108
|
-
loss: OptionType<VariantType<{
|
|
109
|
-
/** Mean Squared Error (regression) */
|
|
110
|
-
mse: NullType;
|
|
111
|
-
/** Mean Absolute Error (regression) */
|
|
112
|
-
mae: NullType;
|
|
113
|
-
/** Cross Entropy (classification) */
|
|
114
|
-
cross_entropy: NullType;
|
|
115
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
116
|
-
kl_div: NullType;
|
|
117
|
-
}>>;
|
|
118
|
-
/** Optimizer (default adam) */
|
|
119
|
-
optimizer: OptionType<VariantType<{
|
|
120
|
-
/** Adam optimizer */
|
|
121
|
-
adam: NullType;
|
|
122
|
-
/** Stochastic Gradient Descent */
|
|
123
|
-
sgd: NullType;
|
|
124
|
-
/** AdamW with weight decay */
|
|
125
|
-
adamw: NullType;
|
|
126
|
-
/** RMSprop optimizer */
|
|
127
|
-
rmsprop: NullType;
|
|
128
|
-
}>>;
|
|
129
|
-
/** Early stopping patience, 0 = disabled */
|
|
130
|
-
early_stopping: OptionType<IntegerType>;
|
|
131
|
-
/** Validation split fraction (default 0.2) */
|
|
132
|
-
validation_split: OptionType<FloatType>;
|
|
133
|
-
/** Random seed for reproducibility */
|
|
134
|
-
random_state: OptionType<IntegerType>;
|
|
135
|
-
}>;
|
|
136
|
-
/**
|
|
137
|
-
* Result type for training.
|
|
138
|
-
*/
|
|
139
|
-
export declare const TorchTrainResultType: StructType<{
|
|
140
|
-
/** Training loss per epoch */
|
|
141
|
-
train_losses: ArrayType<FloatType>;
|
|
142
|
-
/** Validation loss per epoch */
|
|
143
|
-
val_losses: ArrayType<FloatType>;
|
|
144
|
-
/** Best epoch (for early stopping) */
|
|
145
|
-
best_epoch: IntegerType;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Combined result from training (model + metrics).
|
|
149
|
-
*/
|
|
150
|
-
export declare const TorchTrainOutputType: StructType<{
|
|
151
|
-
/** Trained model blob */
|
|
152
|
-
model: VariantType<{
|
|
153
|
-
torch_mlp: StructType<{
|
|
154
|
-
data: BlobType;
|
|
155
|
-
n_features: IntegerType;
|
|
156
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
157
|
-
output_dim: IntegerType;
|
|
158
|
-
}>;
|
|
159
|
-
}>;
|
|
160
|
-
/** Training result with losses */
|
|
161
|
-
result: StructType<{
|
|
162
|
-
/** Training loss per epoch */
|
|
163
|
-
train_losses: ArrayType<FloatType>;
|
|
164
|
-
/** Validation loss per epoch */
|
|
165
|
-
val_losses: ArrayType<FloatType>;
|
|
166
|
-
/** Best epoch (for early stopping) */
|
|
167
|
-
best_epoch: IntegerType;
|
|
168
|
-
}>;
|
|
169
|
-
}>;
|
|
170
|
-
/**
|
|
171
|
-
* Model blob type for serialized PyTorch models.
|
|
172
|
-
*/
|
|
173
|
-
export declare const TorchModelBlobType: VariantType<{
|
|
174
|
-
/** PyTorch MLP model */
|
|
175
|
-
torch_mlp: StructType<{
|
|
176
|
-
/** Cloudpickle serialized model */
|
|
177
|
-
data: BlobType;
|
|
178
|
-
/** Number of input features */
|
|
179
|
-
n_features: IntegerType;
|
|
180
|
-
/** Hidden layer sizes */
|
|
181
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
182
|
-
/** Output dimension */
|
|
183
|
-
output_dim: IntegerType;
|
|
184
|
-
}>;
|
|
185
|
-
}>;
|
|
186
|
-
/**
|
|
187
|
-
* Train a PyTorch MLP model.
|
|
188
|
-
*
|
|
189
|
-
* @param X - Feature matrix
|
|
190
|
-
* @param y - Target vector
|
|
191
|
-
* @param mlp_config - MLP architecture configuration
|
|
192
|
-
* @param train_config - Training configuration
|
|
193
|
-
* @returns Model blob and training result
|
|
194
|
-
*/
|
|
195
|
-
export declare const torch_mlp_train: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<FloatType>, StructType<{
|
|
196
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
197
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
198
|
-
/** Activation function for hidden layers (default relu) */
|
|
199
|
-
activation: OptionType<VariantType<{
|
|
200
|
-
/** Rectified Linear Unit */
|
|
201
|
-
relu: NullType;
|
|
202
|
-
/** Hyperbolic tangent */
|
|
203
|
-
tanh: NullType;
|
|
204
|
-
/** Sigmoid function */
|
|
205
|
-
sigmoid: NullType;
|
|
206
|
-
/** Leaky ReLU */
|
|
207
|
-
leaky_relu: NullType;
|
|
208
|
-
}>>;
|
|
209
|
-
/** Output activation function (default none/linear) */
|
|
210
|
-
output_activation: OptionType<VariantType<{
|
|
211
|
-
/** No activation (linear output) - default */
|
|
212
|
-
none: NullType;
|
|
213
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
214
|
-
softmax: NullType;
|
|
215
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
216
|
-
sigmoid: NullType;
|
|
217
|
-
}>>;
|
|
218
|
-
/** Dropout rate (default 0.0) */
|
|
219
|
-
dropout: OptionType<FloatType>;
|
|
220
|
-
/** Output dimension (default 1) */
|
|
221
|
-
output_dim: OptionType<IntegerType>;
|
|
222
|
-
}>, StructType<{
|
|
223
|
-
/** Number of epochs (default 100) */
|
|
224
|
-
epochs: OptionType<IntegerType>;
|
|
225
|
-
/** Batch size (default 32) */
|
|
226
|
-
batch_size: OptionType<IntegerType>;
|
|
227
|
-
/** Learning rate (default 0.001) */
|
|
228
|
-
learning_rate: OptionType<FloatType>;
|
|
229
|
-
/** Loss function (default mse) */
|
|
230
|
-
loss: OptionType<VariantType<{
|
|
231
|
-
/** Mean Squared Error (regression) */
|
|
232
|
-
mse: NullType;
|
|
233
|
-
/** Mean Absolute Error (regression) */
|
|
234
|
-
mae: NullType;
|
|
235
|
-
/** Cross Entropy (classification) */
|
|
236
|
-
cross_entropy: NullType;
|
|
237
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
238
|
-
kl_div: NullType;
|
|
239
|
-
}>>;
|
|
240
|
-
/** Optimizer (default adam) */
|
|
241
|
-
optimizer: OptionType<VariantType<{
|
|
242
|
-
/** Adam optimizer */
|
|
243
|
-
adam: NullType;
|
|
244
|
-
/** Stochastic Gradient Descent */
|
|
245
|
-
sgd: NullType;
|
|
246
|
-
/** AdamW with weight decay */
|
|
247
|
-
adamw: NullType;
|
|
248
|
-
/** RMSprop optimizer */
|
|
249
|
-
rmsprop: NullType;
|
|
250
|
-
}>>;
|
|
251
|
-
/** Early stopping patience, 0 = disabled */
|
|
252
|
-
early_stopping: OptionType<IntegerType>;
|
|
253
|
-
/** Validation split fraction (default 0.2) */
|
|
254
|
-
validation_split: OptionType<FloatType>;
|
|
255
|
-
/** Random seed for reproducibility */
|
|
256
|
-
random_state: OptionType<IntegerType>;
|
|
257
|
-
}>], StructType<{
|
|
258
|
-
/** Trained model blob */
|
|
259
|
-
model: VariantType<{
|
|
260
|
-
torch_mlp: StructType<{
|
|
261
|
-
data: BlobType;
|
|
262
|
-
n_features: IntegerType;
|
|
263
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
264
|
-
output_dim: IntegerType;
|
|
265
|
-
}>;
|
|
266
|
-
}>;
|
|
267
|
-
/** Training result with losses */
|
|
268
|
-
result: StructType<{
|
|
269
|
-
/** Training loss per epoch */
|
|
270
|
-
train_losses: ArrayType<FloatType>;
|
|
271
|
-
/** Validation loss per epoch */
|
|
272
|
-
val_losses: ArrayType<FloatType>;
|
|
273
|
-
/** Best epoch (for early stopping) */
|
|
274
|
-
best_epoch: IntegerType;
|
|
275
|
-
}>;
|
|
276
|
-
}>>;
|
|
277
|
-
/**
|
|
278
|
-
* Make predictions with a trained PyTorch MLP.
|
|
279
|
-
*
|
|
280
|
-
* @param model - Trained MLP model blob
|
|
281
|
-
* @param X - Feature matrix
|
|
282
|
-
* @returns Predicted values
|
|
283
|
-
*/
|
|
284
|
-
export declare const torch_mlp_predict: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
285
|
-
/** PyTorch MLP model */
|
|
286
|
-
torch_mlp: StructType<{
|
|
287
|
-
/** Cloudpickle serialized model */
|
|
288
|
-
data: BlobType;
|
|
289
|
-
/** Number of input features */
|
|
290
|
-
n_features: IntegerType;
|
|
291
|
-
/** Hidden layer sizes */
|
|
292
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
293
|
-
/** Output dimension */
|
|
294
|
-
output_dim: IntegerType;
|
|
295
|
-
}>;
|
|
296
|
-
}>, ArrayType<ArrayType<FloatType>>], ArrayType<FloatType>>;
|
|
297
|
-
/**
|
|
298
|
-
* Train a PyTorch MLP model with multi-output support.
|
|
299
|
-
*
|
|
300
|
-
* Supports multi-output regression (predicting multiple values per sample)
|
|
301
|
-
* and autoencoders (where input equals target for reconstruction learning).
|
|
302
|
-
* Output dimension is inferred from y.shape[1] unless overridden in config.
|
|
303
|
-
*
|
|
304
|
-
* @param X - Feature matrix (n_samples x n_features)
|
|
305
|
-
* @param y - Target matrix (n_samples x n_outputs)
|
|
306
|
-
* @param mlp_config - MLP architecture configuration
|
|
307
|
-
* @param train_config - Training configuration
|
|
308
|
-
* @returns Model blob and training result
|
|
309
|
-
*/
|
|
310
|
-
export declare const torch_mlp_train_multi: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<ArrayType<FloatType>>, StructType<{
|
|
311
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
312
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
313
|
-
/** Activation function for hidden layers (default relu) */
|
|
314
|
-
activation: OptionType<VariantType<{
|
|
315
|
-
/** Rectified Linear Unit */
|
|
316
|
-
relu: NullType;
|
|
317
|
-
/** Hyperbolic tangent */
|
|
318
|
-
tanh: NullType;
|
|
319
|
-
/** Sigmoid function */
|
|
320
|
-
sigmoid: NullType;
|
|
321
|
-
/** Leaky ReLU */
|
|
322
|
-
leaky_relu: NullType;
|
|
323
|
-
}>>;
|
|
324
|
-
/** Output activation function (default none/linear) */
|
|
325
|
-
output_activation: OptionType<VariantType<{
|
|
326
|
-
/** No activation (linear output) - default */
|
|
327
|
-
none: NullType;
|
|
328
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
329
|
-
softmax: NullType;
|
|
330
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
331
|
-
sigmoid: NullType;
|
|
332
|
-
}>>;
|
|
333
|
-
/** Dropout rate (default 0.0) */
|
|
334
|
-
dropout: OptionType<FloatType>;
|
|
335
|
-
/** Output dimension (default 1) */
|
|
336
|
-
output_dim: OptionType<IntegerType>;
|
|
337
|
-
}>, StructType<{
|
|
338
|
-
/** Number of epochs (default 100) */
|
|
339
|
-
epochs: OptionType<IntegerType>;
|
|
340
|
-
/** Batch size (default 32) */
|
|
341
|
-
batch_size: OptionType<IntegerType>;
|
|
342
|
-
/** Learning rate (default 0.001) */
|
|
343
|
-
learning_rate: OptionType<FloatType>;
|
|
344
|
-
/** Loss function (default mse) */
|
|
345
|
-
loss: OptionType<VariantType<{
|
|
346
|
-
/** Mean Squared Error (regression) */
|
|
347
|
-
mse: NullType;
|
|
348
|
-
/** Mean Absolute Error (regression) */
|
|
349
|
-
mae: NullType;
|
|
350
|
-
/** Cross Entropy (classification) */
|
|
351
|
-
cross_entropy: NullType;
|
|
352
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
353
|
-
kl_div: NullType;
|
|
354
|
-
}>>;
|
|
355
|
-
/** Optimizer (default adam) */
|
|
356
|
-
optimizer: OptionType<VariantType<{
|
|
357
|
-
/** Adam optimizer */
|
|
358
|
-
adam: NullType;
|
|
359
|
-
/** Stochastic Gradient Descent */
|
|
360
|
-
sgd: NullType;
|
|
361
|
-
/** AdamW with weight decay */
|
|
362
|
-
adamw: NullType;
|
|
363
|
-
/** RMSprop optimizer */
|
|
364
|
-
rmsprop: NullType;
|
|
365
|
-
}>>;
|
|
366
|
-
/** Early stopping patience, 0 = disabled */
|
|
367
|
-
early_stopping: OptionType<IntegerType>;
|
|
368
|
-
/** Validation split fraction (default 0.2) */
|
|
369
|
-
validation_split: OptionType<FloatType>;
|
|
370
|
-
/** Random seed for reproducibility */
|
|
371
|
-
random_state: OptionType<IntegerType>;
|
|
372
|
-
}>], StructType<{
|
|
373
|
-
/** Trained model blob */
|
|
374
|
-
model: VariantType<{
|
|
375
|
-
torch_mlp: StructType<{
|
|
376
|
-
data: BlobType;
|
|
377
|
-
n_features: IntegerType;
|
|
378
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
379
|
-
output_dim: IntegerType;
|
|
380
|
-
}>;
|
|
381
|
-
}>;
|
|
382
|
-
/** Training result with losses */
|
|
383
|
-
result: StructType<{
|
|
384
|
-
/** Training loss per epoch */
|
|
385
|
-
train_losses: ArrayType<FloatType>;
|
|
386
|
-
/** Validation loss per epoch */
|
|
387
|
-
val_losses: ArrayType<FloatType>;
|
|
388
|
-
/** Best epoch (for early stopping) */
|
|
389
|
-
best_epoch: IntegerType;
|
|
390
|
-
}>;
|
|
391
|
-
}>>;
|
|
392
|
-
/**
|
|
393
|
-
* Make predictions with a trained PyTorch MLP (multi-output).
|
|
394
|
-
*
|
|
395
|
-
* Returns a matrix where each row contains the predicted outputs for a sample.
|
|
396
|
-
*
|
|
397
|
-
* @param model - Trained MLP model blob
|
|
398
|
-
* @param X - Feature matrix (n_samples x n_features)
|
|
399
|
-
* @returns Predicted matrix (n_samples x n_outputs)
|
|
400
|
-
*/
|
|
401
|
-
export declare const torch_mlp_predict_multi: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
402
|
-
/** PyTorch MLP model */
|
|
403
|
-
torch_mlp: StructType<{
|
|
404
|
-
/** Cloudpickle serialized model */
|
|
405
|
-
data: BlobType;
|
|
406
|
-
/** Number of input features */
|
|
407
|
-
n_features: IntegerType;
|
|
408
|
-
/** Hidden layer sizes */
|
|
409
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
410
|
-
/** Output dimension */
|
|
411
|
-
output_dim: IntegerType;
|
|
412
|
-
}>;
|
|
413
|
-
}>, ArrayType<ArrayType<FloatType>>], ArrayType<ArrayType<FloatType>>>;
|
|
414
|
-
/**
|
|
415
|
-
* Extract intermediate layer activations (embeddings) from a trained MLP.
|
|
416
|
-
*
|
|
417
|
-
* For autoencoders, this allows extracting the bottleneck representation.
|
|
418
|
-
* The layer_index specifies which hidden layer's output to return (0-indexed).
|
|
419
|
-
*
|
|
420
|
-
* For an autoencoder with architecture [input -> 8 -> 2 -> 8 -> output]
|
|
421
|
-
* (hidden_layers: [8, 2, 8]):
|
|
422
|
-
* - layer_index=0: output after first hidden layer (8 features)
|
|
423
|
-
* - layer_index=1: output after second hidden layer (2 features) <- bottleneck
|
|
424
|
-
* - layer_index=2: output after third hidden layer (8 features)
|
|
425
|
-
*
|
|
426
|
-
* @param model - Trained MLP model blob
|
|
427
|
-
* @param X - Feature matrix (n_samples x n_features)
|
|
428
|
-
* @param layer_index - Which hidden layer's output to return (0-indexed)
|
|
429
|
-
* @returns Embedding matrix (n_samples x hidden_dim at that layer)
|
|
430
|
-
*
|
|
431
|
-
* @example
|
|
432
|
-
* ```ts
|
|
433
|
-
* // Train autoencoder: 4 features -> 8 -> 2 (bottleneck) -> 8 -> 4 features
|
|
434
|
-
* const mlp_config = $.let({
|
|
435
|
-
* hidden_layers: [8n, 2n, 8n],
|
|
436
|
-
* activation: variant('some', variant('relu', {})),
|
|
437
|
-
* dropout: variant('none', null),
|
|
438
|
-
* output_dim: variant('none', null),
|
|
439
|
-
* });
|
|
440
|
-
* const output = $.let(Torch.mlpTrainMulti(X, X, mlp_config, train_config));
|
|
441
|
-
*
|
|
442
|
-
* // Extract bottleneck embeddings (layer_index=1 for the 2-dim bottleneck)
|
|
443
|
-
* const embeddings = $.let(Torch.mlpEncode(output.model, X, 1n));
|
|
444
|
-
* // embeddings is now (n_samples x 2)
|
|
445
|
-
* ```
|
|
446
|
-
*/
|
|
447
|
-
export declare const torch_mlp_encode: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
448
|
-
/** PyTorch MLP model */
|
|
449
|
-
torch_mlp: StructType<{
|
|
450
|
-
/** Cloudpickle serialized model */
|
|
451
|
-
data: BlobType;
|
|
452
|
-
/** Number of input features */
|
|
453
|
-
n_features: IntegerType;
|
|
454
|
-
/** Hidden layer sizes */
|
|
455
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
456
|
-
/** Output dimension */
|
|
457
|
-
output_dim: IntegerType;
|
|
458
|
-
}>;
|
|
459
|
-
}>, ArrayType<ArrayType<FloatType>>, IntegerType], ArrayType<ArrayType<FloatType>>>;
|
|
460
|
-
/**
|
|
461
|
-
* Decode embeddings back through the decoder portion of an MLP.
|
|
462
|
-
*
|
|
463
|
-
* For autoencoders, this takes bottleneck activations and runs them through
|
|
464
|
-
* the decoder to reconstruct the output. This is the complement to mlpEncode.
|
|
465
|
-
*
|
|
466
|
-
* For an autoencoder with architecture [input -> 8 -> 2 -> 8 -> output]
|
|
467
|
-
* (hidden_layers: [8, 2, 8]):
|
|
468
|
-
* - layer_index=1: Start from the 2-dim bottleneck, run through layers 2+ to output
|
|
469
|
-
* - layer_index=0: Start from the 8-dim first layer, run through layers 1+ to output
|
|
470
|
-
*
|
|
471
|
-
* Use case: Compute weighted average of origin embeddings, then decode to
|
|
472
|
-
* get the reconstructed blend weight distribution.
|
|
473
|
-
*
|
|
474
|
-
* @param model - Trained MLP model blob
|
|
475
|
-
* @param embeddings - Embedding matrix (n_samples x hidden_dim at layer_index)
|
|
476
|
-
* @param layer_index - Which hidden layer the embeddings come from (0-indexed)
|
|
477
|
-
* @returns Decoded output matrix (n_samples x output_dim)
|
|
478
|
-
*
|
|
479
|
-
* @example
|
|
480
|
-
* ```ts
|
|
481
|
-
* // After training autoencoder and extracting embeddings...
|
|
482
|
-
* const origin_embeddings = $.let(Torch.mlpEncode(output.model, X_onehot, 1n));
|
|
483
|
-
*
|
|
484
|
-
* // Compute weighted blend embedding (e.g., 50% origin A + 50% origin B)
|
|
485
|
-
* const blend_embedding = $.let(...); // weighted average of origin embeddings
|
|
486
|
-
*
|
|
487
|
-
* // Decode back to weight distribution
|
|
488
|
-
* const reconstructed = $.let(Torch.mlpDecode(output.model, blend_embedding, 1n));
|
|
489
|
-
* ```
|
|
490
|
-
*/
|
|
491
|
-
export declare const torch_mlp_decode: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
492
|
-
/** PyTorch MLP model */
|
|
493
|
-
torch_mlp: StructType<{
|
|
494
|
-
/** Cloudpickle serialized model */
|
|
495
|
-
data: BlobType;
|
|
496
|
-
/** Number of input features */
|
|
497
|
-
n_features: IntegerType;
|
|
498
|
-
/** Hidden layer sizes */
|
|
499
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
500
|
-
/** Output dimension */
|
|
501
|
-
output_dim: IntegerType;
|
|
502
|
-
}>;
|
|
503
|
-
}>, ArrayType<ArrayType<FloatType>>, IntegerType], ArrayType<ArrayType<FloatType>>>;
|
|
504
|
-
/**
|
|
505
|
-
* Type definitions for PyTorch functions.
|
|
506
|
-
*/
|
|
507
|
-
export declare const TorchTypes: {
|
|
508
|
-
/** Vector type (array of floats) */
|
|
509
|
-
readonly VectorType: ArrayType<FloatType>;
|
|
510
|
-
/** Matrix type (2D array of floats) */
|
|
511
|
-
readonly MatrixType: ArrayType<ArrayType<FloatType>>;
|
|
512
|
-
/** Activation function type for hidden layers */
|
|
513
|
-
readonly TorchActivationType: VariantType<{
|
|
514
|
-
/** Rectified Linear Unit */
|
|
515
|
-
relu: NullType;
|
|
516
|
-
/** Hyperbolic tangent */
|
|
517
|
-
tanh: NullType;
|
|
518
|
-
/** Sigmoid function */
|
|
519
|
-
sigmoid: NullType;
|
|
520
|
-
/** Leaky ReLU */
|
|
521
|
-
leaky_relu: NullType;
|
|
522
|
-
}>;
|
|
523
|
-
/** Output activation function type */
|
|
524
|
-
readonly TorchOutputActivationType: VariantType<{
|
|
525
|
-
/** No activation (linear output) - default */
|
|
526
|
-
none: NullType;
|
|
527
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
528
|
-
softmax: NullType;
|
|
529
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
530
|
-
sigmoid: NullType;
|
|
531
|
-
}>;
|
|
532
|
-
/** Loss function type */
|
|
533
|
-
readonly TorchLossType: VariantType<{
|
|
534
|
-
/** Mean Squared Error (regression) */
|
|
535
|
-
mse: NullType;
|
|
536
|
-
/** Mean Absolute Error (regression) */
|
|
537
|
-
mae: NullType;
|
|
538
|
-
/** Cross Entropy (classification) */
|
|
539
|
-
cross_entropy: NullType;
|
|
540
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
541
|
-
kl_div: NullType;
|
|
542
|
-
}>;
|
|
543
|
-
/** Optimizer type */
|
|
544
|
-
readonly TorchOptimizerType: VariantType<{
|
|
545
|
-
/** Adam optimizer */
|
|
546
|
-
adam: NullType;
|
|
547
|
-
/** Stochastic Gradient Descent */
|
|
548
|
-
sgd: NullType;
|
|
549
|
-
/** AdamW with weight decay */
|
|
550
|
-
adamw: NullType;
|
|
551
|
-
/** RMSprop optimizer */
|
|
552
|
-
rmsprop: NullType;
|
|
553
|
-
}>;
|
|
554
|
-
/** MLP configuration type */
|
|
555
|
-
readonly TorchMLPConfigType: StructType<{
|
|
556
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
557
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
558
|
-
/** Activation function for hidden layers (default relu) */
|
|
559
|
-
activation: OptionType<VariantType<{
|
|
560
|
-
/** Rectified Linear Unit */
|
|
561
|
-
relu: NullType;
|
|
562
|
-
/** Hyperbolic tangent */
|
|
563
|
-
tanh: NullType;
|
|
564
|
-
/** Sigmoid function */
|
|
565
|
-
sigmoid: NullType;
|
|
566
|
-
/** Leaky ReLU */
|
|
567
|
-
leaky_relu: NullType;
|
|
568
|
-
}>>;
|
|
569
|
-
/** Output activation function (default none/linear) */
|
|
570
|
-
output_activation: OptionType<VariantType<{
|
|
571
|
-
/** No activation (linear output) - default */
|
|
572
|
-
none: NullType;
|
|
573
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
574
|
-
softmax: NullType;
|
|
575
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
576
|
-
sigmoid: NullType;
|
|
577
|
-
}>>;
|
|
578
|
-
/** Dropout rate (default 0.0) */
|
|
579
|
-
dropout: OptionType<FloatType>;
|
|
580
|
-
/** Output dimension (default 1) */
|
|
581
|
-
output_dim: OptionType<IntegerType>;
|
|
582
|
-
}>;
|
|
583
|
-
/** Training configuration type */
|
|
584
|
-
readonly TorchTrainConfigType: StructType<{
|
|
585
|
-
/** Number of epochs (default 100) */
|
|
586
|
-
epochs: OptionType<IntegerType>;
|
|
587
|
-
/** Batch size (default 32) */
|
|
588
|
-
batch_size: OptionType<IntegerType>;
|
|
589
|
-
/** Learning rate (default 0.001) */
|
|
590
|
-
learning_rate: OptionType<FloatType>;
|
|
591
|
-
/** Loss function (default mse) */
|
|
592
|
-
loss: OptionType<VariantType<{
|
|
593
|
-
/** Mean Squared Error (regression) */
|
|
594
|
-
mse: NullType;
|
|
595
|
-
/** Mean Absolute Error (regression) */
|
|
596
|
-
mae: NullType;
|
|
597
|
-
/** Cross Entropy (classification) */
|
|
598
|
-
cross_entropy: NullType;
|
|
599
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
600
|
-
kl_div: NullType;
|
|
601
|
-
}>>;
|
|
602
|
-
/** Optimizer (default adam) */
|
|
603
|
-
optimizer: OptionType<VariantType<{
|
|
604
|
-
/** Adam optimizer */
|
|
605
|
-
adam: NullType;
|
|
606
|
-
/** Stochastic Gradient Descent */
|
|
607
|
-
sgd: NullType;
|
|
608
|
-
/** AdamW with weight decay */
|
|
609
|
-
adamw: NullType;
|
|
610
|
-
/** RMSprop optimizer */
|
|
611
|
-
rmsprop: NullType;
|
|
612
|
-
}>>;
|
|
613
|
-
/** Early stopping patience, 0 = disabled */
|
|
614
|
-
early_stopping: OptionType<IntegerType>;
|
|
615
|
-
/** Validation split fraction (default 0.2) */
|
|
616
|
-
validation_split: OptionType<FloatType>;
|
|
617
|
-
/** Random seed for reproducibility */
|
|
618
|
-
random_state: OptionType<IntegerType>;
|
|
619
|
-
}>;
|
|
620
|
-
/** Training result type */
|
|
621
|
-
readonly TorchTrainResultType: StructType<{
|
|
622
|
-
/** Training loss per epoch */
|
|
623
|
-
train_losses: ArrayType<FloatType>;
|
|
624
|
-
/** Validation loss per epoch */
|
|
625
|
-
val_losses: ArrayType<FloatType>;
|
|
626
|
-
/** Best epoch (for early stopping) */
|
|
627
|
-
best_epoch: IntegerType;
|
|
628
|
-
}>;
|
|
629
|
-
/** Training output type (model + result) */
|
|
630
|
-
readonly TorchTrainOutputType: StructType<{
|
|
631
|
-
/** Trained model blob */
|
|
632
|
-
model: VariantType<{
|
|
633
|
-
torch_mlp: StructType<{
|
|
634
|
-
data: BlobType;
|
|
635
|
-
n_features: IntegerType;
|
|
636
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
637
|
-
output_dim: IntegerType;
|
|
638
|
-
}>;
|
|
639
|
-
}>;
|
|
640
|
-
/** Training result with losses */
|
|
641
|
-
result: StructType<{
|
|
642
|
-
/** Training loss per epoch */
|
|
643
|
-
train_losses: ArrayType<FloatType>;
|
|
644
|
-
/** Validation loss per epoch */
|
|
645
|
-
val_losses: ArrayType<FloatType>;
|
|
646
|
-
/** Best epoch (for early stopping) */
|
|
647
|
-
best_epoch: IntegerType;
|
|
648
|
-
}>;
|
|
649
|
-
}>;
|
|
650
|
-
/** Model blob type for PyTorch models */
|
|
651
|
-
readonly ModelBlobType: VariantType<{
|
|
652
|
-
/** PyTorch MLP model */
|
|
653
|
-
torch_mlp: StructType<{
|
|
654
|
-
/** Cloudpickle serialized model */
|
|
655
|
-
data: BlobType;
|
|
656
|
-
/** Number of input features */
|
|
657
|
-
n_features: IntegerType;
|
|
658
|
-
/** Hidden layer sizes */
|
|
659
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
660
|
-
/** Output dimension */
|
|
661
|
-
output_dim: IntegerType;
|
|
662
|
-
}>;
|
|
663
|
-
}>;
|
|
664
|
-
};
|
|
665
|
-
/**
|
|
666
|
-
* PyTorch neural network models.
|
|
667
|
-
*
|
|
668
|
-
* Provides MLP training and inference using PyTorch.
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```ts
|
|
672
|
-
* import { East, variant } from "@elaraai/east";
|
|
673
|
-
* import { Torch } from "@elaraai/east-py-datascience";
|
|
674
|
-
*
|
|
675
|
-
* const train = East.function([], Torch.Types.TorchTrainOutputType, $ => {
|
|
676
|
-
* const X = $.let([[1.0, 2.0], [3.0, 4.0], [5.0, 6.0], [7.0, 8.0]]);
|
|
677
|
-
* const y = $.let([1.0, 2.0, 3.0, 4.0]);
|
|
678
|
-
* const mlp_config = $.let({
|
|
679
|
-
* hidden_layers: [32n, 16n],
|
|
680
|
-
* activation: variant('none', null),
|
|
681
|
-
* dropout: variant('none', null),
|
|
682
|
-
* output_dim: variant('none', null),
|
|
683
|
-
* });
|
|
684
|
-
* const train_config = $.let({
|
|
685
|
-
* epochs: variant('some', 50n),
|
|
686
|
-
* batch_size: variant('some', 4n),
|
|
687
|
-
* learning_rate: variant('some', 0.01),
|
|
688
|
-
* loss: variant('none', null),
|
|
689
|
-
* optimizer: variant('none', null),
|
|
690
|
-
* early_stopping: variant('none', null),
|
|
691
|
-
* validation_split: variant('some', 0.2),
|
|
692
|
-
* random_state: variant('some', 42n),
|
|
693
|
-
* });
|
|
694
|
-
* return $.return(Torch.mlpTrain(X, y, mlp_config, train_config));
|
|
695
|
-
* });
|
|
696
|
-
* ```
|
|
697
|
-
*/
|
|
698
|
-
export declare const Torch: {
|
|
699
|
-
/** Train MLP model (single output) */
|
|
700
|
-
readonly mlpTrain: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<FloatType>, StructType<{
|
|
701
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
702
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
703
|
-
/** Activation function for hidden layers (default relu) */
|
|
704
|
-
activation: OptionType<VariantType<{
|
|
705
|
-
/** Rectified Linear Unit */
|
|
706
|
-
relu: NullType;
|
|
707
|
-
/** Hyperbolic tangent */
|
|
708
|
-
tanh: NullType;
|
|
709
|
-
/** Sigmoid function */
|
|
710
|
-
sigmoid: NullType;
|
|
711
|
-
/** Leaky ReLU */
|
|
712
|
-
leaky_relu: NullType;
|
|
713
|
-
}>>;
|
|
714
|
-
/** Output activation function (default none/linear) */
|
|
715
|
-
output_activation: OptionType<VariantType<{
|
|
716
|
-
/** No activation (linear output) - default */
|
|
717
|
-
none: NullType;
|
|
718
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
719
|
-
softmax: NullType;
|
|
720
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
721
|
-
sigmoid: NullType;
|
|
722
|
-
}>>;
|
|
723
|
-
/** Dropout rate (default 0.0) */
|
|
724
|
-
dropout: OptionType<FloatType>;
|
|
725
|
-
/** Output dimension (default 1) */
|
|
726
|
-
output_dim: OptionType<IntegerType>;
|
|
727
|
-
}>, StructType<{
|
|
728
|
-
/** Number of epochs (default 100) */
|
|
729
|
-
epochs: OptionType<IntegerType>;
|
|
730
|
-
/** Batch size (default 32) */
|
|
731
|
-
batch_size: OptionType<IntegerType>;
|
|
732
|
-
/** Learning rate (default 0.001) */
|
|
733
|
-
learning_rate: OptionType<FloatType>;
|
|
734
|
-
/** Loss function (default mse) */
|
|
735
|
-
loss: OptionType<VariantType<{
|
|
736
|
-
/** Mean Squared Error (regression) */
|
|
737
|
-
mse: NullType;
|
|
738
|
-
/** Mean Absolute Error (regression) */
|
|
739
|
-
mae: NullType;
|
|
740
|
-
/** Cross Entropy (classification) */
|
|
741
|
-
cross_entropy: NullType;
|
|
742
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
743
|
-
kl_div: NullType;
|
|
744
|
-
}>>;
|
|
745
|
-
/** Optimizer (default adam) */
|
|
746
|
-
optimizer: OptionType<VariantType<{
|
|
747
|
-
/** Adam optimizer */
|
|
748
|
-
adam: NullType;
|
|
749
|
-
/** Stochastic Gradient Descent */
|
|
750
|
-
sgd: NullType;
|
|
751
|
-
/** AdamW with weight decay */
|
|
752
|
-
adamw: NullType;
|
|
753
|
-
/** RMSprop optimizer */
|
|
754
|
-
rmsprop: NullType;
|
|
755
|
-
}>>;
|
|
756
|
-
/** Early stopping patience, 0 = disabled */
|
|
757
|
-
early_stopping: OptionType<IntegerType>;
|
|
758
|
-
/** Validation split fraction (default 0.2) */
|
|
759
|
-
validation_split: OptionType<FloatType>;
|
|
760
|
-
/** Random seed for reproducibility */
|
|
761
|
-
random_state: OptionType<IntegerType>;
|
|
762
|
-
}>], StructType<{
|
|
763
|
-
/** Trained model blob */
|
|
764
|
-
model: VariantType<{
|
|
765
|
-
torch_mlp: StructType<{
|
|
766
|
-
data: BlobType;
|
|
767
|
-
n_features: IntegerType;
|
|
768
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
769
|
-
output_dim: IntegerType;
|
|
770
|
-
}>;
|
|
771
|
-
}>;
|
|
772
|
-
/** Training result with losses */
|
|
773
|
-
result: StructType<{
|
|
774
|
-
/** Training loss per epoch */
|
|
775
|
-
train_losses: ArrayType<FloatType>;
|
|
776
|
-
/** Validation loss per epoch */
|
|
777
|
-
val_losses: ArrayType<FloatType>;
|
|
778
|
-
/** Best epoch (for early stopping) */
|
|
779
|
-
best_epoch: IntegerType;
|
|
780
|
-
}>;
|
|
781
|
-
}>>;
|
|
782
|
-
/** Make predictions with MLP (single output) */
|
|
783
|
-
readonly mlpPredict: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
784
|
-
/** PyTorch MLP model */
|
|
785
|
-
torch_mlp: StructType<{
|
|
786
|
-
/** Cloudpickle serialized model */
|
|
787
|
-
data: BlobType;
|
|
788
|
-
/** Number of input features */
|
|
789
|
-
n_features: IntegerType;
|
|
790
|
-
/** Hidden layer sizes */
|
|
791
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
792
|
-
/** Output dimension */
|
|
793
|
-
output_dim: IntegerType;
|
|
794
|
-
}>;
|
|
795
|
-
}>, ArrayType<ArrayType<FloatType>>], ArrayType<FloatType>>;
|
|
796
|
-
/** Train MLP model (multi-output) */
|
|
797
|
-
readonly mlpTrainMulti: import("@elaraai/east").PlatformDefinition<[ArrayType<ArrayType<FloatType>>, ArrayType<ArrayType<FloatType>>, StructType<{
|
|
798
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
799
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
800
|
-
/** Activation function for hidden layers (default relu) */
|
|
801
|
-
activation: OptionType<VariantType<{
|
|
802
|
-
/** Rectified Linear Unit */
|
|
803
|
-
relu: NullType;
|
|
804
|
-
/** Hyperbolic tangent */
|
|
805
|
-
tanh: NullType;
|
|
806
|
-
/** Sigmoid function */
|
|
807
|
-
sigmoid: NullType;
|
|
808
|
-
/** Leaky ReLU */
|
|
809
|
-
leaky_relu: NullType;
|
|
810
|
-
}>>;
|
|
811
|
-
/** Output activation function (default none/linear) */
|
|
812
|
-
output_activation: OptionType<VariantType<{
|
|
813
|
-
/** No activation (linear output) - default */
|
|
814
|
-
none: NullType;
|
|
815
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
816
|
-
softmax: NullType;
|
|
817
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
818
|
-
sigmoid: NullType;
|
|
819
|
-
}>>;
|
|
820
|
-
/** Dropout rate (default 0.0) */
|
|
821
|
-
dropout: OptionType<FloatType>;
|
|
822
|
-
/** Output dimension (default 1) */
|
|
823
|
-
output_dim: OptionType<IntegerType>;
|
|
824
|
-
}>, StructType<{
|
|
825
|
-
/** Number of epochs (default 100) */
|
|
826
|
-
epochs: OptionType<IntegerType>;
|
|
827
|
-
/** Batch size (default 32) */
|
|
828
|
-
batch_size: OptionType<IntegerType>;
|
|
829
|
-
/** Learning rate (default 0.001) */
|
|
830
|
-
learning_rate: OptionType<FloatType>;
|
|
831
|
-
/** Loss function (default mse) */
|
|
832
|
-
loss: OptionType<VariantType<{
|
|
833
|
-
/** Mean Squared Error (regression) */
|
|
834
|
-
mse: NullType;
|
|
835
|
-
/** Mean Absolute Error (regression) */
|
|
836
|
-
mae: NullType;
|
|
837
|
-
/** Cross Entropy (classification) */
|
|
838
|
-
cross_entropy: NullType;
|
|
839
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
840
|
-
kl_div: NullType;
|
|
841
|
-
}>>;
|
|
842
|
-
/** Optimizer (default adam) */
|
|
843
|
-
optimizer: OptionType<VariantType<{
|
|
844
|
-
/** Adam optimizer */
|
|
845
|
-
adam: NullType;
|
|
846
|
-
/** Stochastic Gradient Descent */
|
|
847
|
-
sgd: NullType;
|
|
848
|
-
/** AdamW with weight decay */
|
|
849
|
-
adamw: NullType;
|
|
850
|
-
/** RMSprop optimizer */
|
|
851
|
-
rmsprop: NullType;
|
|
852
|
-
}>>;
|
|
853
|
-
/** Early stopping patience, 0 = disabled */
|
|
854
|
-
early_stopping: OptionType<IntegerType>;
|
|
855
|
-
/** Validation split fraction (default 0.2) */
|
|
856
|
-
validation_split: OptionType<FloatType>;
|
|
857
|
-
/** Random seed for reproducibility */
|
|
858
|
-
random_state: OptionType<IntegerType>;
|
|
859
|
-
}>], StructType<{
|
|
860
|
-
/** Trained model blob */
|
|
861
|
-
model: VariantType<{
|
|
862
|
-
torch_mlp: StructType<{
|
|
863
|
-
data: BlobType;
|
|
864
|
-
n_features: IntegerType;
|
|
865
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
866
|
-
output_dim: IntegerType;
|
|
867
|
-
}>;
|
|
868
|
-
}>;
|
|
869
|
-
/** Training result with losses */
|
|
870
|
-
result: StructType<{
|
|
871
|
-
/** Training loss per epoch */
|
|
872
|
-
train_losses: ArrayType<FloatType>;
|
|
873
|
-
/** Validation loss per epoch */
|
|
874
|
-
val_losses: ArrayType<FloatType>;
|
|
875
|
-
/** Best epoch (for early stopping) */
|
|
876
|
-
best_epoch: IntegerType;
|
|
877
|
-
}>;
|
|
878
|
-
}>>;
|
|
879
|
-
/** Make predictions with MLP (multi-output) */
|
|
880
|
-
readonly mlpPredictMulti: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
881
|
-
/** PyTorch MLP model */
|
|
882
|
-
torch_mlp: StructType<{
|
|
883
|
-
/** Cloudpickle serialized model */
|
|
884
|
-
data: BlobType;
|
|
885
|
-
/** Number of input features */
|
|
886
|
-
n_features: IntegerType;
|
|
887
|
-
/** Hidden layer sizes */
|
|
888
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
889
|
-
/** Output dimension */
|
|
890
|
-
output_dim: IntegerType;
|
|
891
|
-
}>;
|
|
892
|
-
}>, ArrayType<ArrayType<FloatType>>], ArrayType<ArrayType<FloatType>>>;
|
|
893
|
-
/** Extract intermediate layer activations (embeddings) from MLP */
|
|
894
|
-
readonly mlpEncode: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
895
|
-
/** PyTorch MLP model */
|
|
896
|
-
torch_mlp: StructType<{
|
|
897
|
-
/** Cloudpickle serialized model */
|
|
898
|
-
data: BlobType;
|
|
899
|
-
/** Number of input features */
|
|
900
|
-
n_features: IntegerType;
|
|
901
|
-
/** Hidden layer sizes */
|
|
902
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
903
|
-
/** Output dimension */
|
|
904
|
-
output_dim: IntegerType;
|
|
905
|
-
}>;
|
|
906
|
-
}>, ArrayType<ArrayType<FloatType>>, IntegerType], ArrayType<ArrayType<FloatType>>>;
|
|
907
|
-
/** Decode embeddings back through decoder portion of MLP */
|
|
908
|
-
readonly mlpDecode: import("@elaraai/east").PlatformDefinition<[VariantType<{
|
|
909
|
-
/** PyTorch MLP model */
|
|
910
|
-
torch_mlp: StructType<{
|
|
911
|
-
/** Cloudpickle serialized model */
|
|
912
|
-
data: BlobType;
|
|
913
|
-
/** Number of input features */
|
|
914
|
-
n_features: IntegerType;
|
|
915
|
-
/** Hidden layer sizes */
|
|
916
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
917
|
-
/** Output dimension */
|
|
918
|
-
output_dim: IntegerType;
|
|
919
|
-
}>;
|
|
920
|
-
}>, ArrayType<ArrayType<FloatType>>, IntegerType], ArrayType<ArrayType<FloatType>>>;
|
|
921
|
-
/** Type definitions */
|
|
922
|
-
readonly Types: {
|
|
923
|
-
/** Vector type (array of floats) */
|
|
924
|
-
readonly VectorType: ArrayType<FloatType>;
|
|
925
|
-
/** Matrix type (2D array of floats) */
|
|
926
|
-
readonly MatrixType: ArrayType<ArrayType<FloatType>>;
|
|
927
|
-
/** Activation function type for hidden layers */
|
|
928
|
-
readonly TorchActivationType: VariantType<{
|
|
929
|
-
/** Rectified Linear Unit */
|
|
930
|
-
relu: NullType;
|
|
931
|
-
/** Hyperbolic tangent */
|
|
932
|
-
tanh: NullType;
|
|
933
|
-
/** Sigmoid function */
|
|
934
|
-
sigmoid: NullType;
|
|
935
|
-
/** Leaky ReLU */
|
|
936
|
-
leaky_relu: NullType;
|
|
937
|
-
}>;
|
|
938
|
-
/** Output activation function type */
|
|
939
|
-
readonly TorchOutputActivationType: VariantType<{
|
|
940
|
-
/** No activation (linear output) - default */
|
|
941
|
-
none: NullType;
|
|
942
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
943
|
-
softmax: NullType;
|
|
944
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
945
|
-
sigmoid: NullType;
|
|
946
|
-
}>;
|
|
947
|
-
/** Loss function type */
|
|
948
|
-
readonly TorchLossType: VariantType<{
|
|
949
|
-
/** Mean Squared Error (regression) */
|
|
950
|
-
mse: NullType;
|
|
951
|
-
/** Mean Absolute Error (regression) */
|
|
952
|
-
mae: NullType;
|
|
953
|
-
/** Cross Entropy (classification) */
|
|
954
|
-
cross_entropy: NullType;
|
|
955
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
956
|
-
kl_div: NullType;
|
|
957
|
-
}>;
|
|
958
|
-
/** Optimizer type */
|
|
959
|
-
readonly TorchOptimizerType: VariantType<{
|
|
960
|
-
/** Adam optimizer */
|
|
961
|
-
adam: NullType;
|
|
962
|
-
/** Stochastic Gradient Descent */
|
|
963
|
-
sgd: NullType;
|
|
964
|
-
/** AdamW with weight decay */
|
|
965
|
-
adamw: NullType;
|
|
966
|
-
/** RMSprop optimizer */
|
|
967
|
-
rmsprop: NullType;
|
|
968
|
-
}>;
|
|
969
|
-
/** MLP configuration type */
|
|
970
|
-
readonly TorchMLPConfigType: StructType<{
|
|
971
|
-
/** Hidden layer sizes, e.g., [64, 32] */
|
|
972
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
973
|
-
/** Activation function for hidden layers (default relu) */
|
|
974
|
-
activation: OptionType<VariantType<{
|
|
975
|
-
/** Rectified Linear Unit */
|
|
976
|
-
relu: NullType;
|
|
977
|
-
/** Hyperbolic tangent */
|
|
978
|
-
tanh: NullType;
|
|
979
|
-
/** Sigmoid function */
|
|
980
|
-
sigmoid: NullType;
|
|
981
|
-
/** Leaky ReLU */
|
|
982
|
-
leaky_relu: NullType;
|
|
983
|
-
}>>;
|
|
984
|
-
/** Output activation function (default none/linear) */
|
|
985
|
-
output_activation: OptionType<VariantType<{
|
|
986
|
-
/** No activation (linear output) - default */
|
|
987
|
-
none: NullType;
|
|
988
|
-
/** Softmax (outputs sum to 1, for probability distributions) */
|
|
989
|
-
softmax: NullType;
|
|
990
|
-
/** Sigmoid (each output independently in [0,1]) */
|
|
991
|
-
sigmoid: NullType;
|
|
992
|
-
}>>;
|
|
993
|
-
/** Dropout rate (default 0.0) */
|
|
994
|
-
dropout: OptionType<FloatType>;
|
|
995
|
-
/** Output dimension (default 1) */
|
|
996
|
-
output_dim: OptionType<IntegerType>;
|
|
997
|
-
}>;
|
|
998
|
-
/** Training configuration type */
|
|
999
|
-
readonly TorchTrainConfigType: StructType<{
|
|
1000
|
-
/** Number of epochs (default 100) */
|
|
1001
|
-
epochs: OptionType<IntegerType>;
|
|
1002
|
-
/** Batch size (default 32) */
|
|
1003
|
-
batch_size: OptionType<IntegerType>;
|
|
1004
|
-
/** Learning rate (default 0.001) */
|
|
1005
|
-
learning_rate: OptionType<FloatType>;
|
|
1006
|
-
/** Loss function (default mse) */
|
|
1007
|
-
loss: OptionType<VariantType<{
|
|
1008
|
-
/** Mean Squared Error (regression) */
|
|
1009
|
-
mse: NullType;
|
|
1010
|
-
/** Mean Absolute Error (regression) */
|
|
1011
|
-
mae: NullType;
|
|
1012
|
-
/** Cross Entropy (classification) */
|
|
1013
|
-
cross_entropy: NullType;
|
|
1014
|
-
/** KL Divergence (distribution matching, use with softmax output) */
|
|
1015
|
-
kl_div: NullType;
|
|
1016
|
-
}>>;
|
|
1017
|
-
/** Optimizer (default adam) */
|
|
1018
|
-
optimizer: OptionType<VariantType<{
|
|
1019
|
-
/** Adam optimizer */
|
|
1020
|
-
adam: NullType;
|
|
1021
|
-
/** Stochastic Gradient Descent */
|
|
1022
|
-
sgd: NullType;
|
|
1023
|
-
/** AdamW with weight decay */
|
|
1024
|
-
adamw: NullType;
|
|
1025
|
-
/** RMSprop optimizer */
|
|
1026
|
-
rmsprop: NullType;
|
|
1027
|
-
}>>;
|
|
1028
|
-
/** Early stopping patience, 0 = disabled */
|
|
1029
|
-
early_stopping: OptionType<IntegerType>;
|
|
1030
|
-
/** Validation split fraction (default 0.2) */
|
|
1031
|
-
validation_split: OptionType<FloatType>;
|
|
1032
|
-
/** Random seed for reproducibility */
|
|
1033
|
-
random_state: OptionType<IntegerType>;
|
|
1034
|
-
}>;
|
|
1035
|
-
/** Training result type */
|
|
1036
|
-
readonly TorchTrainResultType: StructType<{
|
|
1037
|
-
/** Training loss per epoch */
|
|
1038
|
-
train_losses: ArrayType<FloatType>;
|
|
1039
|
-
/** Validation loss per epoch */
|
|
1040
|
-
val_losses: ArrayType<FloatType>;
|
|
1041
|
-
/** Best epoch (for early stopping) */
|
|
1042
|
-
best_epoch: IntegerType;
|
|
1043
|
-
}>;
|
|
1044
|
-
/** Training output type (model + result) */
|
|
1045
|
-
readonly TorchTrainOutputType: StructType<{
|
|
1046
|
-
/** Trained model blob */
|
|
1047
|
-
model: VariantType<{
|
|
1048
|
-
torch_mlp: StructType<{
|
|
1049
|
-
data: BlobType;
|
|
1050
|
-
n_features: IntegerType;
|
|
1051
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
1052
|
-
output_dim: IntegerType;
|
|
1053
|
-
}>;
|
|
1054
|
-
}>;
|
|
1055
|
-
/** Training result with losses */
|
|
1056
|
-
result: StructType<{
|
|
1057
|
-
/** Training loss per epoch */
|
|
1058
|
-
train_losses: ArrayType<FloatType>;
|
|
1059
|
-
/** Validation loss per epoch */
|
|
1060
|
-
val_losses: ArrayType<FloatType>;
|
|
1061
|
-
/** Best epoch (for early stopping) */
|
|
1062
|
-
best_epoch: IntegerType;
|
|
1063
|
-
}>;
|
|
1064
|
-
}>;
|
|
1065
|
-
/** Model blob type for PyTorch models */
|
|
1066
|
-
readonly ModelBlobType: VariantType<{
|
|
1067
|
-
/** PyTorch MLP model */
|
|
1068
|
-
torch_mlp: StructType<{
|
|
1069
|
-
/** Cloudpickle serialized model */
|
|
1070
|
-
data: BlobType;
|
|
1071
|
-
/** Number of input features */
|
|
1072
|
-
n_features: IntegerType;
|
|
1073
|
-
/** Hidden layer sizes */
|
|
1074
|
-
hidden_layers: ArrayType<IntegerType>;
|
|
1075
|
-
/** Output dimension */
|
|
1076
|
-
output_dim: IntegerType;
|
|
1077
|
-
}>;
|
|
1078
|
-
}>;
|
|
1079
|
-
};
|
|
1080
|
-
};
|
|
1081
|
-
//# sourceMappingURL=torch.d.ts.map
|