@datagrok/eda 1.4.10 → 1.4.12

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/src/package.ts CHANGED
@@ -36,23 +36,25 @@ import {SoftmaxClassifier} from './softmax-classifier';
36
36
 
37
37
  import {initXgboost} from '../wasm/xgbooster';
38
38
  import {XGBooster} from './xgbooster';
39
+ import {ParetoOptimizer} from './pareto-optimization/pareto-optimizer';
40
+ import {ParetoFrontViewer} from './pareto-optimization/pareto-front-viewer';
41
+ import {Pmpo} from './probabilistic-scoring/prob-scoring';
42
+ import {loadPmpoParams} from './probabilistic-scoring/pmpo-utils';
39
43
 
40
44
  export const _package = new DG.Package();
41
45
  export * from './package.g';
42
46
 
43
47
  export class PackageFunctions {
44
48
  @grok.decorators.func({
45
- 'name': 'info'
49
+ 'name': 'info',
46
50
  })
47
51
  static info() {
48
-
49
52
  grok.shell.info(_package.webRoot);
50
53
  }
51
54
 
52
55
 
53
56
  @grok.decorators.init({})
54
57
  static async init(): Promise<void> {
55
-
56
58
  await _initEDAAPI();
57
59
  await initXgboost();
58
60
  }
@@ -61,15 +63,14 @@ export class PackageFunctions {
61
63
  @grok.decorators.func({
62
64
  'top-menu': 'ML | Cluster | DBSCAN...',
63
65
  'name': 'DBSCAN',
64
- 'description': 'Density-based spatial clustering of applications with noise (DBSCAN)'
66
+ 'description': 'Density-based spatial clustering of applications with noise (DBSCAN)',
65
67
  })
66
68
  static async dbScan(
67
69
  df: DG.DataFrame,
68
- @grok.decorators.param({type: 'column', 'options':{'type':'numerical'}}) xCol: DG.Column,
69
- @grok.decorators.param({type: 'column', 'options':{'type':'numerical'}}) yCol: DG.Column,
70
- @grok.decorators.param({'options':{'caption':'Epsilon','initialValue':'0.02', description: 'The maximum distance between two samples for them to be considered as in the same neighborhood.'}}) epsilon: number,
71
- @grok.decorators.param({'type':'int','options':{'caption':'Minimum points','initialValue':'4', description: 'The number of samples (or total weight) in a neighborhood for a point to be considered as a core point.'}}) minPts: number) : Promise<DG.Column> {
72
-
70
+ @grok.decorators.param({'type': 'column', 'options': {'type': 'numerical'}}) xCol: DG.Column,
71
+ @grok.decorators.param({'type': 'column', 'options': {'type': 'numerical'}}) yCol: DG.Column,
72
+ @grok.decorators.param({'options': {'caption': 'Epsilon', 'initialValue': '0.02', 'description': 'The maximum distance between two samples for them to be considered as in the same neighborhood.'}}) epsilon: number,
73
+ @grok.decorators.param({'type': 'int', 'options': {'caption': 'Minimum points', 'initialValue': '4', 'description': 'The number of samples (or total weight) in a neighborhood for a point to be considered as a core point.'}}) minPts: number) : Promise<DG.Column> {
73
74
  const x = xCol.getRawData() as Float32Array;
74
75
  const y = yCol.getRawData() as Float32Array;
75
76
  const res = await getDbscanWorker(x, y, epsilon, minPts);
@@ -82,16 +83,15 @@ export class PackageFunctions {
82
83
  @grok.decorators.func({
83
84
  'top-menu': 'ML | Analyze | PCA...',
84
85
  'description': 'Principal component analysis (PCA)',
85
- helpUrl: '/help/explore/dim-reduction#pca',
86
+ 'helpUrl': '/help/explore/dim-reduction#pca',
86
87
  })
87
88
  static async PCA(
88
- @grok.decorators.param({'type':'dataframe','options':{'caption':'Table'}}) table: DG.DataFrame,
89
- @grok.decorators.param({'type':'column_list','options':{'type':'numerical', 'nullable': false}}) features: DG.ColumnList,
89
+ @grok.decorators.param({'type': 'dataframe', 'options': {'caption': 'Table'}}) table: DG.DataFrame,
90
+ @grok.decorators.param({'type': 'column_list', 'options': {'type': 'numerical', 'nullable': false}}) features: DG.ColumnList,
90
91
  //@ts-ignore
91
- @grok.decorators.param({'type':'int','options':{'showPlusMinus': true, 'caption':'Components', 'nullable':false, 'min':'1', 'initialValue':'2', description: 'Number of components.'}}) components: number,
92
- @grok.decorators.param({'type':'bool', 'options':{'caption':'Center', 'initialValue':'false', description: 'Indicating whether the variables should be shifted to be zero centered.'}}) center: boolean,
93
- @grok.decorators.param({'type':'bool','options':{'caption':'Scale', 'initialValue':'false', description: 'Indicating whether the variables should be scaled to have unit variance.'}}) scale: boolean): Promise<void> {
94
-
92
+ @grok.decorators.param({'type': 'int', 'options': {'showPlusMinus': true, 'caption': 'Components', 'nullable': false, 'min': '1', 'initialValue': '2', 'description': 'Number of components.'}}) components: number,
93
+ @grok.decorators.param({'type': 'bool', 'options': {'caption': 'Center', 'initialValue': 'false', 'description': 'Indicating whether the variables should be shifted to be zero centered.'}}) center: boolean,
94
+ @grok.decorators.param({'type': 'bool', 'options': {'caption': 'Scale', 'initialValue': 'false', 'description': 'Indicating whether the variables should be scaled to have unit variance.'}}) scale: boolean): Promise<void> {
95
95
  try {
96
96
  const pcaTable = await computePCA(table, features, components, center, scale);
97
97
  addPrefixToEachColumnName('PC', pcaTable.columns);
@@ -115,20 +115,14 @@ export class PackageFunctions {
115
115
 
116
116
 
117
117
  @grok.decorators.func({
118
- 'meta': {
119
- 'defaultPostProcessingFunction': 'true'
120
- },
121
- 'tags': [
122
- 'dim-red-postprocessing-function'
123
- ],
124
- 'name': 'DBSCAN clustering'
118
+ 'meta': {'defaultPostProcessingFunction': 'true', role: 'dimRedPostprocessingFunction'},
119
+ 'name': 'DBSCAN clustering',
125
120
  })
126
121
  static async dbscanPostProcessingFunction(
127
122
  col1: DG.Column,
128
123
  col2: DG.Column,
129
- @grok.decorators.param({options: {initialValue: '0.01', description: 'Minimum distance between two points to be considered as in the same neighborhood.'}}) epsilon: number,
130
- @grok.decorators.param({type: 'int', options: {initialValue: '5', description: 'Minimum number of points to form a dense region.'}}) minimumPoints: number) {
131
-
124
+ @grok.decorators.param({options: {initialValue: '0.01', description: 'Minimum distance between two points to be considered as in the same neighborhood.'}}) epsilon: number,
125
+ @grok.decorators.param({type: 'int', options: {initialValue: '5', description: 'Minimum number of points to form a dense region.'}}) minimumPoints: number) {
132
126
  const df = col1.dataFrame;
133
127
  if (df === null)
134
128
  return;
@@ -150,16 +144,15 @@ export class PackageFunctions {
150
144
  @grok.decorators.func({
151
145
  'meta': {
152
146
  'supportedTypes': 'int,float,double,qnum',
153
- 'supportedDistanceFunctions': 'Difference'
147
+ 'supportedDistanceFunctions': 'Difference',
148
+ 'role': 'dimRedPreprocessingFunction'
154
149
  },
155
- 'tags': ['dim-red-preprocessing-function'],
156
150
  'name': 'None (number)',
157
- 'outputs': [{name: 'result', type:'object'}]
151
+ 'outputs': [{name: 'result', type: 'object'}],
158
152
  })
159
153
  static numberPreprocessingFunction(
160
154
  col: DG.Column,
161
- @grok.decorators.param({'options':{'optional':true}}) _metric: string) {
162
-
155
+ @grok.decorators.param({'options': {'optional': true}}) _metric: string) {
163
156
  const range = col.stats.max - col.stats.min;
164
157
  const entries = col.toList();
165
158
  return {entries, options: {range}};
@@ -169,16 +162,15 @@ export class PackageFunctions {
169
162
  @grok.decorators.func({
170
163
  'meta': {
171
164
  'supportedTypes': 'string',
172
- 'supportedDistanceFunctions': 'One-Hot,Levenshtein,Hamming'
165
+ 'supportedDistanceFunctions': 'One-Hot,Levenshtein,Hamming',
166
+ 'role': 'dimRedPreprocessingFunction'
173
167
  },
174
- 'tags': ['dim-red-preprocessing-function'],
175
168
  'name': 'None (string)',
176
- 'outputs': [{name: 'result', type:'object'}]
169
+ 'outputs': [{name: 'result', type: 'object'}],
177
170
  })
178
171
  static stringPreprocessingFunction(
179
172
  col: DG.Column,
180
- @grok.decorators.param({'options':{'optional':true}}) _metric: string) {
181
-
173
+ @grok.decorators.param({'options': {'optional': true}}) _metric: string) {
182
174
  const entries = col.toList();
183
175
  return {entries, options: {}};
184
176
  }
@@ -186,10 +178,9 @@ export class PackageFunctions {
186
178
 
187
179
  @grok.decorators.func({
188
180
  'top-menu': 'ML | Reduce Dimensionality...',
189
- 'name': 'Multi Column Dimensionality Reduction'
181
+ 'name': 'Multi Column Dimensionality Reduction',
190
182
  })
191
183
  static async reduceDimensionality(): Promise<void> {
192
-
193
184
  const editor = new MultiColumnDimReductionEditor();
194
185
  const dialog = ui.dialog('Reduce Dimensionality')
195
186
  .add(editor.getEditor())
@@ -230,8 +221,7 @@ export class PackageFunctions {
230
221
 
231
222
  @grok.decorators.editor()
232
223
  static GetMCLEditor(
233
- call: DG.FuncCall): void {
234
-
224
+ call: DG.FuncCall): void {
235
225
  try {
236
226
  const funcEditor = new MCLEditor();
237
227
  const dialog = ui.dialog('Markov clustering')
@@ -255,7 +245,6 @@ export class PackageFunctions {
255
245
  }
256
246
 
257
247
 
258
-
259
248
  @grok.decorators.func({
260
249
  'top-menu': 'ML | Cluster | MCL...',
261
250
  'name': 'MCLClustering',
@@ -266,16 +255,16 @@ export class PackageFunctions {
266
255
  static async MCLClustering(
267
256
  df: DG.DataFrame,
268
257
  cols: DG.Column[],
269
- @grok.decorators.param({'type':'list<string>'}) metrics: KnownMetrics[],
258
+ @grok.decorators.param({'type': 'list<string>'}) metrics: KnownMetrics[],
270
259
  weights: number[],
271
- @grok.decorators.param({'type':'string'}) aggregationMethod: DistanceAggregationMethod,
272
- @grok.decorators.param({'type':'list<func>'}) preprocessingFuncs: any[],
273
- @grok.decorators.param({'type':'object'}) preprocessingFuncArgs: any[],
274
- @grok.decorators.param({'type':'int','options':{'initialValue':'80'}}) threshold: number = 80,
275
- @grok.decorators.param({'type':'int','options':{'initialValue':'10'}}) maxIterations: number = 10,
276
- @grok.decorators.param({'type':'bool','options':{'initialValue':'false'}}) useWebGPU: boolean = false,
277
- @grok.decorators.param({'type':'double','options':{'initialValue':'2'}}) inflate: number = 0,
278
- @grok.decorators.param({'type':'int','options':{'initialValue':'5'}}) minClusterSize: number = 5): Promise<MCLViewer> {
260
+ @grok.decorators.param({'type': 'string'}) aggregationMethod: DistanceAggregationMethod,
261
+ @grok.decorators.param({'type': 'list<func>'}) preprocessingFuncs: any[],
262
+ @grok.decorators.param({'type': 'object'}) preprocessingFuncArgs: any[],
263
+ @grok.decorators.param({'type': 'int', 'options': {'initialValue': '80'}}) threshold: number = 80,
264
+ @grok.decorators.param({'type': 'int', 'options': {'initialValue': '10'}}) maxIterations: number = 10,
265
+ @grok.decorators.param({'type': 'bool', 'options': {'initialValue': 'false'}}) useWebGPU: boolean = false,
266
+ @grok.decorators.param({'type': 'double', 'options': {'initialValue': '2'}}) inflate: number = 0,
267
+ @grok.decorators.param({'type': 'int', 'options': {'initialValue': '5'}}) minClusterSize: number = 5): Promise<MCLViewer> {
279
268
  const tv = grok.shell.tableView(df.name) ?? grok.shell.addTableView(df);
280
269
  const serializedOptions: string = JSON.stringify({
281
270
  cols: cols.map((col) => col.name),
@@ -296,13 +285,10 @@ export class PackageFunctions {
296
285
  }
297
286
 
298
287
  @grok.decorators.func({
299
- 'outputs': [{'name': 'result','type': 'viewer'}],
300
- 'tags': [
301
- 'viewer'
302
- ],
303
- 'meta': {showInGallery: 'false'},
288
+ 'outputs': [{'name': 'result', 'type': 'viewer'}],
289
+ 'meta': {showInGallery: 'false', role: 'viewer'},
304
290
  'name': 'MCL',
305
- 'description': 'Markov clustering viewer'
291
+ 'description': 'Markov clustering viewer',
306
292
  })
307
293
  static markovClusteringViewer(): MCLViewer {
308
294
  return new MCLViewer();
@@ -310,15 +296,14 @@ export class PackageFunctions {
310
296
 
311
297
  @grok.decorators.func({
312
298
  'outputs': [{'name': 'plsResults', 'type': 'object'}],
313
- 'description': 'Compute partial least squares (PLS) regression analysis components: prediction, regression coefficients, T- & U-scores, X-loadings.'
299
+ 'description': 'Compute partial least squares (PLS) regression analysis components: prediction, regression coefficients, T- & U-scores, X-loadings.',
314
300
  })
315
301
  static async PLS(
316
- table: DG.DataFrame,
317
- @grok.decorators.param({'type':'column_list','options':{'type':'numerical'}}) features: DG.ColumnList,
318
- @grok.decorators.param({'type':'column','options':{'type':'numerical'}}) predict: DG.Column,
319
- @grok.decorators.param({'type':'int','options':{'initialValue':'3'}}) components: number,
320
- @grok.decorators.param({'type':'column','options':{'type':'string'}}) names: DG.Column): Promise<PlsOutput> {
321
-
302
+ table: DG.DataFrame,
303
+ @grok.decorators.param({'type': 'column_list', 'options': {'type': 'numerical'}}) features: DG.ColumnList,
304
+ @grok.decorators.param({'type': 'column', 'options': {'type': 'numerical'}}) predict: DG.Column,
305
+ @grok.decorators.param({'type': 'int', 'options': {'initialValue': '3'}}) components: number,
306
+ @grok.decorators.param({'type': 'column', 'options': {'type': 'string'}}) names: DG.Column): Promise<PlsOutput> {
322
307
  return await getPlsAnalysis({
323
308
  table: table,
324
309
  features: features,
@@ -332,10 +317,9 @@ export class PackageFunctions {
332
317
 
333
318
  @grok.decorators.func({
334
319
  'top-menu': 'ML | Analyze | PLS...',
335
- 'description': 'Compute partial least squares (PLS) regression components. They maximally summarize the variation of the predictors while maximizing correlation with the response variable.'
320
+ 'description': 'Compute partial least squares (PLS) regression components. They maximally summarize the variation of the predictors while maximizing correlation with the response variable.',
336
321
  })
337
322
  static async topMenuPLS(): Promise<void> {
338
-
339
323
  await runMVA(PLS_ANALYSIS.COMPUTE_COMPONENTS);
340
324
  }
341
325
 
@@ -343,20 +327,19 @@ export class PackageFunctions {
343
327
  @grok.decorators.func({
344
328
  'top-menu': 'ML | Analyze | Multivariate Analysis...',
345
329
  'name': 'multivariateAnalysis',
346
- 'description': 'Multidimensional data analysis using partial least squares (PLS) regression.'
330
+ 'description': 'Multidimensional data analysis using partial least squares (PLS) regression.',
347
331
  })
348
332
  static async MVA(): Promise<void> {
349
-
350
333
  await runMVA(PLS_ANALYSIS.PERFORM_MVA);
351
334
  }
352
335
 
353
336
 
354
337
  @grok.decorators.func({
355
338
  'meta': {
356
- 'demoPath': 'Compute | Multivariate Analysis'
339
+ 'demoPath': 'Compute | Multivariate Analysis',
357
340
  },
358
341
  'name': 'MVA demo',
359
- 'description': 'Multidimensional data analysis using partial least squares (PLS) regression. It identifies latent factors and constructs a linear model based on them.'
342
+ 'description': 'Multidimensional data analysis using partial least squares (PLS) regression. It identifies latent factors and constructs a linear model based on them.',
360
343
  })
361
344
  static async demoMultivariateAnalysis(): Promise<void> {
362
345
  await runDemoMVA();
@@ -366,14 +349,13 @@ export class PackageFunctions {
366
349
  @grok.decorators.func({
367
350
  'meta': {
368
351
  'mlname': 'linear kernel LS-SVM',
369
- 'mlrole': 'train'
370
- }
352
+ 'mlrole': 'train',
353
+ },
371
354
  })
372
355
  static async trainLinearKernelSVM(
373
356
  df: DG.DataFrame,
374
357
  predictColumn: DG.Column,
375
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.0'}}) gamma: number): Promise<any> {
376
-
358
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.0'}}) gamma: number): Promise<any> {
377
359
  const trainedModel = await getTrainedModel({gamma: gamma, kernel: LINEAR}, df, predictColumn);
378
360
  return getPackedModel(trainedModel);
379
361
  }
@@ -382,13 +364,12 @@ export class PackageFunctions {
382
364
  @grok.decorators.func({
383
365
  'meta': {
384
366
  'mlname': 'linear kernel LS-SVM',
385
- 'mlrole': 'apply'
386
- }
367
+ 'mlrole': 'apply',
368
+ },
387
369
  })
388
370
  static async applyLinearKernelSVM(
389
371
  df: DG.DataFrame,
390
372
  model: any): Promise<DG.DataFrame> {
391
-
392
373
  return await getPrediction(df, model);
393
374
  }
394
375
 
@@ -396,13 +377,12 @@ export class PackageFunctions {
396
377
  @grok.decorators.func({
397
378
  'meta': {
398
379
  'mlname': 'linear kernel LS-SVM',
399
- 'mlrole': 'isApplicable'
400
- }
380
+ 'mlrole': 'isApplicable',
381
+ },
401
382
  })
402
383
  static async isApplicableLinearKernelSVM(
403
384
  df: DG.DataFrame,
404
385
  predictColumn: DG.Column): Promise<boolean> {
405
-
406
386
  return isApplicableSVM(df, predictColumn);
407
387
  }
408
388
 
@@ -410,13 +390,12 @@ export class PackageFunctions {
410
390
  @grok.decorators.func({
411
391
  'meta': {
412
392
  'mlname': 'linear kernel LS-SVM',
413
- 'mlrole': 'isInteractive'
414
- }
393
+ 'mlrole': 'isInteractive',
394
+ },
415
395
  })
416
396
  static async isInteractiveLinearKernelSVM(
417
397
  df: DG.DataFrame,
418
398
  predictColumn: DG.Column): Promise<boolean> {
419
-
420
399
  return isInteractiveSVM(df, predictColumn);
421
400
  }
422
401
 
@@ -424,8 +403,8 @@ export class PackageFunctions {
424
403
  @grok.decorators.func({
425
404
  'meta': {
426
405
  'mlname': 'linear kernel LS-SVM',
427
- 'mlrole': 'visualize'
428
- }
406
+ 'mlrole': 'visualize',
407
+ },
429
408
  })
430
409
  static async visualizeLinearKernelSVM(
431
410
  df: DG.DataFrame,
@@ -436,17 +415,15 @@ export class PackageFunctions {
436
415
  }
437
416
 
438
417
 
439
-
440
418
  @grok.decorators.func({
441
419
  'meta': {
442
420
  'mlname': 'RBF-kernel LS-SVM',
443
- 'mlrole': 'train'
444
- }
421
+ 'mlrole': 'train',
422
+ },
445
423
  })
446
424
  static async trainRBFkernelSVM(df: DG.DataFrame, predictColumn: DG.Column,
447
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
448
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.5'}}) sigma: number): Promise<any> {
449
-
425
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
426
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.5'}}) sigma: number): Promise<any> {
450
427
  const trainedModel = await getTrainedModel(
451
428
  {gamma: gamma, kernel: RBF, sigma: sigma},
452
429
  df, predictColumn);
@@ -458,13 +435,12 @@ export class PackageFunctions {
458
435
  @grok.decorators.func({
459
436
  'meta': {
460
437
  'mlname': 'RBF-kernel LS-SVM',
461
- 'mlrole': 'apply'
462
- }
438
+ 'mlrole': 'apply',
439
+ },
463
440
  })
464
441
  static async applyRBFkernelSVM(
465
442
  df: DG.DataFrame,
466
443
  model: any): Promise<DG.DataFrame> {
467
-
468
444
  return await getPrediction(df, model);
469
445
  }
470
446
 
@@ -472,13 +448,12 @@ export class PackageFunctions {
472
448
  @grok.decorators.func({
473
449
  'meta': {
474
450
  'mlname': 'RBF-kernel LS-SVM',
475
- 'mlrole': 'isApplicable'
476
- }
451
+ 'mlrole': 'isApplicable',
452
+ },
477
453
  })
478
454
  static async isApplicableRBFkernelSVM(
479
455
  df: DG.DataFrame,
480
456
  predictColumn: DG.Column): Promise<boolean> {
481
-
482
457
  return isApplicableSVM(df, predictColumn);
483
458
  }
484
459
 
@@ -486,30 +461,27 @@ export class PackageFunctions {
486
461
  @grok.decorators.func({
487
462
  'meta': {
488
463
  'mlname': 'RBF-kernel LS-SVM',
489
- 'mlrole': 'isInteractive'
490
- }
464
+ 'mlrole': 'isInteractive',
465
+ },
491
466
  })
492
467
  static async isInteractiveRBFkernelSVM(
493
468
  df: DG.DataFrame,
494
469
  predictColumn: DG.Column): Promise<boolean> {
495
-
496
470
  return isInteractiveSVM(df, predictColumn);
497
471
  }
498
472
 
499
473
 
500
-
501
474
  @grok.decorators.func({
502
475
  'meta': {
503
476
  'mlname': 'RBF-kernel LS-SVM',
504
- 'mlrole': 'visualize'
505
- }
477
+ 'mlrole': 'visualize',
478
+ },
506
479
  })
507
480
  static async visualizeRBFkernelSVM(
508
481
  df: DG.DataFrame,
509
482
  targetColumn: DG.Column,
510
483
  predictColumn: DG.Column,
511
484
  model: any): Promise<any> {
512
-
513
485
  return showTrainReport(df, model);
514
486
  }
515
487
 
@@ -517,14 +489,13 @@ export class PackageFunctions {
517
489
  @grok.decorators.func({
518
490
  'meta': {
519
491
  'mlname': 'polynomial kernel LS-SVM',
520
- 'mlrole': 'train'
492
+ 'mlrole': 'train',
521
493
  },
522
494
  })
523
495
  static async trainPolynomialKernelSVM(df: DG.DataFrame, predictColumn: DG.Column,
524
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
525
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1'}}) c: number,
526
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '2'}}) d: number): Promise<any> {
527
-
496
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
497
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1'}}) c: number,
498
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '2'}}) d: number): Promise<any> {
528
499
  const trainedModel = await getTrainedModel(
529
500
  {gamma: gamma, kernel: POLYNOMIAL, cParam: c, dParam: d},
530
501
  df, predictColumn);
@@ -536,13 +507,12 @@ export class PackageFunctions {
536
507
  @grok.decorators.func({
537
508
  'meta': {
538
509
  'mlname': 'polynomial kernel LS-SVM',
539
- 'mlrole': 'apply'
510
+ 'mlrole': 'apply',
540
511
  },
541
512
  })
542
513
  static async applyPolynomialKernelSVM(
543
- df: DG.DataFrame,
544
- model: any): Promise<DG.DataFrame> {
545
-
514
+ df: DG.DataFrame,
515
+ model: any): Promise<DG.DataFrame> {
546
516
  return await getPrediction(df, model);
547
517
  }
548
518
 
@@ -550,13 +520,12 @@ export class PackageFunctions {
550
520
  @grok.decorators.func({
551
521
  'meta': {
552
522
  'mlname': 'polynomial kernel LS-SVM',
553
- 'mlrole': 'isApplicable'
554
- }
523
+ 'mlrole': 'isApplicable',
524
+ },
555
525
  })
556
526
  static async isApplicablePolynomialKernelSVM(
557
527
  df: DG.DataFrame,
558
528
  predictColumn: DG.Column): Promise<boolean> {
559
-
560
529
  return isApplicableSVM(df, predictColumn);
561
530
  }
562
531
 
@@ -564,13 +533,12 @@ export class PackageFunctions {
564
533
  @grok.decorators.func({
565
534
  'meta': {
566
535
  'mlname': 'polynomial kernel LS-SVM',
567
- 'mlrole': 'isInteractive'
568
- }
536
+ 'mlrole': 'isInteractive',
537
+ },
569
538
  })
570
539
  static async isInteractivePolynomialKernelSVM(
571
540
  df: DG.DataFrame,
572
541
  predictColumn: DG.Column): Promise<boolean> {
573
-
574
542
  return isInteractiveSVM(df, predictColumn);
575
543
  }
576
544
 
@@ -578,17 +546,16 @@ export class PackageFunctions {
578
546
  @grok.decorators.func({
579
547
  'meta': {
580
548
  'mlname': 'polynomial kernel LS-SVM',
581
- 'mlrole': 'visualize'
549
+ 'mlrole': 'visualize',
582
550
  },
583
- 'outputs': [{'name': 'widget','type': 'dynamic'}],
584
- 'name': 'visualizePolynomialKernelSVM'
551
+ 'outputs': [{'name': 'widget', 'type': 'dynamic'}],
552
+ 'name': 'visualizePolynomialKernelSVM',
585
553
  })
586
554
  static async visualizePolynomialKernelSVM(
587
- df: DG.DataFrame,
588
- targetColumn: DG.Column,
589
- predictColumn: DG.Column,
590
- model: any): Promise<any> {
591
-
555
+ df: DG.DataFrame,
556
+ targetColumn: DG.Column,
557
+ predictColumn: DG.Column,
558
+ model: any): Promise<any> {
592
559
  return showTrainReport(df, model);
593
560
  }
594
561
 
@@ -596,15 +563,14 @@ export class PackageFunctions {
596
563
  @grok.decorators.func({
597
564
  'meta': {
598
565
  'mlname': 'sigmoid kernel LS-SVM',
599
- 'mlrole': 'train'
566
+ 'mlrole': 'train',
600
567
  },
601
- 'name': 'trainSigmoidKernelSVM'
568
+ 'name': 'trainSigmoidKernelSVM',
602
569
  })
603
570
  static async trainSigmoidKernelSVM(df: DG.DataFrame, predictColumn: DG.Column,
604
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
605
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1'}}) kappa: number,
606
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1'}}) theta: number): Promise<any> {
607
-
571
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.0'}}) gamma: number,
572
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1'}}) kappa: number,
573
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1'}}) theta: number): Promise<any> {
608
574
  const trainedModel = await getTrainedModel(
609
575
  {gamma: gamma, kernel: SIGMOID, kappa: kappa, theta: theta},
610
576
  df, predictColumn);
@@ -616,14 +582,13 @@ export class PackageFunctions {
616
582
  @grok.decorators.func({
617
583
  'meta': {
618
584
  'mlname': 'sigmoid kernel LS-SVM',
619
- 'mlrole': 'apply'
585
+ 'mlrole': 'apply',
620
586
  },
621
- 'name': 'applySigmoidKernelSVM'
587
+ 'name': 'applySigmoidKernelSVM',
622
588
  })
623
589
  static async applySigmoidKernelSVM(
624
- df: DG.DataFrame,
625
- model: any): Promise<DG.DataFrame> {
626
-
590
+ df: DG.DataFrame,
591
+ model: any): Promise<DG.DataFrame> {
627
592
  return await getPrediction(df, model);
628
593
  }
629
594
 
@@ -631,14 +596,13 @@ export class PackageFunctions {
631
596
  @grok.decorators.func({
632
597
  'meta': {
633
598
  'mlname': 'sigmoid kernel LS-SVM',
634
- 'mlrole': 'isApplicable'
599
+ 'mlrole': 'isApplicable',
635
600
  },
636
- 'name': 'isApplicableSigmoidKernelSVM'
601
+ 'name': 'isApplicableSigmoidKernelSVM',
637
602
  })
638
603
  static async isApplicableSigmoidKernelSVM(
639
- df: DG.DataFrame,
640
- predictColumn: DG.Column): Promise<boolean> {
641
-
604
+ df: DG.DataFrame,
605
+ predictColumn: DG.Column): Promise<boolean> {
642
606
  return isApplicableSVM(df, predictColumn);
643
607
  }
644
608
 
@@ -646,14 +610,13 @@ export class PackageFunctions {
646
610
  @grok.decorators.func({
647
611
  'meta': {
648
612
  'mlname': 'sigmoid kernel LS-SVM',
649
- 'mlrole': 'isInteractive'
613
+ 'mlrole': 'isInteractive',
650
614
  },
651
- 'name': 'isInteractiveSigmoidKernelSVM'
615
+ 'name': 'isInteractiveSigmoidKernelSVM',
652
616
  })
653
617
  static async isInteractiveSigmoidKernelSVM(
654
- df: DG.DataFrame,
655
- predictColumn: DG.Column): Promise<boolean> {
656
-
618
+ df: DG.DataFrame,
619
+ predictColumn: DG.Column): Promise<boolean> {
657
620
  return isInteractiveSVM(df, predictColumn);
658
621
  }
659
622
 
@@ -661,16 +624,15 @@ export class PackageFunctions {
661
624
  @grok.decorators.func({
662
625
  'meta': {
663
626
  'mlname': 'sigmoid kernel LS-SVM',
664
- 'mlrole': 'visualize'
627
+ 'mlrole': 'visualize',
665
628
  },
666
- 'name': 'visualizeSigmoidKernelSVM'
629
+ 'name': 'visualizeSigmoidKernelSVM',
667
630
  })
668
631
  static async visualizeSigmoidKernelSVM(
669
- df: DG.DataFrame,
670
- targetColumn: DG.Column,
671
- predictColumn: DG.Column,
672
- model: any): Promise<any> {
673
-
632
+ df: DG.DataFrame,
633
+ targetColumn: DG.Column,
634
+ predictColumn: DG.Column,
635
+ model: any): Promise<any> {
674
636
  return showTrainReport(df, model);
675
637
  }
676
638
 
@@ -678,10 +640,9 @@ export class PackageFunctions {
678
640
  @grok.decorators.func({
679
641
  'top-menu': 'ML | Analyze | ANOVA...',
680
642
  'name': 'ANOVA',
681
- 'description': 'One-way analysis of variances (ANOVA) determines whether the examined factor has a significant impact on the explored feature.'
643
+ 'description': 'One-way analysis of variances (ANOVA) determines whether the examined factor has a significant impact on the explored feature.',
682
644
  })
683
645
  static anova(): void {
684
-
685
646
  runOneWayAnova();
686
647
  }
687
648
 
@@ -689,21 +650,19 @@ export class PackageFunctions {
689
650
  @grok.decorators.func({
690
651
  'top-menu': 'ML | Impute Missing Values...',
691
652
  'name': 'KNN impute',
692
- 'description': 'Missing values imputation using the k-nearest neighbors method (KNN)'
653
+ 'description': 'Missing values imputation using the k-nearest neighbors method (KNN)',
693
654
  })
694
655
  static kNNImputation() {
695
-
696
656
  runKNNImputer();
697
657
  }
698
658
 
699
659
 
700
660
  @grok.decorators.func({
701
661
  'name': 'KNN imputation for a table',
702
- 'description': 'Missing values imputation using the k-nearest neighbors method'
662
+ 'description': 'Missing values imputation using the k-nearest neighbors method',
703
663
  })
704
664
  static async kNNImputationForTable(
705
- table: DG.DataFrame) {
706
-
665
+ table: DG.DataFrame) {
707
666
  await runKNNImputer(table);
708
667
  }
709
668
 
@@ -711,15 +670,14 @@ export class PackageFunctions {
711
670
  @grok.decorators.func({
712
671
  'meta': {
713
672
  'mlname': 'Linear Regression',
714
- 'mlrole': 'train'
673
+ 'mlrole': 'train',
715
674
  },
716
675
  'name': 'trainLinearRegression',
717
- 'outputs': [{'type': 'dynamic', 'name': 'model'}]
676
+ 'outputs': [{'type': 'dynamic', 'name': 'model'}],
718
677
  })
719
678
  static async trainLinearRegression(
720
- df: DG.DataFrame,
721
- predictColumn: DG.Column): Promise<Uint8Array> {
722
-
679
+ df: DG.DataFrame,
680
+ predictColumn: DG.Column): Promise<Uint8Array> {
723
681
  const features = df.columns;
724
682
  const params = await getLinearRegressionParams(features, predictColumn);
725
683
 
@@ -730,14 +688,13 @@ export class PackageFunctions {
730
688
  @grok.decorators.func({
731
689
  'meta': {
732
690
  'mlname': 'Linear Regression',
733
- 'mlrole': 'apply'
691
+ 'mlrole': 'apply',
734
692
  },
735
- 'name': 'applyLinearRegression'
693
+ 'name': 'applyLinearRegression',
736
694
  })
737
695
  static applyLinearRegression(
738
- df: DG.DataFrame,
739
- model: any): DG.DataFrame {
740
-
696
+ df: DG.DataFrame,
697
+ model: any): DG.DataFrame {
741
698
  const features = df.columns;
742
699
  const params = new Float32Array((model as Uint8Array).buffer);
743
700
  return DG.DataFrame.fromColumns([getPredictionByLinearRegression(features, params)]);
@@ -747,14 +704,13 @@ export class PackageFunctions {
747
704
  @grok.decorators.func({
748
705
  'meta': {
749
706
  'mlname': 'Linear Regression',
750
- 'mlrole': 'isApplicable'
707
+ 'mlrole': 'isApplicable',
751
708
  },
752
- 'name': 'isApplicableLinearRegression'
709
+ 'name': 'isApplicableLinearRegression',
753
710
  })
754
711
  static isApplicableLinearRegression(
755
- df: DG.DataFrame,
756
- predictColumn: DG.Column): boolean {
757
-
712
+ df: DG.DataFrame,
713
+ predictColumn: DG.Column): boolean {
758
714
  for (const col of df.columns) {
759
715
  if (!col.matches('numerical'))
760
716
  return false;
@@ -767,14 +723,13 @@ export class PackageFunctions {
767
723
  @grok.decorators.func({
768
724
  'meta': {
769
725
  'mlname': 'Linear Regression',
770
- 'mlrole': 'isInteractive'
726
+ 'mlrole': 'isInteractive',
771
727
  },
772
- 'name': 'isInteractiveLinearRegression'
728
+ 'name': 'isInteractiveLinearRegression',
773
729
  })
774
730
  static isInteractiveLinearRegression(
775
- df: DG.DataFrame,
776
- predictColumn: DG.Column): boolean {
777
-
731
+ df: DG.DataFrame,
732
+ predictColumn: DG.Column): boolean {
778
733
  return df.rowCount <= 100000;
779
734
  }
780
735
 
@@ -782,17 +737,16 @@ export class PackageFunctions {
782
737
  @grok.decorators.func({
783
738
  'meta': {
784
739
  'mlname': 'Softmax',
785
- 'mlrole': 'train'
740
+ 'mlrole': 'train',
786
741
  },
787
742
  'name': 'trainSoftmax',
788
- 'outputs': [{'type': 'dynamic', 'name': 'model'}]
743
+ 'outputs': [{'type': 'dynamic', 'name': 'model'}],
789
744
  })
790
745
  static async trainSoftmax(df: DG.DataFrame, predictColumn: DG.Column,
791
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '1.0', 'min': '0.001', 'max': '20', description: 'Learning rate.'}}) rate: number,
792
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '100', 'min': '1', 'max': '10000', 'step': '10', description: 'Fitting iterations count'}}) iterations: number,
793
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '0.1', 'min': '0.0001', 'max': '1', description: 'Regularization rate.'}}) penalty: number,
794
- @grok.decorators.param({'options':{'category':'Hyperparameters', 'initialValue': '0.001', 'min': '0.00001', 'max': '0.1', description: 'Fitting tolerance.'}}) tolerance: number): Promise<Uint8Array> {
795
-
746
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '1.0', 'min': '0.001', 'max': '20', 'description': 'Learning rate.'}}) rate: number,
747
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '100', 'min': '1', 'max': '10000', 'step': '10', 'description': 'Fitting iterations count'}}) iterations: number,
748
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '0.1', 'min': '0.0001', 'max': '1', 'description': 'Regularization rate.'}}) penalty: number,
749
+ @grok.decorators.param({'options': {'category': 'Hyperparameters', 'initialValue': '0.001', 'min': '0.00001', 'max': '0.1', 'description': 'Fitting tolerance.'}}) tolerance: number): Promise<Uint8Array> {
796
750
  const features = df.columns;
797
751
 
798
752
  const model = new SoftmaxClassifier({
@@ -809,14 +763,13 @@ export class PackageFunctions {
809
763
  @grok.decorators.func({
810
764
  'meta': {
811
765
  'mlname': 'Softmax',
812
- 'mlrole': 'apply'
766
+ 'mlrole': 'apply',
813
767
  },
814
- 'name': 'applySoftmax'
768
+ 'name': 'applySoftmax',
815
769
  })
816
770
  static applySoftmax(
817
- df: DG.DataFrame,
818
- model: any): DG.DataFrame {
819
-
771
+ df: DG.DataFrame,
772
+ model: any): DG.DataFrame {
820
773
  const features = df.columns;
821
774
  const unpackedModel = new SoftmaxClassifier(undefined, model);
822
775
 
@@ -827,14 +780,13 @@ export class PackageFunctions {
827
780
  @grok.decorators.func({
828
781
  'meta': {
829
782
  'mlname': 'Softmax',
830
- 'mlrole': 'isApplicable'
783
+ 'mlrole': 'isApplicable',
831
784
  },
832
- 'name': 'isApplicableSoftmax'
785
+ 'name': 'isApplicableSoftmax',
833
786
  })
834
787
  static isApplicableSoftmax(
835
- df: DG.DataFrame,
836
- predictColumn: DG.Column): boolean {
837
-
788
+ df: DG.DataFrame,
789
+ predictColumn: DG.Column): boolean {
838
790
  return SoftmaxClassifier.isApplicable(df.columns, predictColumn);
839
791
  }
840
792
 
@@ -842,14 +794,13 @@ export class PackageFunctions {
842
794
  @grok.decorators.func({
843
795
  'meta': {
844
796
  'mlname': 'Softmax',
845
- 'mlrole': 'isInteractive'
797
+ 'mlrole': 'isInteractive',
846
798
  },
847
- 'name': 'isInteractiveSoftmax'
799
+ 'name': 'isInteractiveSoftmax',
848
800
  })
849
801
  static isInteractiveSoftmax(
850
- df: DG.DataFrame,
851
- predictColumn: DG.Column): boolean {
852
-
802
+ df: DG.DataFrame,
803
+ predictColumn: DG.Column): boolean {
853
804
  return SoftmaxClassifier.isInteractive(df.columns, predictColumn);
854
805
  }
855
806
 
@@ -857,16 +808,15 @@ export class PackageFunctions {
857
808
  @grok.decorators.func({
858
809
  'meta': {
859
810
  'mlname': 'PLS Regression',
860
- 'mlrole': 'train'
811
+ 'mlrole': 'train',
861
812
  },
862
813
  'name': 'trainPLSRegression',
863
814
  'outputs': [{'name': 'model', 'type': 'dynamic'}],
864
815
  })
865
816
  static async trainPLSRegression(
866
- df: DG.DataFrame,
867
- predictColumn: DG.Column,
868
- @grok.decorators.param({'type':'int','options':{'min':'1','max':'10','initialValue':'3', description: 'Number of latent components.'}}) components: number): Promise<Uint8Array> {
869
-
817
+ df: DG.DataFrame,
818
+ predictColumn: DG.Column,
819
+ @grok.decorators.param({'type': 'int', 'options': {'min': '1', 'max': '10', 'initialValue': '3', 'description': 'Number of latent components.'}}) components: number): Promise<Uint8Array> {
870
820
  const features = df.columns;
871
821
 
872
822
  const model = new PlsModel();
@@ -883,14 +833,13 @@ export class PackageFunctions {
883
833
  @grok.decorators.func({
884
834
  'meta': {
885
835
  'mlname': 'PLS Regression',
886
- 'mlrole': 'apply'
836
+ 'mlrole': 'apply',
887
837
  },
888
- 'name': 'applyPLSRegression'
838
+ 'name': 'applyPLSRegression',
889
839
  })
890
840
  static applyPLSRegression(
891
- df: DG.DataFrame,
892
- model: any): DG.DataFrame {
893
-
841
+ df: DG.DataFrame,
842
+ model: any): DG.DataFrame {
894
843
  const unpackedModel = new PlsModel(model);
895
844
  return DG.DataFrame.fromColumns([unpackedModel.predict(df.columns)]);
896
845
  }
@@ -899,14 +848,13 @@ export class PackageFunctions {
899
848
  @grok.decorators.func({
900
849
  'meta': {
901
850
  'mlname': 'PLS Regression',
902
- 'mlrole': 'isApplicable'
851
+ 'mlrole': 'isApplicable',
903
852
  },
904
- 'name': 'isApplicablePLSRegression'
853
+ 'name': 'isApplicablePLSRegression',
905
854
  })
906
855
  static isApplicablePLSRegression(
907
- df: DG.DataFrame,
908
- predictColumn: DG.Column): boolean {
909
-
856
+ df: DG.DataFrame,
857
+ predictColumn: DG.Column): boolean {
910
858
  return PlsModel.isApplicable(df.columns, predictColumn);
911
859
  }
912
860
 
@@ -914,16 +862,15 @@ export class PackageFunctions {
914
862
  @grok.decorators.func({
915
863
  'meta': {
916
864
  'mlname': 'PLS Regression',
917
- 'mlrole': 'visualize'
865
+ 'mlrole': 'visualize',
918
866
  },
919
- 'name': 'visualizePLSRegression'
867
+ 'name': 'visualizePLSRegression',
920
868
  })
921
869
  static async visualizePLSRegression(
922
- df: DG.DataFrame,
923
- targetColumn: DG.Column,
924
- predictColumn: DG.Column,
925
- model: any): Promise<any> {
926
-
870
+ df: DG.DataFrame,
871
+ targetColumn: DG.Column,
872
+ predictColumn: DG.Column,
873
+ model: any): Promise<any> {
927
874
  const unpackedModel = new PlsModel(model);
928
875
  const viewers = unpackedModel.viewers();
929
876
 
@@ -934,33 +881,32 @@ export class PackageFunctions {
934
881
  @grok.decorators.func({
935
882
  'meta': {
936
883
  'mlname': 'PLS Regression',
937
- 'mlrole': 'isInteractive'
884
+ 'mlrole': 'isInteractive',
938
885
  },
939
- 'name': 'isInteractivePLSRegression'
886
+ 'name': 'isInteractivePLSRegression',
940
887
  })
941
888
  static isInteractivePLSRegression(
942
- df: DG.DataFrame,
943
- predictColumn: DG.Column): boolean {
944
-
889
+ df: DG.DataFrame,
890
+ predictColumn: DG.Column): boolean {
945
891
  return PlsModel.isInteractive(df.columns, predictColumn);
946
892
  }
947
893
 
948
894
  @grok.decorators.func({
949
895
  'meta': {
950
896
  'mlname': 'XGBoost',
951
- 'mlrole': 'train'
897
+ 'mlrole': 'train',
952
898
  },
953
899
  'name': 'trainXGBooster',
954
900
  'outputs': [{'name': 'model', 'type': 'dynamic'}],
955
901
  })
956
902
  static async trainXGBooster(
957
- df: DG.DataFrame,
958
- predictColumn: DG.Column,
959
- @grok.decorators.param({'type':'int','options':{'min':'1','max':'100','initialValue':'20', description: 'Number of training iterations.'}}) iterations: number,
960
- @grok.decorators.param({'type':'double','options':{'caption':'Rate','min':'0','max':'1','initialValue':'0.3', description: 'Learning rate.'}}) eta: number,
961
- @grok.decorators.param({'type':'int','options':{'min':'0','max':'20','initialValue':'6', description: 'Maximum depth of a tree.'}}) maxDepth: number,
962
- @grok.decorators.param({'type':'double','options':{'min':'0','max':'100','initialValue':'1', description: 'L2 regularization term.'}}) lambda: number,
963
- @grok.decorators.param({'type':'double','options':{'min':'0','max':'100','initialValue':'0', description: 'L1 regularization term.'}}) alpha: number): Promise<Uint8Array> {
903
+ df: DG.DataFrame,
904
+ predictColumn: DG.Column,
905
+ @grok.decorators.param({'type': 'int', 'options': {'min': '1', 'max': '100', 'initialValue': '20', 'description': 'Number of training iterations.'}}) iterations: number,
906
+ @grok.decorators.param({'type': 'double', 'options': {'caption': 'Rate', 'min': '0', 'max': '1', 'initialValue': '0.3', 'description': 'Learning rate.'}}) eta: number,
907
+ @grok.decorators.param({'type': 'int', 'options': {'min': '0', 'max': '20', 'initialValue': '6', 'description': 'Maximum depth of a tree.'}}) maxDepth: number,
908
+ @grok.decorators.param({'type': 'double', 'options': {'min': '0', 'max': '100', 'initialValue': '1', 'description': 'L2 regularization term.'}}) lambda: number,
909
+ @grok.decorators.param({'type': 'double', 'options': {'min': '0', 'max': '100', 'initialValue': '0', 'description': 'L1 regularization term.'}}) alpha: number): Promise<Uint8Array> {
964
910
  const features = df.columns;
965
911
 
966
912
  const booster = new XGBooster();
@@ -973,14 +919,13 @@ export class PackageFunctions {
973
919
  @grok.decorators.func({
974
920
  'meta': {
975
921
  'mlname': 'XGBoost',
976
- 'mlrole': 'apply'
922
+ 'mlrole': 'apply',
977
923
  },
978
- 'name': 'applyXGBooster'
924
+ 'name': 'applyXGBooster',
979
925
  })
980
926
  static applyXGBooster(
981
- df: DG.DataFrame,
982
- model: any): DG.DataFrame {
983
-
927
+ df: DG.DataFrame,
928
+ model: any): DG.DataFrame {
984
929
  const unpackedModel = new XGBooster(model);
985
930
  return DG.DataFrame.fromColumns([unpackedModel.predict(df.columns)]);
986
931
  }
@@ -989,14 +934,13 @@ export class PackageFunctions {
989
934
  @grok.decorators.func({
990
935
  'meta': {
991
936
  'mlname': 'XGBoost',
992
- 'mlrole': 'isInteractive'
937
+ 'mlrole': 'isInteractive',
993
938
  },
994
- 'name': 'isInteractiveXGBooster'
939
+ 'name': 'isInteractiveXGBooster',
995
940
  })
996
941
  static isInteractiveXGBooster(
997
- df: DG.DataFrame,
998
- predictColumn: DG.Column): boolean {
999
-
942
+ df: DG.DataFrame,
943
+ predictColumn: DG.Column): boolean {
1000
944
  return XGBooster.isInteractive(df.columns, predictColumn);
1001
945
  }
1002
946
 
@@ -1004,14 +948,78 @@ export class PackageFunctions {
1004
948
  @grok.decorators.func({
1005
949
  'meta': {
1006
950
  'mlname': 'XGBoost',
1007
- 'mlrole': 'isApplicable'
951
+ 'mlrole': 'isApplicable',
1008
952
  },
1009
- 'name': 'isApplicableXGBooster'
953
+ 'name': 'isApplicableXGBooster',
1010
954
  })
1011
955
  static isApplicableXGBooster(
1012
- df: DG.DataFrame,
1013
- predictColumn: DG.Column): boolean {
1014
-
956
+ df: DG.DataFrame,
957
+ predictColumn: DG.Column): boolean {
1015
958
  return XGBooster.isApplicable(df.columns, predictColumn);
1016
959
  }
960
+
961
+ @grok.decorators.func({
962
+ 'top-menu': 'ML | Pareto Front...',
963
+ 'name': 'Pareto Front',
964
+ 'description': 'Perform optimization across multiple objectives: analyze trade-offs between conflicting objectives and identify Pareto-optimal points.',
965
+ })
966
+ static paretoFront(): void {
967
+ const df = grok.shell.t;
968
+ if (df === null) {
969
+ grok.shell.warning('No dataframe is opened');
970
+ return;
971
+ }
972
+
973
+ const optimizer = new ParetoOptimizer(df);
974
+ optimizer.run();
975
+ //runParetoOptimizer();
976
+ }
977
+
978
+ @grok.decorators.func({
979
+ 'name': 'Pareto front',
980
+ 'description': 'Pareto front viewer',
981
+ 'outputs': [{'name': 'result', 'type': 'viewer'}],
982
+ 'meta': {'icon': 'icons/pareto-front-viewer.svg', role: 'viewer'},
983
+ })
984
+ static paretoFrontViewer(): DG.Viewer {
985
+ return new ParetoFrontViewer();
986
+ }
987
+
988
+ @grok.decorators.func({
989
+ 'top-menu': 'Chem | Calculate | Train pMPO...',
990
+ 'name': 'trainPmpo',
991
+ 'description': 'Train probabilistic multi-parameter optimization (pMPO) model',
992
+ })
993
+ static trainPmpo(): void {
994
+ const df = grok.shell.t;
995
+ if (df === null) {
996
+ grok.shell.warning('No dataframe is opened');
997
+ return;
998
+ }
999
+
1000
+ if (!Pmpo.isTableValid(df))
1001
+ return;
1002
+
1003
+ const pMPO = new Pmpo(df);
1004
+ pMPO.runTrainingApp();
1005
+ }
1006
+
1007
+ @grok.decorators.func({
1008
+ //'top-menu': 'ML | Apply pMPO...',
1009
+ 'name': 'applyPmpo',
1010
+ 'description': 'Apply trained probabilistic multi-parameter optimization (pMPO) model to score samples',
1011
+ })
1012
+ static async applyPmpo(
1013
+ @grok.decorators.param({'type': 'dataframe'}) table: DG.DataFrame,
1014
+ @grok.decorators.param({'type': 'file'}) file: DG.FileInfo,
1015
+ ): Promise<void> {
1016
+ try {
1017
+ const params = await loadPmpoParams(file);
1018
+ const predName = table.columns.getUnusedName('pMPO score');
1019
+ const prediction = Pmpo.predict(table, params, predName);
1020
+ table.columns.add(prediction, true);
1021
+ } catch (err) {
1022
+ grok.shell.warning(`Failed to apply pMPO: ${err instanceof Error ? err.message : 'the platform issue.'}`);
1023
+ }
1024
+ }
1017
1025
  }