@datagrok/compute 1.44.5 → 1.45.0
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/CHANGELOG.md +11 -1
- package/README.md +5 -7
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/package.json +11 -8
- package/scripts/lorenz-attractor.js +1 -1
- package/src/package-api.ts +5 -31
- package/src/package-test.ts +1 -1
- package/src/package.g.ts +9 -55
- package/src/package.ts +7 -150
- package/dist/148.js +0 -2
- package/dist/148.js.map +0 -1
- package/dist/377.js +0 -2
- package/dist/377.js.map +0 -1
- package/dist/508.js +0 -2
- package/dist/508.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/compute",
|
|
3
3
|
"friendlyName": "Compute",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.45.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Andrey Sharapov",
|
|
7
7
|
"email": "andrey.sharapov@softwarecountry.com"
|
|
8
8
|
},
|
|
9
|
-
"description": "
|
|
9
|
+
"description": "Legacy modeling UI",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "https://github.com/datagrok-ai/public.git",
|
|
13
13
|
"directory": "packages/Compute"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@datagrok-libraries/compute-utils": "^1.
|
|
17
|
-
"@datagrok-libraries/
|
|
16
|
+
"@datagrok-libraries/compute-utils": "^1.45.1",
|
|
17
|
+
"@datagrok-libraries/test": "^1.2.0",
|
|
18
|
+
"@datagrok-libraries/utils": "^4.7.1",
|
|
18
19
|
"cash-dom": "^8.1.5",
|
|
19
|
-
"datagrok-api": "^1.
|
|
20
|
-
"dayjs": "
|
|
20
|
+
"datagrok-api": "^1.27.0",
|
|
21
|
+
"dayjs": "1.11.19",
|
|
21
22
|
"exceljs": "^4.3.0",
|
|
22
23
|
"rxjs": "^6.6.7",
|
|
23
24
|
"source-map-loader": "^5.0.0",
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
30
31
|
"@typescript-eslint/parser": "^8.8.1",
|
|
31
32
|
"css-loader": "^7.1.2",
|
|
32
|
-
"datagrok-tools": "^
|
|
33
|
+
"datagrok-tools": "^5.0.0",
|
|
33
34
|
"eslint": "^8.0.1",
|
|
34
35
|
"eslint-config-google": "^0.14.0",
|
|
35
36
|
"style-loader": "^4.0.0",
|
|
@@ -66,7 +67,9 @@
|
|
|
66
67
|
],
|
|
67
68
|
"category": "Compute",
|
|
68
69
|
"meta": {
|
|
69
|
-
"url": "/Modelhub",
|
|
70
70
|
"dartium": false
|
|
71
|
+
},
|
|
72
|
+
"overrides": {
|
|
73
|
+
"datagrok-api": "$datagrok-api"
|
|
71
74
|
}
|
|
72
75
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//input: double x0 = 0 [Initial conditions for rate of convective motion - i.e. how fast the rolls are rotating]
|
|
8
8
|
//input: double y0 = 1 [Initial conditions for temperature difference between the ascending and descending currents]
|
|
9
9
|
//input: double z0 = 1.05 [Initial conditions for distortion (from linearity) of the vertical temperature profile]
|
|
10
|
-
//output: dataframe df {caption: Lorenz attractor; viewer: 3d Scatter plot()
|
|
10
|
+
//output: dataframe df {caption: Lorenz attractor; viewer: 3d Scatter plot()}
|
|
11
11
|
//editor: Compute:RichFunctionViewEditor
|
|
12
12
|
//meta.runOnOpen: true
|
|
13
13
|
//meta.runOnInput: true
|
package/src/package-api.ts
CHANGED
|
@@ -28,6 +28,10 @@ export namespace scripts {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export namespace funcs {
|
|
31
|
+
export async function init(): Promise<void> {
|
|
32
|
+
return await grok.functions.call('Compute:Init', {});
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
export async function openModelFromFuncall(funccall: any ): Promise<void> {
|
|
32
36
|
return await grok.functions.call('Compute:OpenModelFromFuncall', { funccall });
|
|
33
37
|
}
|
|
@@ -43,26 +47,10 @@ export namespace funcs {
|
|
|
43
47
|
return await grok.functions.call('Compute:RichFunctionViewEditor', { call });
|
|
44
48
|
}
|
|
45
49
|
|
|
46
|
-
export async function pipelineStepEditor(call: any ): Promise<
|
|
50
|
+
export async function pipelineStepEditor(call: any ): Promise<any> {
|
|
47
51
|
return await grok.functions.call('Compute:PipelineStepEditor', { call });
|
|
48
52
|
}
|
|
49
53
|
|
|
50
|
-
export async function renderPanel(func: any ): Promise<any> {
|
|
51
|
-
return await grok.functions.call('Compute:RenderPanel', { func });
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export async function init(): Promise<void> {
|
|
55
|
-
return await grok.functions.call('Compute:Init', {});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export async function modelCatalog(): Promise<DG.View> {
|
|
59
|
-
return await grok.functions.call('Compute:ModelCatalog', {});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export async function modelCatalogTreeBrowser(treeNode: any , browseView: DG.View ): Promise<void> {
|
|
63
|
-
return await grok.functions.call('Compute:ModelCatalogTreeBrowser', { treeNode, browseView });
|
|
64
|
-
}
|
|
65
|
-
|
|
66
54
|
export async function customDataUploader(func: any ): Promise<any> {
|
|
67
55
|
return await grok.functions.call('Compute:CustomDataUploader', { func });
|
|
68
56
|
}
|
|
@@ -102,18 +90,4 @@ export namespace funcs {
|
|
|
102
90
|
export async function objectCoolingSelector(params: any ): Promise<any> {
|
|
103
91
|
return await grok.functions.call('Compute:ObjectCoolingSelector', { params });
|
|
104
92
|
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
Test for optimization: multiple scalars output
|
|
108
|
-
*/
|
|
109
|
-
export async function fitTestFunc(x1: number , x2: number , y: DG.DataFrame , bool: boolean ): Promise<{integer: number, float1: number, float2: number, table1: DG.DataFrame, table2: DG.DataFrame}> {
|
|
110
|
-
return await grok.functions.call('Compute:FitTestFunc', { x1, x2, y, bool });
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
Test for optimization: multiple scalars output
|
|
115
|
-
*/
|
|
116
|
-
export async function testFittingOutputs(): Promise<void> {
|
|
117
|
-
return await grok.functions.call('Compute:TestFittingOutputs', {});
|
|
118
|
-
}
|
|
119
93
|
}
|
package/src/package-test.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as DG from 'datagrok-api/dg';
|
|
2
2
|
import * as grok from 'datagrok-api/grok';
|
|
3
|
-
import {runTests, tests, TestContext, initAutoTests as initTests} from '@datagrok-libraries/
|
|
3
|
+
import {runTests, tests, TestContext, initAutoTests as initTests} from '@datagrok-libraries/test/src/test';
|
|
4
4
|
|
|
5
5
|
export const _package = new DG.Package();
|
|
6
6
|
export {tests};
|
package/src/package.g.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import {PackageFunctions} from './package';
|
|
2
2
|
import * as DG from 'datagrok-api/dg';
|
|
3
3
|
|
|
4
|
+
//meta.role: init
|
|
5
|
+
export async function init() : Promise<void> {
|
|
6
|
+
await PackageFunctions.init();
|
|
7
|
+
}
|
|
8
|
+
|
|
4
9
|
//input: funccall funccall
|
|
5
10
|
export function openModelFromFuncall(funccall: DG.FuncCall) : void {
|
|
6
11
|
PackageFunctions.openModelFromFuncall(funccall);
|
|
@@ -8,54 +13,26 @@ export function openModelFromFuncall(funccall: DG.FuncCall) : void {
|
|
|
8
13
|
|
|
9
14
|
//name: OutliersSelectionViewer
|
|
10
15
|
//description: Creates an outliers selection viewer
|
|
11
|
-
//tags: viewer
|
|
12
16
|
//output: viewer result
|
|
17
|
+
//meta.role: viewer
|
|
13
18
|
export function OutliersSelection() {
|
|
14
19
|
return PackageFunctions.OutliersSelection();
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
//tags: editor
|
|
18
22
|
//input: funccall call
|
|
19
23
|
//output: view result
|
|
24
|
+
//meta.role: editor
|
|
20
25
|
export function RichFunctionViewEditor(call: DG.FuncCall) {
|
|
21
26
|
return PackageFunctions.RichFunctionViewEditor(call);
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
//tags: editor
|
|
25
29
|
//input: funccall call
|
|
26
|
-
//output:
|
|
30
|
+
//output: object result
|
|
31
|
+
//meta.role: editor
|
|
27
32
|
export function PipelineStepEditor(call: DG.FuncCall) {
|
|
28
33
|
return PackageFunctions.PipelineStepEditor(call);
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
//name: renderRestPanel
|
|
32
|
-
//input: func func
|
|
33
|
-
//output: widget result
|
|
34
|
-
export async function renderPanel(func: any) : Promise<any> {
|
|
35
|
-
return await PackageFunctions.renderPanel(func);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
//tags: init
|
|
39
|
-
export function init() : void {
|
|
40
|
-
PackageFunctions.init();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
//name: Model Hub
|
|
44
|
-
//tags: app
|
|
45
|
-
//output: view result
|
|
46
|
-
//meta.browsePath: Compute
|
|
47
|
-
export function modelCatalog() {
|
|
48
|
-
return PackageFunctions.modelCatalog();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
//input: dynamic treeNode
|
|
52
|
-
//input: view browseView
|
|
53
|
-
//meta.role:
|
|
54
|
-
//meta.app:
|
|
55
|
-
export function modelCatalogTreeBrowser(treeNode: any, browseView: DG.ViewBase) : void {
|
|
56
|
-
PackageFunctions.modelCatalogTreeBrowser(treeNode, browseView);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
36
|
//input: dynamic func
|
|
60
37
|
//output: object uploadedCalls
|
|
61
38
|
export async function CustomDataUploader(func: any) {
|
|
@@ -115,26 +92,3 @@ export function CustomStringInput(params: any) {
|
|
|
115
92
|
export function ObjectCoolingSelector(params: any) {
|
|
116
93
|
return PackageFunctions.ObjectCoolingSelector(params);
|
|
117
94
|
}
|
|
118
|
-
|
|
119
|
-
//description: Test for optimization: multiple scalars output
|
|
120
|
-
//input: double x1 = 1 { caption: param1; min: -3; max: 3 }
|
|
121
|
-
//input: double x2 = -1 { caption: param2; min: -3; max: 3 }
|
|
122
|
-
//input: dataframe y { caption: table }
|
|
123
|
-
//input: bool bool
|
|
124
|
-
//output: int integer
|
|
125
|
-
//output: double float1
|
|
126
|
-
//output: double float2
|
|
127
|
-
//output: dataframe table1 { viewer: Line chart(block:60) | Grid(block:40) }
|
|
128
|
-
//output: dataframe table2 { viewer: Line chart(block:60) | Grid(block:40) }
|
|
129
|
-
//meta.features: {"fitting": true, "sens-analysis": true}
|
|
130
|
-
//meta.runOnOpen: true
|
|
131
|
-
//meta.runOnInput: true
|
|
132
|
-
//editor: Compute:RichFunctionViewEditor
|
|
133
|
-
export function fitTestFunc(x1: number, x2: number, y: DG.DataFrame, bool: boolean) {
|
|
134
|
-
return PackageFunctions.fitTestFunc(x1, x2, y, bool);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//description: Test for optimization: multiple scalars output
|
|
138
|
-
export async function testFittingOutputs() : Promise<void> {
|
|
139
|
-
await PackageFunctions.testFittingOutputs();
|
|
140
|
-
}
|
package/src/package.ts
CHANGED
|
@@ -18,13 +18,7 @@ import {
|
|
|
18
18
|
makeRevalidation as makeRevalidationInst,
|
|
19
19
|
mergeValidationResults as mergeValidationResultsInst,
|
|
20
20
|
} from '@datagrok-libraries/compute-utils';
|
|
21
|
-
import {
|
|
22
|
-
ModelHandler,
|
|
23
|
-
startModelCatalog,
|
|
24
|
-
makeModelTreeBrowser,
|
|
25
|
-
renderRestPanel,
|
|
26
|
-
setModelCatalogEventHandlers,
|
|
27
|
-
setModelCatalogHandler} from '@datagrok-libraries/compute-utils/model-catalog';
|
|
21
|
+
import {ModelHandler} from '@datagrok-libraries/compute-utils/model-catalog';
|
|
28
22
|
import {
|
|
29
23
|
testPipeline as testPipelineInst,
|
|
30
24
|
} from '@datagrok-libraries/compute-utils';
|
|
@@ -33,7 +27,6 @@ import {
|
|
|
33
27
|
} from '@datagrok-libraries/compute-utils';
|
|
34
28
|
|
|
35
29
|
|
|
36
|
-
import {FittingView} from '@datagrok-libraries/compute-utils/function-views/src/fitting-view';
|
|
37
30
|
export * from './package.g';
|
|
38
31
|
export const _package = new DG.Package();
|
|
39
32
|
|
|
@@ -53,22 +46,13 @@ export const historyInput = UiUtils.historyInput;
|
|
|
53
46
|
export const historyInputJSON = UiUtils.historyInputJSON;
|
|
54
47
|
export const historyPanel = UiUtils.historyPanel;
|
|
55
48
|
|
|
56
|
-
let startUriLoaded = false;
|
|
57
|
-
let initCompleted = false;
|
|
58
49
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
segment: 'Modelhub',
|
|
64
|
-
viewName: 'Model Hub',
|
|
65
|
-
funcName: 'modelCatalog',
|
|
66
|
-
setStartUriLoaded: () => startUriLoaded = true,
|
|
67
|
-
getStartUriLoaded: () => startUriLoaded,
|
|
68
|
-
};
|
|
50
|
+
export class PackageFunctions {
|
|
51
|
+
@grok.decorators.init()
|
|
52
|
+
static async init() {
|
|
53
|
+
}
|
|
69
54
|
|
|
70
55
|
|
|
71
|
-
export class PackageFunctions {
|
|
72
56
|
@grok.decorators.func()
|
|
73
57
|
static openModelFromFuncall(funccall: DG.FuncCall) {
|
|
74
58
|
ModelHandler.openModelFromFunccall(funccall as any);
|
|
@@ -76,10 +60,10 @@ export class PackageFunctions {
|
|
|
76
60
|
|
|
77
61
|
|
|
78
62
|
@grok.decorators.func({
|
|
79
|
-
tags: ['viewer'],
|
|
80
63
|
name: 'OutliersSelectionViewer',
|
|
81
64
|
description: 'Creates an outliers selection viewer',
|
|
82
65
|
outputs: [{type: 'viewer', name: 'result'}],
|
|
66
|
+
meta: {role: 'viewer'},
|
|
83
67
|
})
|
|
84
68
|
static OutliersSelection() {
|
|
85
69
|
return new OutliersSelectionViewer();
|
|
@@ -92,46 +76,11 @@ export class PackageFunctions {
|
|
|
92
76
|
}
|
|
93
77
|
|
|
94
78
|
|
|
95
|
-
@grok.decorators.editor({outputs: [{type: '
|
|
79
|
+
@grok.decorators.editor({outputs: [{type: 'object', name: 'result'}]})
|
|
96
80
|
static PipelineStepEditor(call: DG.FuncCall) {
|
|
97
81
|
return RichFunctionViewInst.fromFuncCall(call as any, {historyEnabled: false, isTabbed: true});
|
|
98
82
|
}
|
|
99
83
|
|
|
100
|
-
|
|
101
|
-
@grok.decorators.func({name: 'renderRestPanel'})
|
|
102
|
-
static async renderPanel(@grok.decorators.param({type: 'func'}) func: DG.Func) : Promise<DG.Widget> {
|
|
103
|
-
return renderRestPanel(func as any) as any;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
@grok.decorators.init()
|
|
107
|
-
static init() {
|
|
108
|
-
if (initCompleted)
|
|
109
|
-
return;
|
|
110
|
-
|
|
111
|
-
setModelCatalogHandler();
|
|
112
|
-
setModelCatalogEventHandlers(options as any);
|
|
113
|
-
|
|
114
|
-
initCompleted = true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
@grok.decorators.app({
|
|
119
|
-
browsePath: 'Compute',
|
|
120
|
-
name: 'Model Hub',
|
|
121
|
-
outputs: [{type: 'view', name: 'result'}],
|
|
122
|
-
})
|
|
123
|
-
static modelCatalog() {
|
|
124
|
-
return startModelCatalog(options as any);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
@grok.decorators.func({
|
|
129
|
-
meta: { role: ' ', app: ' '}
|
|
130
|
-
})
|
|
131
|
-
static modelCatalogTreeBrowser(treeNode: DG.TreeViewGroup, browseView: DG.ViewBase) {
|
|
132
|
-
makeModelTreeBrowser(treeNode as any);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
84
|
//
|
|
136
85
|
// Testing code
|
|
137
86
|
//
|
|
@@ -304,96 +253,4 @@ export class PackageFunctions {
|
|
|
304
253
|
}
|
|
305
254
|
|
|
306
255
|
|
|
307
|
-
@grok.decorators.func({
|
|
308
|
-
meta: {
|
|
309
|
-
features: '{"fitting": true, "sens-analysis": true}',
|
|
310
|
-
runOnOpen: 'true',
|
|
311
|
-
runOnInput: 'true',
|
|
312
|
-
},
|
|
313
|
-
outputs: [
|
|
314
|
-
{
|
|
315
|
-
name: 'integer',
|
|
316
|
-
type: 'int',
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
name: 'float1',
|
|
320
|
-
type: 'double',
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
name: 'float2',
|
|
324
|
-
type: 'double',
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
name: 'table1',
|
|
328
|
-
type: 'dataframe',
|
|
329
|
-
options: {viewer: 'Line chart(block:60) | Grid(block:40)'},
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
name: 'table2',
|
|
333
|
-
type: 'dataframe',
|
|
334
|
-
options: {viewer: 'Line chart(block:60) | Grid(block:40)'},
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
description: 'Test for optimization: multiple scalars output',
|
|
338
|
-
editor: 'Compute:RichFunctionViewEditor',
|
|
339
|
-
})
|
|
340
|
-
static fitTestFunc(
|
|
341
|
-
@grok.decorators.param({options: {caption: 'param1', min: '-3', max: '3', initialValue: '1'}}) x1: number,
|
|
342
|
-
@grok.decorators.param({options: {caption: 'param2', min: '-3', max: '3', initialValue: '-1'}}) x2: number,
|
|
343
|
-
@grok.decorators.param({options: {caption: 'table'}}) y: DG.DataFrame,
|
|
344
|
-
bool: boolean) {
|
|
345
|
-
return {
|
|
346
|
-
integer: x1**3 * (x1 - 1) * x2**3 * (x2 - 1),
|
|
347
|
-
float1: (x2 - 1)**2 + (x1 - 1)**2,
|
|
348
|
-
float2: (x2 - 1)**4 + (x1 - 1)**4,
|
|
349
|
-
table1: DG.DataFrame.fromColumns([
|
|
350
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'arg', [1, 2, 3, 4, 5]),
|
|
351
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'func', [x1 + x2 + 1, 4, 9, 16, 25]),
|
|
352
|
-
]),
|
|
353
|
-
table2: DG.DataFrame.fromColumns([
|
|
354
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'arg', [1, 2, 3, 4, 5]),
|
|
355
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'func', [x1 + x2 + 1, 8, 27, 64, 125]),
|
|
356
|
-
]),
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
@grok.decorators.func({description: 'Test for optimization: multiple scalars output'})
|
|
362
|
-
static async testFittingOutputs() {
|
|
363
|
-
const func = await grok.functions.find('Compute:fitTestFunc');
|
|
364
|
-
|
|
365
|
-
if (func === null) {
|
|
366
|
-
grok.shell.error('The function "Compute:fitTestFunc" not found!');
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const targetDf1 = DG.DataFrame.fromColumns([
|
|
371
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'arg', [1, 2, 3, 4, 5]),
|
|
372
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'func', [1, 4.3, 9.1, 16, 25]),
|
|
373
|
-
]);
|
|
374
|
-
targetDf1.name = 'test-df1';
|
|
375
|
-
|
|
376
|
-
const targetDf2 = DG.DataFrame.fromColumns([
|
|
377
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'arg', [1, 2, 3, 4, 5]),
|
|
378
|
-
DG.Column.fromList(DG.COLUMN_TYPE.FLOAT, 'func', [1, 8.5, 27.6, 64.9, 125]),
|
|
379
|
-
]);
|
|
380
|
-
targetDf2.name = 'test-df2';
|
|
381
|
-
|
|
382
|
-
await FittingView.fromEmpty(func as any, {
|
|
383
|
-
targets: {
|
|
384
|
-
integer: {default: 123, enabled: true},
|
|
385
|
-
float1: {default: 456.789, enabled: true},
|
|
386
|
-
table1: {
|
|
387
|
-
default: targetDf1,
|
|
388
|
-
enabled: true,
|
|
389
|
-
argumentCol: 'arg',
|
|
390
|
-
},
|
|
391
|
-
table2: {
|
|
392
|
-
default: targetDf2,
|
|
393
|
-
enabled: true,
|
|
394
|
-
argumentCol: 'arg',
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
});
|
|
398
|
-
}
|
|
399
256
|
}
|
package/dist/148.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var compute;(()=>{"use strict";var t,e,n={241:(t,e,n)=>{n.d(e,{t:()=>i});var o=function(t,e,n,o){return new(n||(n=Promise))(function(a,r){function i(t){try{s(o.next(t))}catch(t){r(t)}}function l(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(i,l)}s((o=o.apply(t,e||[])).next())})};function a(t,e,n,o){for(let a=0;a<e;a++){let r=0;for(let t=0;t<e+1;t++)t!=n&&(r+=o[t][a]);t[a]=r/e}}function r(t,e,n,o,a,r){for(let i=0;i<r;i++)e[i]=t[i],e[i]+=a*(t[i]-o[n][i])}new Map([["tolerance",{default:1e-6,min:1e-20,max:.1,caption:"tolerance",tooltipText:"How precise the result should be. Lower value = more accurate result, but longer computation",inputType:"Float"}],["maxIter",{default:50,min:1,max:1e4,caption:"max iterations",tooltipText:"Maximum number of iterations. Higher = better fit",inputType:"Int"}],["nonZeroParam",{default:1e-4,min:1e-20,max:.1,caption:"non-zero param",tooltipText:"Minimum parameter value (to avoid zero values)",inputType:"Float"}],["initialScale",{default:.02,min:1e-20,max:.1,caption:"initial scale",tooltipText:"Size of the initial search area. Higher value = wider search area",inputType:"Float"}],["scaleReflaction",{default:1,min:1,max:2,caption:"scale reflection",tooltipText:"How far the algorithm 'bounces back' from failed attempts",inputType:"Float"}],["scaleExpansion",{default:2,min:1,max:2,caption:"scale expansion",tooltipText:"How much the algorithm expands search in a promising direction",inputType:"Float"}],["scaleContraction",{default:-.5,min:-.5,max:0,caption:"scale contraction",tooltipText:"How much the algorithm narrows the search area when approaching the result",inputType:"Float"}]]);const i=function(t,e,n,i){return o(this,void 0,void 0,function*(){var l,s,c,u;const f=n.get("tolerance"),p=n.get("maxIter"),m=n.get("scaleReflaction"),E=n.get("scaleExpansion"),I=n.get("scaleContraction"),h=e.length+1,T=e.length,A=2*(null!==(l=yield t(e))&&void 0!==l?l:1/0),[d,S]=yield function(t,e,n,a){return o(this,void 0,void 0,function*(){var o;const r=n.length+1,i=n.length,l=e.get("nonZeroParam"),s=e.get("initialScale"),c=new Array(r),u=new Array(r);for(let e=0;e<r;e++){c[e]=new Float64Array(i);for(let t=0;t<i;t++)c[e][t]=n[t],0!=e&&e-1===t&&(0==n[t]?c[e][t]=l:c[e][t]+=s*n[e-1]);u[e]=null!==(o=yield t(c[e]))&&void 0!==o?o:a}return[c,u]})}(t,n,e,A),g=new Array(h);for(let t=0;t<h;t++)g[t]=t;const L=g.length-1;let _=0,v=0,M=0,R=0;const O=new Float64Array(T),y=new Float64Array(T),w=new Float64Array(T),D=new Float64Array(T),x=new Array(p);if(h>1){for(;g.sort((t,e)=>S[t]-S[e]),!(_>p);){if(0==_&&(v=S[0],M=2*S[g[0]]),x[_]=v,++_,v=S[g[0]],M-v>f)R=0;else if(++R,R>2*h)break;if(null!=i&&v<=i)break;M=v,a(O,T,g[L],d),r(O,y,g[L],d,m,T);const e=null!==(s=yield t(y))&&void 0!==s?s:A;if(e<S[g[L]]){r(O,w,g[L],d,E,T);const n=null!==(c=yield t(w))&&void 0!==c?c:A;if(n<e){S[g[L]]=n;for(let t=0;t<T;t++)d[g[L]][t]=w[t];continue}S[g[L]]=e;for(let t=0;t<T;t++)d[g[L]][t]=y[t];continue}r(O,D,g[L],d,I,T);const n=null!==(u=yield t(D))&&void 0!==u?u:A;if(!(n<S[g[L]]))break;S[g[L]]=n;for(let t=0;t<T;t++)d[g[L]][t]=D[t]}for(let t=_;t<p;t++)x[t]=S[g[0]]}return{point:d[g[0]],cost:S[g[0]],iterCosts:x,iterCount:_-1}})}},4204:(t,e,n)=>{var o,a,r,i,l,s,c,u,f,p;n.d(e,{YI:()=>a,_z:()=>m,eJ:()=>E}),function(t){t.NELDER_MEAD="Nelder-Mead",t.GRAD_DESC="Gradient descent"}(o||(o={})),new Map([[o.NELDER_MEAD,"The Nelder-Mead method"],[o.GRAD_DESC,"The gradient descent method"]]),function(t){t.MAD="MAD",t.RMSE="RMSE"}(a||(a={})),new Map([[a.MAD,"Maximum Absolute Deviation (MAD) - measures only the single largest deviation, ignoring smaller deviations"],[a.RMSE,"Root Mean Square Error (RMSE) - measures average deviation, penalizing larger deviations more heavily"]]),function(t){t[t.LOSS_COL_WIDTH=60]="LOSS_COL_WIDTH",t[t.ROW_HEIGHT=280]="ROW_HEIGHT",t[t.LOSS_GRAPH_WIDTH=320]="LOSS_GRAPH_WIDTH",t[t.GOF_VIEWER_WIDTH=320]="GOF_VIEWER_WIDTH",t[t.RADAR_WIDTH=280]="RADAR_WIDTH",t[t.BAR_HEIGHT=100]="BAR_HEIGHT"}(r||(r={})),function(t){t.ITER="Iteration",t.LOSS="Loss",t.LOSS_GRAPH="Fitting profile",t.TARGET="Target",t.FIT="Fit",t.METHOD="method",t.VALUE="Value",t.OBJECTIVE="Target",t.SAMPLES="initial points",t.ID="id",t.OBTAINED="Simulation",t.LOSS_LOW="loss",t.SIMILARITY="similarity"}(i||(i={})),function(t){t.GOAL="`Goal`",t.FIT="`Fit`",t.MIN="`min`",t.MAX="`max`",t.TARGET="`Target`",t.METHOD="`method`",t.CONTEXT="`Context Panel (F4)`",t.SAMPLES="`initial points`",t.LOSS="`loss`",t.SIMILARITY="`similarity`"}(l||(l={})),function(t){t[t.MS_TO_SLEEP=5]="MS_TO_SLEEP",t[t.STYLE_TIMEOUT=3e3]="STYLE_TIMEOUT",t[t.RADAR=200]="RADAR"}(s||(s={})),function(t){t[t.SIMILARITY_MIN=0]="SIMILARITY_MIN",t[t.SIMILARITY_MAX=100]="SIMILARITY_MAX",t[t.SIMILARITY_DEFAULT=10]="SIMILARITY_DEFAULT",t[t.SAMPLES=10]="SAMPLES"}(c||(c={})),function(t){t[t.SINGLE_VAL=0]="SINGLE_VAL",t[t.SINGLE_CAT=1]="SINGLE_CAT",t[t.DOUBLE_VAL1=0]="DOUBLE_VAL1",t[t.DOUBLE_VAL2=1]="DOUBLE_VAL2",t[t.DOUBLE_CAT=2]="DOUBLE_CAT",t[t.DIFF_STUDIO_OUTPUT=0]="DIFF_STUDIO_OUTPUT",t[t.SCALAR_VALS_COL=1]="SCALAR_VALS_COL",t[t.OLIVE=8]="OLIVE",t[t.LIGHT_OLIVE=16]="LIGHT_OLIVE",t[t.GREY=7]="GREY",t[t.LIGHT_GREY=15]="LIGHT_GREY",t[t.BLUE=0]="BLUE",t[t.ORANGE=1]="ORANGE"}(u||(u={})),function(t){t.CATEGORY="__Category__",t.SIZE="__Size__",t.SIMULATION="Simulation",t.TARGET="Target",t.SCALARS="Scalars",t.NULL="Null"}(f||(f={})),function(t){t[t.LINE_CHART_LINE_WIDTH=2]="LINE_CHART_LINE_WIDTH",t[t.SIMULATION=1]="SIMULATION",t[t.TARGET=2]="TARGET",t[t.MIN_MARKER=1]="MIN_MARKER",t[t.MAX_MARKER=7]="MAX_MARKER",t[t.LIGHTER_PERC=50]="LIGHTER_PERC"}(p||(p={}));const m=1e-5,E=1},5925:(t,e,n)=>{n.d(e,{Uj:()=>f});var o=n(508),a=n(241),r=n(8384),i=n(4204),l=function(t,e,n,o){return new(n||(n=Promise))(function(a,r){function i(t){try{s(o.next(t))}catch(t){r(t)}}function l(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?a(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(i,l)}s((o=o.apply(t,e||[])).next())})};function s(t,e){const n=e.length,o=Math.min(t.length,n),a=new Uint32Array(o);let r=0,i=0,l=0;for(let s=0;s<o;++s){for(;;){if(i=Math.abs(e[r]-t[s]),++r,!(r<n)){--r;break}if(l=Math.abs(e[r]-t[s]),l>i){--r;break}i=l}a[s]=r}return a}function c(t,e,n,o,a){let r=0;const i=n.length;let l=0;const c=s(t,o),u=c.length;for(let t=0;t<i;++t){l=0;for(let n=0;n<u;++n)l=Math.max(l,Math.abs(e[t][n]-a[t][c[n]]));r=Math.max(r,l/n[t])}return r}function u(t,e,n,o,a){let r=0;const i=n.length;let l=0,c=0,u=0;const f=s(t,o),p=f.length;for(let t=0;t<i;++t){l=n[t],c=0;for(let n=0;n<p;++n)c+=Math.pow((e[t][n]-a[t][f[n]])/l,2),++u;r+=c}return Math.sqrt(r/u)}function f(t,e){return l(this,void 0,void 0,function*(){var n;const s=t.ivp2ww,f=t.pipeline,p=r.Zg+s.deqsCount+s.paramNames.length,m=new Float64Array(p),E=t.nonParamNames.concat(s.paramNames),I=t.outputNames;let h=0,T=0;for(const n of E)T=t.fixedInputsNames.indexOf(n),T>-1?m[h]=t.fixedInputsVals[T]:(T=t.variedInputNames.indexOf(n),m[h]=e[T]),++h;const A=t.variedInputNames.map(t=>E.indexOf(t)),d=t.targetNames.slice(1).map(t=>{const e=I.indexOf(t);if(e<0)throw new Error(`Inconsistent target dataframe: no ${t} column in the model's output.`);return e}),S=e.length,g=t.targetVals[0],L=t.targetVals.slice(1),_=t.scaleVals.slice(1),v=t.loss==i.YI.MAD?c:u;let M;const R=t=>l(this,void 0,void 0,function*(){for(let e=0;e<S;++e)m[A[e]]=t[e];return M=(0,o.V)(f,s,m),v(g,L,_,M[r.Wt],d.map(t=>M[t]))}),O=new Float64Array(S);for(let e=0;e<S;++e)O[e]=t.variedInpMin[e]+Math.random()*(t.variedInpMax[e]-t.variedInpMin[e]);R(O);const y=new Map(t.settingNames.map((e,n)=>[e,t.settingVals[n]])),w=t.earlyStoppingSettings.useEarlyStopping?null!==(n=t.earlyStoppingSettings.costFuncThreshold)&&void 0!==n?n:i._z:void 0;return yield(0,a.t)(R,e,y,w)})}},7148:(t,e,n)=>{var o=n(5925),a=n(8384),r=n(4204);onmessage=function(t){return e=this,n=void 0,l=function*(){var e,n;try{const i=t.data.task,l=t.data.startPoints,s=l.length,c=new Array(s),u=[];let f=0;const p=i.earlyStoppingSettings.useEarlyStopping,m=null!==(e=i.earlyStoppingSettings.stopAfter)&&void 0!==e?e:r.eJ,E=null!==(n=i.earlyStoppingSettings.costFuncThreshold)&&void 0!==n?n:r._z;for(let t=0;t<s;++t)try{const e=yield(0,o.Uj)(i,l[t]);if(u.push(e),c[t]=a.Un,p&&e.cost<=E&&(++f,f>=m))break}catch(e){c[t]=e instanceof Error?e.message:"Platform issue: in-webworker optimization failed"}postMessage({callResult:a.OW.SUCCEED,extremums:u,fitRes:c})}catch(t){postMessage({callResult:a.OW.FAILED,msg:t instanceof Error?t.message:"Platform issue: in-webworker optimization failed"})}},new((i=void 0)||(i=Promise))(function(t,o){function a(t){try{s(l.next(t))}catch(t){o(t)}}function r(t){try{s(l.throw(t))}catch(t){o(t)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i(function(t){t(n)})).then(a,r)}s((l=l.apply(e,n||[])).next())});var e,n,i,l}},8384:(t,e,n)=>{n.d(e,{OW:()=>i,Un:()=>o,Wt:()=>r,Zg:()=>a});const o="Success",a=3,r=0;var i;!function(t){t[t.SUCCEED=0]="SUCCEED",t[t.FAILED=1]="FAILED"}(i||(i={}))}},o={};function a(t){var e=o[t];if(void 0!==e)return e.exports;var r=o[t]={exports:{}};return n[t](r,r.exports,a),r.exports}a.m=n,a.x=()=>{var t=a.O(void 0,[508],()=>a(7148));return a.O(t)},t=[],a.O=(e,n,o,r)=>{if(!n){var i=1/0;for(u=0;u<t.length;u++){for(var[n,o,r]=t[u],l=!0,s=0;s<n.length;s++)(!1&r||i>=r)&&Object.keys(a.O).every(t=>a.O[t](n[s]))?n.splice(s--,1):(l=!1,r<i&&(i=r));if(l){t.splice(u--,1);var c=o();void 0!==c&&(e=c)}}return e}r=r||0;for(var u=t.length;u>0&&t[u-1][2]>r;u--)t[u]=t[u-1];t[u]=[n,o,r]},a.d=(t,e)=>{for(var n in e)a.o(e,n)&&!a.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},a.f={},a.e=t=>Promise.all(Object.keys(a.f).reduce((e,n)=>(a.f[n](t,e),e),[])),a.u=t=>t+".js",a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),a.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;a.g.importScripts&&(t=a.g.location+"");var e=a.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var o=n.length-1;o>-1&&(!t||!/^http(s?):/.test(t));)t=n[o--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),a.p=t})(),(()=>{var t={148:1};a.f.i=(e,n)=>{t[e]||importScripts(a.p+a.u(e))};var e=self.webpackChunkcompute=self.webpackChunkcompute||[],n=e.push.bind(e);e.push=e=>{var[o,r,i]=e;for(var l in r)a.o(r,l)&&(a.m[l]=r[l]);for(i&&i(a);o.length;)t[o.pop()]=1;n(e)}})(),e=a.x,a.x=()=>a.e(508).then(e);var r=a.x();compute=r})();
|
|
2
|
-
//# sourceMappingURL=148.js.map
|
package/dist/148.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"148.js","mappings":"mCAAIA,ECAAC,E,wUC8FJ,SAASC,EAAaC,EAAwBC,EAAmBC,EAAmBC,GAClF,IAAK,IAAIC,EAAI,EAAGA,EAAIH,EAAWG,IAAK,CAClC,IAAIC,EAAM,EACV,IAAK,IAAIC,EAAI,EAAGA,EAAIL,EAAY,EAAGK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C,EAAEa,SACrC,IAAKH,GAAaG,IACbA,EAASC,eAAkE,WAAjDD,EAASC,cAAcC,QAAQC,gBAC5DN,EAAYG,EAASC,cAAcG,MAC/BP,GAAW,CACf,IAAIQ,EAAUL,EAASM,qBAAqB,UAC5C,GAAGD,EAAQ5L,OAEV,IADA,IAAIzB,EAAIqN,EAAQ5L,OAAS,EAClBzB,GAAK,KAAO6M,IAAc,aAAaU,KAAKV,KAAaA,EAAYQ,EAAQrN,KAAKoN,GAE3F,CAID,IAAKP,EAAW,MAAM,IAAIrF,MAAM,yDAChCqF,EAAYA,EAAUW,QAAQ,SAAU,IAAIA,QAAQ,OAAQ,IAAIA,QAAQ,QAAS,IAAIA,QAAQ,YAAa,KAC1GtD,EAAoBuD,EAAIZ,C,WCdxB,IAAIa,EAAkB,CACrB,IAAK,GAgBNxD,EAAoB0B,EAAE5L,EAAI,CAAC6L,EAASI,KAE/ByB,EAAgB7B,IAElBiB,cAAc5C,EAAoBuD,EAAIvD,EAAoBgC,EAAEL,KAK/D,IAAI8B,EAAqBC,KAA0B,oBAAIA,KAA0B,qBAAK,GAClFC,EAA6BF,EAAmBpE,KAAKuE,KAAKH,GAC9DA,EAAmBpE,KAvBCV,IACnB,IAAK+B,EAAUmD,EAAaC,GAAWnF,EACvC,IAAI,IAAIsB,KAAY4D,EAChB7D,EAAoBuB,EAAEsC,EAAa5D,KACrCD,EAAoBM,EAAEL,GAAY4D,EAAY5D,IAIhD,IADG6D,GAASA,EAAQ9D,GACdU,EAASnJ,QACdiM,EAAgB9C,EAASqD,OAAS,EACnCJ,EAA2BhF,G,KbnBxBnJ,EAAOwK,EAAoBlC,EAC/BkC,EAAoBlC,EAAI,IAChBkC,EAAoBV,EAAE,KAAK0E,KAAKxO,GcDxC,IAAI+K,EAAsBP,EAAoBlC,I","sources":["webpack://compute/webpack/runtime/chunk loaded","webpack://compute/webpack/runtime/startup chunk dependencies","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/fitting/optimizer-nelder-mead.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/fitting/constants.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/fitting/diff-studio/fitting-utils.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/fitting/diff-studio/workers/basic.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/fitting/diff-studio/defs.ts","webpack://compute/webpack/bootstrap","webpack://compute/webpack/runtime/define property getters","webpack://compute/webpack/runtime/ensure chunk","webpack://compute/webpack/runtime/get javascript chunk filename","webpack://compute/webpack/runtime/global","webpack://compute/webpack/runtime/hasOwnProperty shorthand","webpack://compute/webpack/runtime/publicPath","webpack://compute/webpack/runtime/importScripts chunk loading","webpack://compute/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn __webpack_require__.e(508).then(next);\n};","import {Extremum, IOptimizer, Setting} from './optimizer-misc';\n\n/** The Nelder Mead seetings vals */\nexport const nelderMeadSettingsOpts = new Map<string, Setting>([\n ['tolerance', {\n default: 0.000001,\n min: 1e-20,\n max: 1e-1,\n caption: 'tolerance',\n tooltipText: 'How precise the result should be. Lower value = more accurate result, but longer computation',\n inputType: 'Float',\n }],\n ['maxIter', {\n default: 50,\n min: 1,\n max: 10000,\n caption: 'max iterations',\n tooltipText: 'Maximum number of iterations. Higher = better fit',\n inputType: 'Int',\n }],\n ['nonZeroParam', {\n default: 0.0001,\n min: 1e-20,\n max: 1e-1,\n caption: 'non-zero param',\n tooltipText: 'Minimum parameter value (to avoid zero values)',\n inputType: 'Float',\n }],\n ['initialScale', {\n default: 0.02,\n min: 1e-20,\n max: 1e-1,\n caption: 'initial scale',\n tooltipText: 'Size of the initial search area. Higher value = wider search area',\n inputType: 'Float',\n }],\n ['scaleReflaction', {\n default: 1,\n min: 1,\n max: 2,\n caption: 'scale reflection',\n tooltipText: 'How far the algorithm \\'bounces back\\' from failed attempts',\n inputType: 'Float',\n }],\n ['scaleExpansion', {\n default: 2,\n min: 1,\n max: 2,\n caption: 'scale expansion',\n tooltipText: 'How much the algorithm expands search in a promising direction',\n inputType: 'Float',\n }],\n ['scaleContraction', {\n default: -0.5,\n min: -0.5,\n max: 0,\n caption: 'scale contraction',\n tooltipText: 'How much the algorithm narrows the search area when approaching the result',\n inputType: 'Float',\n }],\n]);\n\nasync function getInitialParams(\n objectiveFunc: (x: Float64Array) => Promise<number|undefined>,\n settings: Map<string, number>,\n paramsInitial: Float64Array,\n costOutside: number,\n): Promise<[Float64Array[], number[]]> {\n const dim = paramsInitial.length + 1;\n const dimParams = paramsInitial.length;\n const nonZeroParam = settings.get('nonZeroParam')!;\n const initScale = settings.get('initialScale')!;\n\n const optParams = new Array<Float64Array>(dim);\n const pointObjectives = new Array<number>(dim);\n\n for (let i = 0; i < dim; i++) {\n optParams[i] = new Float64Array(dimParams);\n for (let j = 0; j < dimParams; j++) {\n optParams[i][j] = paramsInitial[j];\n if (i != 0 && i - 1 === j) {\n if (paramsInitial[j] == 0)\n optParams[i][j] = nonZeroParam;\n else\n optParams[i][j] += initScale * paramsInitial[i - 1];\n }\n }\n\n pointObjectives[i] = await objectiveFunc(optParams[i]) ?? costOutside;\n }\n\n return [optParams, pointObjectives];\n}\n\nfunction fillCentroid(centroid: Float64Array, dimParams: number, lastIndex: number, optParams: Float64Array[]) {\n for (let i = 0; i < dimParams; i++) {\n let val = 0;\n for (let j = 0; j < dimParams + 1; j++) {\n if (j != lastIndex)\n val += optParams[j][i];\n }\n\n centroid[i] = val / dimParams;\n }\n}\n\nfunction fillPoint(\n centroid: Float64Array, point: Float64Array,\n lastIndex: number, optParams: Float64Array[],\n scale: number, dimParams: number,\n) {\n for (let i = 0; i < dimParams; i++) {\n point[i] = centroid[i];\n point[i] += scale * (centroid[i] - optParams[lastIndex][i]);\n }\n}\n\nexport const optimizeNM: IOptimizer = async function(\n objectiveFunc: (x: Float64Array) => Promise<number|undefined>,\n paramsInitial: Float64Array,\n settings: Map<string, number>,\n threshold?: number,\n) : Promise<Extremum> {\n // Settings initialization\n const tolerance = settings.get('tolerance')!;\n const maxIter = settings.get('maxIter')!;\n const scaleReflection = settings.get('scaleReflaction')!;\n const scaleExpansion = settings.get('scaleExpansion')!;\n const scaleContraction = settings.get('scaleContraction')!;\n\n const dim = paramsInitial.length + 1;\n const dimParams = paramsInitial.length;\n\n const costOutside = 2*(await objectiveFunc(paramsInitial) ?? Infinity);\n\n const [optParams, pointObjectives] =\n await getInitialParams(objectiveFunc, settings, paramsInitial, costOutside);\n\n const indexes = new Array<number>(dim);\n for (let i = 0; i < dim; i++)\n indexes[i] = i;\n\n const lastIndex = indexes.length - 1;\n\n let iteration = 0;\n let best = 0;\n let previousBest = 0;\n let noImprovment = 0;\n\n const centroid = new Float64Array(dimParams);\n const reflectionPoint = new Float64Array(dimParams);\n const expansionPoint = new Float64Array(dimParams);\n const contractionPoint = new Float64Array(dimParams);\n const costs = new Array<number>(maxIter);\n\n if (dim > 1) {\n while (true) {\n indexes.sort((a:number, b:number) => {\n return pointObjectives[a] - pointObjectives[b];\n });\n if (iteration > maxIter)\n break;\n\n if (iteration == 0) {\n best = pointObjectives[0];\n previousBest = 2*pointObjectives[indexes[0]];\n }\n costs[iteration] = best;\n\n ++iteration;\n\n best = pointObjectives[indexes[0]];\n if (previousBest - best > tolerance)\n noImprovment = 0;\n else {\n ++noImprovment;\n if (noImprovment > 2 * dim)\n break;\n }\n\n if (threshold != null) {\n if (best <= threshold)\n break;\n }\n\n previousBest = best;\n\n //centroid\n fillCentroid(centroid, dimParams, indexes[lastIndex], optParams);\n\n // reflection\n fillPoint(centroid, reflectionPoint, indexes[lastIndex],\n optParams, scaleReflection, dimParams);\n const reflectionScore = await objectiveFunc(reflectionPoint) ?? costOutside;\n\n // expansion\n if (reflectionScore < pointObjectives[indexes[lastIndex]]) {\n fillPoint(centroid, expansionPoint, indexes[lastIndex],\n optParams, scaleExpansion, dimParams);\n\n const expansionScore = await objectiveFunc(expansionPoint) ?? costOutside;\n\n if (expansionScore < reflectionScore) {\n pointObjectives[indexes[lastIndex]] = expansionScore;\n\n for (let i = 0; i < dimParams; i++)\n optParams[indexes[lastIndex]][i] = expansionPoint[i];\n\n continue;\n } else {\n pointObjectives[indexes[lastIndex]] = reflectionScore;\n\n for (let i = 0; i < dimParams; i++)\n optParams[indexes[lastIndex]][i] = reflectionPoint[i];\n\n continue;\n }\n }\n\n // Contraction\n fillPoint(centroid, contractionPoint, indexes[lastIndex],\n optParams, scaleContraction, dimParams);\n\n const contractionScore = await objectiveFunc(contractionPoint) ?? costOutside;\n\n if (contractionScore < pointObjectives[indexes[lastIndex]]) {\n pointObjectives[indexes[lastIndex]] = contractionScore;\n\n for (let i = 0; i < dimParams; i++)\n optParams[indexes[lastIndex]][i] = contractionPoint[i];\n\n continue;\n }\n\n break;\n }\n\n for (let i = iteration; i < maxIter; i++)\n costs[i] = pointObjectives[indexes[0]];\n }\n\n return {\n point: optParams[indexes[0]],\n cost: pointObjectives[indexes[0]],\n iterCosts: costs,\n iterCount: iteration - 1,\n };\n};\n","/* eslint-disable max-len */\n// Specific optimization constants and definitions\n\nexport enum METHOD {\n NELDER_MEAD = 'Nelder-Mead',\n GRAD_DESC = 'Gradient descent',\n };\n\nexport const methodTooltip = new Map([\n [METHOD.NELDER_MEAD, 'The Nelder-Mead method'],\n [METHOD.GRAD_DESC, 'The gradient descent method'],\n]);\n\nexport enum LOSS {\n MAD = 'MAD',\n RMSE = 'RMSE',\n };\n\nexport const lossTooltip = new Map([\n [LOSS.MAD, 'Maximum Absolute Deviation (MAD) - measures only the single largest deviation, ignoring smaller deviations'],\n [LOSS.RMSE, 'Root Mean Square Error (RMSE) - measures average deviation, penalizing larger deviations more heavily'],\n]);\n\n/** Grid elements sizes */\nexport enum GRID_SIZE {\n LOSS_COL_WIDTH = 60,\n ROW_HEIGHT = 280,\n LOSS_GRAPH_WIDTH = 320,\n GOF_VIEWER_WIDTH = 320,\n RADAR_WIDTH = 280,\n BAR_HEIGHT = 100,\n}\n\n/** UI titles */\nexport enum TITLE {\n ITER = 'Iteration',\n LOSS = 'Loss',\n LOSS_GRAPH = 'Fitting profile',\n TARGET = 'Target',\n FIT = 'Fit',\n METHOD = 'method',\n VALUE = 'Value',\n OBJECTIVE = TARGET,\n SAMPLES = 'initial points',\n ID = 'id',\n OBTAINED = 'Simulation',\n LOSS_LOW = 'loss',\n SIMILARITY = 'similarity',\n };\n\n/** Items for the fitting help */\nenum HELP_ITEMS {\n GOAL = '`Goal`',\n FIT = '`' + TITLE.FIT + '`',\n MIN = '`min`',\n MAX = '`max`',\n TARGET = '`' + TITLE.TARGET + '`',\n METHOD = '`' + TITLE.METHOD + '`',\n CONTEXT = '`Context Panel (F4)`',\n SAMPLES = '`' + TITLE.SAMPLES + '`',\n LOSS = '`' + TITLE.LOSS_LOW + '`',\n SIMILARITY = '`' + TITLE.SIMILARITY + '`',\n};\n\nexport enum TIMEOUT {\n MS_TO_SLEEP = 5,\n STYLE_TIMEOUT = 3000,\n RADAR = 200,\n};\n\n/** Fitting UI constants */\nexport enum FITTING_UI {\n SIMILARITY_MIN = 0,\n SIMILARITY_MAX = 100, // %\n SIMILARITY_DEFAULT = 10, // %\n SAMPLES = 10,\n};\n\nexport const HELP_LINK = 'https://datagrok.ai/help/compute/function-analysis#parameter-optimization';\n\n/** Starting help markdown */\nexport const STARTING_HELP = `# Fitting\n\nUse fitting to solve an inverse problem: find input conditions leading to specified output constraints.\nIt computes inputs minimizing deviation measured by [loss function](https://en.wikipedia.org/wiki/Loss_function).\n\n1. In the ${HELP_ITEMS.FIT} block, use switchers to specify inputs to be found:\n * Set ${HELP_ITEMS.MIN} and ${HELP_ITEMS.MAX} values for each selected item. They define the variation range\n * Set values of all other inputs\n\n2. Set output constraints in the ${HELP_ITEMS.TARGET} block:\n * Use switchers to specify target outputs\n * Set target value for each selected item\n\n3. Choose ${HELP_ITEMS.METHOD}. Press <i class=\"grok-icon fal fa-cog\"></i> to specify its settings.\n\n4. Press the \"Run\" icon <i class=\"fas fa-play\"></i> on the top panel to perform fitting. You will get a\n[grid](https://datagrok.ai/help/visualize/viewers/grid) containing\n\n * loss function values\n * fitted inputs\n * viewers visualizing the goodness of fit:\n * [line chart](https://datagrok.ai/help/visualize/viewers/line-chart) showing the loss function minimization\n\n5. Open ${HELP_ITEMS.CONTEXT}. You will get the function run corresponding to the selected grid row.\n\n6. Press **?** on the top panel to learn more about\n[parameters optimization](${HELP_LINK}).\n\n# Learn more\n\n* [Parameters optimization](${HELP_LINK})\n* [Nelder-Mead method](https://en.wikipedia.org/wiki/Nelder%E2%80%93Mead_method)`;\n\nexport enum INDICES {\n SINGLE_VAL = 0,\n SINGLE_CAT = 1,\n DOUBLE_VAL1 = 0,\n DOUBLE_VAL2 = 1,\n DOUBLE_CAT = 2,\n DIFF_STUDIO_OUTPUT = 0,\n SCALAR_VALS_COL = 1,\n OLIVE = 8,\n LIGHT_OLIVE = 16,\n GREY = 7,\n LIGHT_GREY = 15,\n BLUE = 0,\n ORANGE = 1,\n};\n\nexport enum NAME {\n CATEGORY = '__Category__',\n SIZE = '__Size__',\n SIMULATION = 'Simulation',\n TARGET = 'Target',\n SCALARS = 'Scalars',\n NULL = 'Null',\n};\n\nexport enum SIZE {\n LINE_CHART_LINE_WIDTH = 2,\n SIMULATION = 1,\n TARGET = 2,\n MIN_MARKER = 1,\n MAX_MARKER = 7,\n LIGHTER_PERC = 50,\n};\n\n/** Info panel content */\nexport const TARGET_DATAFRAME_INFO = `1. Set a dataframe with function(s) values\n\n2. Select a column with the independent variable in the **argument** field\n\n3. Specify one or more target columns with the dependent variable(s) in the **functions** field`;\n\n/** Loss function line chart options */\nexport const LOSS_FUNC_CHART_OPTS = {\n showYAxis: true,\n showXAxis: true,\n showXSelector: true,\n showYSelectors: true,\n lineColoringType: 'custom',\n lineColor: 4288600805,\n markerColor: 4288600805,\n};\n\nexport const MIN_RADAR_COLS_COUNT = 4;\n\n/** Modulus for the linear congruential generator of random numbers */\nexport const RAND_MOD = 2147483647;\n\n/** Multiplier used in the generator of random numbers */\nexport const RAND_MULT = 16807;\n\n/** Reproducibility settings */\nexport type ReproSettings = {\n reproducible: boolean,\n seed: number,\n};\n\nexport const REPRO_DEFAULT = true;\nexport const SEED_DEFAULT = 10;\n\n/** Early stopping settings */\nexport type EarlyStoppingSettings = {\n useEarlyStopping: boolean,\n costFuncThreshold: number,\n stopAfter: number,\n};\n\nexport const EARLY_STOP_DEFAULT = false;\nexport const COST_FUNC_THRESH = 1e-5;\nexport const STOP_AFTER_DEFAULT = 1;\nexport const STOP_AFTER_MIN = 1;\n","/* eslint-disable valid-jsdoc */\nimport {IVP, IVP2WebWorker, solveIvp, applyPipeline} from 'diff-grok';\nimport {optimizeNM} from '../optimizer-nelder-mead';\nimport {ARG_COL_IDX, ARG_INP_COUNT, NelderMeadInput} from './defs';\nimport {Extremum} from '../optimizer-misc';\nimport {COST_FUNC_THRESH, LOSS} from '../constants';\n\n/** Return true if in-worker fitting is applicable */\nexport function isWorkerApplicable(ivp: IVP | undefined, ivpWW: IVP2WebWorker | undefined): boolean {\n if ((ivp === undefined) || (ivpWW === undefined))\n return false;\n\n return (ivp.loop === null) && (ivp.updates === null) && (ivp.outputs === null);\n}\n\n/** Returns indices corresponding to the closest items */\nfunction getIndices(targetArg: Float64Array, modelArg: Float64Array): Uint32Array {\n const modelCount = modelArg.length;\n const elemsCount = Math.min(targetArg.length, modelCount);\n const indices = new Uint32Array(elemsCount);\n let idxModel = 0;\n let difPrev = 0;\n let difCur = 0;\n\n for (let idxExp = 0; idxExp < elemsCount; ++idxExp) {\n while (true) {\n difPrev = Math.abs(modelArg[idxModel] - targetArg[idxExp]);\n ++idxModel;\n\n if (idxModel < modelCount) {\n difCur = Math.abs(modelArg[idxModel] - targetArg[idxExp]);\n\n if (difCur > difPrev) {\n --idxModel;\n break;\n } else\n difPrev = difCur;\n } else {\n --idxModel;\n break;\n }\n }\n\n indices[idxExp] = idxModel;\n }\n\n return indices;\n}; // getIndices\n\n/** Maximum absolute deviation */\nexport function mad(targetArg: Float64Array, targetFuncs: Float64Array[], scaleVals: Float64Array,\n modelArg: Float64Array, modelFuncs: Float64Array[]): number {\n let res = 0;\n const dim = scaleVals.length;\n let localMax = 0;\n\n const indices = getIndices(targetArg, modelArg);\n const argsCount = indices.length;\n\n for (let i = 0; i < dim; ++i) {\n localMax = 0;\n\n for (let k = 0; k < argsCount; ++k)\n localMax = Math.max(localMax, Math.abs(targetFuncs[i][k] - modelFuncs[i][indices[k]]));\n\n res = Math.max(res, localMax / scaleVals[i]);\n }\n\n return res;\n} // mad\n\n/** Root mean square error */\nexport function rmse(targetArg: Float64Array, targetFuncs: Float64Array[], scaleVals: Float64Array,\n modelArg: Float64Array, modelFuncs: Float64Array[]): number {\n let res = 0;\n const dim = scaleVals.length;\n let scale = 0;\n let sum = 0;\n let valsCount = 0;\n\n const indices = getIndices(targetArg, modelArg);\n const argsCount = indices.length;\n\n for (let i = 0; i < dim; ++i) {\n scale = scaleVals[i];\n sum = 0;\n\n for (let k = 0; k < argsCount; ++k) {\n sum += ((targetFuncs[i][k] - modelFuncs[i][indices[k]]) / scale)**2;\n ++valsCount;\n }\n\n res += sum;\n }\n\n return Math.sqrt(res / valsCount);\n} // rmse\n\n/** Return points splitted into batches */\nexport function getBatches(points: Float64Array[], batchesCount: number): Float64Array[][] {\n const batches = new Array<Float64Array[]>(batchesCount);\n const samplesCount = points.length;\n const chunkSize = Math.floor(samplesCount / batchesCount);\n let remainder = samplesCount % batchesCount;\n\n let start = 0;\n for (let i = 0; i < batchesCount; i++) {\n const extra = remainder > 0 ? 1 : 0;\n batches[i] = points.slice(start, start + chunkSize + extra);\n start += chunkSize + extra;\n --remainder;\n }\n\n return batches;\n} // getBatches\n\n/** Perform Neldel-Mead optimization */\nexport async function fit(task: NelderMeadInput, start: Float64Array): Promise<Extremum> {\n const ivp = task.ivp2ww;\n const pipeline = task.pipeline;\n const inputSize = ARG_INP_COUNT + ivp.deqsCount + ivp.paramNames.length;\n const ivpInputVals = new Float64Array(inputSize);\n const ivpInputNames = task.nonParamNames.concat(ivp.paramNames);\n const funcNames = task.outputNames;\n //task.nonParamNames.slice(ARG_INP_COUNT - 1);\n\n let idx = 0;\n let cur = 0;\n\n for (const name of ivpInputNames) {\n cur = task.fixedInputsNames.indexOf(name);\n if (cur > -1)\n ivpInputVals[idx] = task.fixedInputsVals[cur];\n else {\n cur = task.variedInputNames.indexOf(name);\n ivpInputVals[idx] = start[cur];\n }\n ++idx;\n }\n\n const inpIndex = task.variedInputNames.map((name) => ivpInputNames.indexOf(name));\n\n const outIndex = task.targetNames.slice(1).map((name) => {\n const idx = funcNames.indexOf(name);\n\n if (idx < 0)\n throw new Error(`Inconsistent target dataframe: no ${name} column in the model's output.`);\n\n return idx;\n });\n\n const dim = start.length;\n const targetArgVals = task.targetVals[0];\n const targetFuncVals = task.targetVals.slice(1);\n const scaleVals = task.scaleVals.slice(1);\n\n const metric = (task.loss == LOSS.MAD) ? mad : rmse;\n\n let solution: Float64Array[];\n\n const costFunc = async (x: Float64Array): Promise<number> => {\n for (let i = 0; i < dim; ++i)\n ivpInputVals[inpIndex[i]] = x[i];\n\n //solution = solveIvp(ivp, ivpInputVals);\n solution = applyPipeline(pipeline, ivp, ivpInputVals);\n\n return metric(\n targetArgVals,\n targetFuncVals,\n scaleVals,\n solution[ARG_COL_IDX],\n outIndex.map((idx) => solution[idx]),\n );\n };\n\n const vec = new Float64Array(dim);\n\n for (let i = 0; i < dim; ++i)\n vec[i] = task.variedInpMin[i] + Math.random() * (task.variedInpMax[i] - task.variedInpMin[i]);\n\n costFunc(vec);\n\n const settings = new Map<string, number>(task.settingNames.map((name, idx) => [name, task.settingVals[idx]]));\n\n const threshold = task.earlyStoppingSettings.useEarlyStopping ?\n (task.earlyStoppingSettings.costFuncThreshold ?? COST_FUNC_THRESH) :\n undefined;\n\n const res = await optimizeNM(costFunc, start, settings, threshold);\n\n return res;\n} // fit\n","// Worker for optimization of parameters of Diff Studio model\n\nimport {Extremum} from '../../optimizer-misc';\nimport {fit} from '../fitting-utils';\nimport {NO_ERRORS, NelderMeadInput, RESULT_CODE} from '../defs';\nimport {COST_FUNC_THRESH, STOP_AFTER_DEFAULT} from '../../constants';\n\nonmessage = async function(evt) {\n try {\n const task = evt.data.task as NelderMeadInput;\n const startPoints = evt.data.startPoints as Float64Array[];\n const pointsCount = startPoints.length;\n const fitRes = new Array<string>(pointsCount);\n const extremums: Extremum[] = [];\n let validPoints = 0;\n const checkValidPoints = task.earlyStoppingSettings.useEarlyStopping;\n const maxValidPoints = task.earlyStoppingSettings.stopAfter ?? STOP_AFTER_DEFAULT;\n const threshold = task.earlyStoppingSettings.costFuncThreshold ?? COST_FUNC_THRESH;\n\n for (let i = 0; i < pointsCount; ++i) {\n try {\n const extremum = await fit(task, startPoints[i]);\n extremums.push(extremum);\n fitRes[i] = NO_ERRORS;\n\n if (checkValidPoints) {\n if (extremum.cost <= threshold) {\n ++validPoints;\n\n if (validPoints >= maxValidPoints)\n break;\n }\n }\n } catch (e) {\n fitRes[i] = e instanceof Error ? e.message : 'Platform issue: in-webworker optimization failed';\n }\n }\n\n postMessage({'callResult': RESULT_CODE.SUCCEED, 'extremums': extremums, 'fitRes': fitRes});\n } catch (e) {\n postMessage({\n 'callResult': RESULT_CODE.FAILED,\n 'msg': e instanceof Error ? e.message : 'Platform issue: in-webworker optimization failed',\n });\n }\n};\n","import {IVP2WebWorker, Pipeline} from 'diff-grok';\nimport {EarlyStoppingSettings} from '../constants';\n\nexport const ARG_IDX = 0;\nexport const NO_ERRORS = 'Success';\n\nexport const DEFAULT_SET_VAL = 0;\nexport const MIN_TARGET_COLS_COUNT = 2;\nexport const ARG_INP_COUNT = 3;\nexport const ARG_COL_IDX = 0;\n\nexport const MIN_WORKERS_COUNT = 1;\nexport const WORKERS_COUNT_DOWNSHIFT = 2;\n\nexport enum RESULT_CODE {\n SUCCEED = 0,\n FAILED = 1,\n};\n\n/** Nelder-Mead input for optimization in workers */\nexport type NelderMeadInput = {\n settingNames: string[],\n settingVals: number[],\n loss: string,\n ivp2ww: IVP2WebWorker,\n pipeline: Pipeline,\n nonParamNames: string[],\n fixedInputsNames: string[],\n fixedInputsVals: number[],\n variedInputNames: string[],\n variedInpMin: Float64Array,\n variedInpMax: Float64Array,\n targetNames: string[],\n targetVals: Array<Float64Array>,\n scaleVals: Float64Array,\n samplesCount: number,\n outputNames: string[],\n earlyStoppingSettings: EarlyStoppingSettings,\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [508], () => (__webpack_require__(7148)))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t148: 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunkcompute\"] = self[\"webpackChunkcompute\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n"],"names":["deferred","next","fillCentroid","centroid","dimParams","lastIndex","optParams","i","val","j","fillPoint","point","scale","Map","default","min","max","caption","tooltipText","inputType","optimizeNM","objectiveFunc","paramsInitial","settings","threshold","tolerance","get","maxIter","scaleReflection","scaleExpansion","scaleContraction","dim","length","costOutside","Infinity","pointObjectives","nonZeroParam","initScale","Array","Float64Array","getInitialParams","indexes","iteration","best","previousBest","noImprovment","reflectionPoint","expansionPoint","contractionPoint","costs","sort","a","b","reflectionScore","expansionScore","contractionScore","cost","iterCosts","iterCount","METHOD","LOSS","GRID_SIZE","TITLE","HELP_ITEMS","TIMEOUT","FITTING_UI","INDICES","NAME","SIZE","NELDER_MEAD","GRAD_DESC","MAD","RMSE","COST_FUNC_THRESH","STOP_AFTER_DEFAULT","getIndices","targetArg","modelArg","modelCount","elemsCount","Math","indices","Uint32Array","idxModel","difPrev","difCur","idxExp","abs","mad","targetFuncs","scaleVals","modelFuncs","res","localMax","argsCount","k","rmse","sum","valsCount","sqrt","fit","task","start","ivp","ivp2ww","pipeline","inputSize","deqsCount","paramNames","ivpInputVals","ivpInputNames","nonParamNames","concat","funcNames","outputNames","idx","cur","name","fixedInputsNames","indexOf","fixedInputsVals","variedInputNames","inpIndex","map","outIndex","targetNames","slice","Error","targetArgVals","targetVals","targetFuncVals","metric","loss","solution","costFunc","x","vec","variedInpMin","random","variedInpMax","settingNames","settingVals","earlyStoppingSettings","useEarlyStopping","costFuncThreshold","undefined","onmessage","evt","data","startPoints","pointsCount","fitRes","extremums","validPoints","checkValidPoints","maxValidPoints","stopAfter","extremum","push","e","message","postMessage","SUCCEED","FAILED","NO_ERRORS","ARG_INP_COUNT","ARG_COL_IDX","RESULT_CODE","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","m","__webpack_exports__","O","result","chunkIds","fn","priority","notFulfilled","fulfilled","Object","keys","every","key","splice","r","d","definition","o","defineProperty","enumerable","f","chunkId","Promise","all","reduce","promises","u","g","globalThis","this","Function","window","obj","prop","prototype","hasOwnProperty","call","scriptUrl","importScripts","location","document","currentScript","tagName","toUpperCase","src","scripts","getElementsByTagName","test","replace","p","installedChunks","chunkLoadingGlobal","self","parentChunkLoadingFunction","bind","moreModules","runtime","pop","then"],"sourceRoot":""}
|
package/dist/377.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var compute;(()=>{"use strict";var e,r,t={237:(e,r,t)=>{var n,o;t.d(r,{Q2:()=>i,YU:()=>a}),function(e){e[e.COR_PLOT=.5]="COR_PLOT",e[e.PC_PLOT=.6]="PC_PLOT",e[e.GRAPH=.6]="GRAPH",e[e.BAR_CHART=.2]="BAR_CHART"}(n||(n={})),function(e){e.METHOD="`Method`",e.SAMPLES="`Samples`"}(o||(o={}));const a=-1,i=0},4377:(e,r,t)=>{var n=t(7011),o=t(4635);onmessage=function(e){return r=this,t=void 0,i=function*(){try{const r=e.data.task,t=r.pipelines.length,a=new Array(t),i=new Array(t);for(let e=0;e<t;++e)try{a[e]=(0,o.R)({ivp2ww:r.ivp2ww,pipeline:r.pipelines[e],inputVec:r.inputVecs[e],rowIdx:r.rowIdx,argColIdx:r.argColIdx,argVal:r.argVal}),i[e]=n.Un}catch(r){i[e]=r instanceof Error?r.message:"Platform issue: in-webworker analysis failed"}postMessage({callResult:n.OW.SUCCEED,rowVals:a,analysisRes:i})}catch(e){postMessage({callResult:n.OW.FAILED,msg:e instanceof Error?e.message:"Platform issue: in-webworker analysis failed"})}},new((a=void 0)||(a=Promise))(function(e,n){function o(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i.throw(e))}catch(e){n(e)}}function c(r){var t;r.done?e(r.value):(t=r.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}c((i=i.apply(r,t||[])).next())});var r,t,a,i}},4635:(e,r,t)=>{t.d(r,{R:()=>s});var n=t(508),o=t(7011),a=t(237);function i(e,r){const t=e.length,n=new Float64Array(t);for(let o=0;o<t;++o)n[o]=e[o][r];return n}function s(e){const r=n.V(e.pipeline,e.ivp2ww,e.inputVec),t=r[0].length,s=e.rowIdx;if(s!==o.dq)switch(s){case a.Q2:return i(r,0);case a.YU:return i(r,t-1);default:throw new Error(`Incorrect row idx: ${s}`)}return i(r,function(e,r){let t,n=0,o=Math.abs(e[n]-r);for(let a=1;a<e.length;++a)t=Math.abs(e[a]-r),t<o&&(o=t,n=a);return n}(r[e.argColIdx],e.argVal))}},7011:(e,r,t)=>{t.d(r,{OW:()=>o,Un:()=>a,dq:()=>n});const n=-10;var o;!function(e){e[e.SUCCEED=0]="SUCCEED",e[e.FAILED=1]="FAILED"}(o||(o={}));const a="Success"}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,o),a.exports}o.m=t,o.x=()=>{var e=o.O(void 0,[508],()=>o(4377));return o.O(e)},e=[],o.O=(r,t,n,a)=>{if(!t){var i=1/0;for(p=0;p<e.length;p++){for(var[t,n,a]=e[p],s=!0,c=0;c<t.length;c++)(!1&a||i>=a)&&Object.keys(o.O).every(e=>o.O[e](t[c]))?t.splice(c--,1):(s=!1,a<i&&(i=a));if(s){e.splice(p--,1);var l=n();void 0!==l&&(r=l)}}return r}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[t,n,a]},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce((r,t)=>(o.f[t](e,r),r),[])),o.u=e=>e+".js",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var r=o.g.document;if(!e&&r&&(r.currentScript&&"SCRIPT"===r.currentScript.tagName.toUpperCase()&&(e=r.currentScript.src),!e)){var t=r.getElementsByTagName("script");if(t.length)for(var n=t.length-1;n>-1&&(!e||!/^http(s?):/.test(e));)e=t[n--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=e})(),(()=>{var e={377:1};o.f.i=(r,t)=>{e[r]||importScripts(o.p+o.u(r))};var r=self.webpackChunkcompute=self.webpackChunkcompute||[],t=r.push.bind(r);r.push=r=>{var[n,a,i]=r;for(var s in a)o.o(a,s)&&(o.m[s]=a[s]);for(i&&i(o);n.length;)e[n.pop()]=1;t(r)}})(),r=o.x,o.x=()=>o.e(508).then(r);var a=o.x();compute=a})();
|
|
2
|
-
//# sourceMappingURL=377.js.map
|
package/dist/377.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"377.js","mappings":"mCAAIA,ECAAC,E,iBCIJ,IAAYC,EAUPC,E,2BAVL,SAAYD,GACR,4BACA,0BACA,sBACA,6BACD,CALH,CAAYA,IAAAA,EAAU,KAUtB,SAAKC,GACH,oBACA,qBACD,CAHD,CAAKA,IAAAA,EAAU,KAKR,MA+DMC,GAAgB,EAChBC,EAAgB,C,yCC7E7BC,UAAY,SAAeC,G,qCACzB,IACE,MAAMC,EAAOD,EAAIE,KAAKD,KAChBE,EAAYF,EAAKG,UAAUC,OAC3BC,EAAU,IAAIC,MAAoBJ,GAClCK,EAAc,IAAID,MAAcJ,GAEtC,IAAK,IAAIM,EAAM,EAAGA,EAAMN,IAAaM,EACnC,IACEH,EAAQG,IAAO,OAAY,CACzBC,OAAQT,EAAKS,OACbC,SAAUV,EAAKG,UAAUK,GACzBG,SAAUX,EAAKY,UAAUJ,GACzBK,OAAQb,EAAKa,OACbC,UAAWd,EAAKc,UAChBC,OAAQf,EAAKe,SAGfR,EAAYC,GAAO,IACrB,CAAE,MAAOQ,GACPT,EAAYC,GAAOQ,aAAaC,MAAQD,EAAEE,QAAU,8CACtD,CAGFC,YAAY,CACV,WAAc,KAAYC,QAC1B,QAAWf,EACX,YAAeE,GAEnB,CAAE,MAAOS,GACPG,YAAY,CACV,WAAc,KAAYE,OAC1B,IAAOL,aAAaC,MAAQD,EAAEE,Q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qD,EAAUuD,EAAaC,GAAW7G,EACvC,IAAI,IAAI2C,KAAYiE,EAChBlE,EAAoB0B,EAAEwC,EAAajE,KACrCD,EAAoBO,EAAEN,GAAYiE,EAAYjE,IAIhD,IADGkE,GAASA,EAAQnE,GACdW,EAASlD,QACdmG,EAAgBjD,EAASyD,OAAS,EACnCL,EAA2BzG,G,KZnBxBR,EAAOkD,EAAoBQ,EAC/BR,EAAoBQ,EAAI,IAChBR,EAAoB3B,EAAE,KAAKgG,KAAKvH,GaDxC,IAAI2D,EAAsBT,EAAoBQ,I","sources":["webpack://compute/webpack/runtime/chunk loaded","webpack://compute/webpack/runtime/startup chunk dependencies","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/constants.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/workers/analysis.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/sens-analysis-utils.ts","webpack://compute/./node_modules/@datagrok-libraries/compute-utils/function-views/src/variance-based-analysis/diff-studio/defs.ts","webpack://compute/webpack/bootstrap","webpack://compute/webpack/runtime/define property getters","webpack://compute/webpack/runtime/ensure chunk","webpack://compute/webpack/runtime/get javascript chunk filename","webpack://compute/webpack/runtime/global","webpack://compute/webpack/runtime/hasOwnProperty shorthand","webpack://compute/webpack/runtime/publicPath","webpack://compute/webpack/runtime/importScripts chunk loading","webpack://compute/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn __webpack_require__.e(508).then(next);\n};","/* eslint-disable max-len */\n// Specific sensitivity analysis constants\n\n/** Dock ratios */\nexport enum DOCK_RATIO {\n COR_PLOT = 0.5,\n PC_PLOT = 0.6,\n GRAPH = PC_PLOT,\n BAR_CHART = 0.2,\n }\n\n/** Size constants */\nexport const ROW_HEIGHT = 25;\n\nenum HELP_ITEMS {\n METHOD = '`Method`',\n SAMPLES = '`Samples`',\n};\n\nexport const LOCAL_HELP = '/help/compute/function-analysis#sensitivity-analysis';\nexport const HELP_LINK = `https://datagrok.ai${LOCAL_HELP}`;\n\n/** Starting help markdown */\nexport const STARTING_HELP = `# Sensitivity Analysis\n\nSensitivity Analysis runs the computation multiple times with varying inputs, \nand analyzes the relationship between inputs and outputs.\n\nUse one of the following methods:\n\n* **Monte Carlo** explores a function \nat randomly taken points\n\n* **Sobol** decomposes output variance into fractions, which can be attributed to inputs\n\n* **Grid** studies a function at the points of a grid with the specified step\n\n## Monte Carlo\n\nOnce you've chosen it in ${HELP_ITEMS.METHOD}\n\n* Set in ${HELP_ITEMS.SAMPLES} the number of random points \n\n* Use switchers to specify varied inputs and outputs to be analyzed\n\n* Press **Run** or <i class=\"fas fa-play\"></i> on the top panel. You will get \n\n * [Correlation plot](https://datagrok.ai/help/visualize/viewers/correlation-plot) for exploring\ncorrelations between varied inputs and the specified outputs\n\n * [PC plot](https://datagrok.ai/help/visualize/viewers/pc-plot) visualizing multivariate data\nand providing variations of the selected inputs & outputs\n\n * [Line chart](https://datagrok.ai/help/visualize/viewers/line-chart) or \n[Scatterplot](https://datagrok.ai/help/visualize/viewers/scatter-plot) (dependently on the varied\ninputs count) showing a behavior of each output separately\n\n * [Grid](https://datagrok.ai/help/visualize/viewers/grid) containing inputs and outputs values \nof each function evaluation\n\n* Press **?** on the top panel to learn more about [Sensitivity Analysis](${HELP_LINK})\n\n## Sobol\n\nThis method performs \n[variance-based sensitivity analysis](https://en.wikipedia.org/wiki/Variance-based_sensitivity_analysis). \nIt provides the same visualizations \nas **Monte Carlo** and [bar charts](https://datagrok.ai/help/visualize/viewers/bar-chart) showing \nSobol' indices:\n\n* First-order indices indicate the contribution to the output variance of varying each input alone\n\n* Total-order indices measure the contribution to the output variance of each input,\n including all variance caused by its interactions with any other inputs\n \n ## Grid\n \n This method provides the same visualization as the previous ones. Unlike them, it evaluates a function \n at the points of uniform grid within the specified ranges.`;\n\nexport const DIFF_GROK_OUT_IDX = 0;\n\nexport const LAST_ROW_IDX = -1;\nexport const FIRST_ROW_IDX = 0;\nexport const NULL_RAW = -2;\n","// Worker for sensitivity analysis of Diff Studio model\n\nimport {NO_ERRORS, RESULT_CODE, WorkerTask} from '../defs';\nimport {getAnalysis} from '../sens-analysis-utils';\n\n\nonmessage = async function(evt) {\n try {\n const task = evt.data.task as WorkerTask;\n const batchSize = task.pipelines.length;\n const rowVals = new Array<Float64Array>(batchSize);\n const analysisRes = new Array<string>(batchSize);\n\n for (let idx = 0; idx < batchSize; ++idx) {\n try {\n rowVals[idx] = getAnalysis({\n ivp2ww: task.ivp2ww,\n pipeline: task.pipelines[idx],\n inputVec: task.inputVecs[idx],\n rowIdx: task.rowIdx,\n argColIdx: task.argColIdx,\n argVal: task.argVal,\n });\n\n analysisRes[idx] = NO_ERRORS;\n } catch (e) {\n analysisRes[idx] = e instanceof Error ? e.message : 'Platform issue: in-webworker analysis failed';\n }\n }\n\n postMessage({\n 'callResult': RESULT_CODE.SUCCEED,\n 'rowVals': rowVals,\n 'analysisRes': analysisRes,\n });\n } catch (e) {\n postMessage({\n 'callResult': RESULT_CODE.FAILED,\n 'msg': e instanceof Error ? e.message : 'Platform issue: in-webworker analysis failed',\n });\n }\n};\n","// Sensitivity analysis routine for Diff Studio models\n\nimport * as DGL from 'diff-grok';\nimport {AnalysisTask, DEFAULT_NUM} from './defs';\nimport {LAST_ROW_IDX, FIRST_ROW_IDX} from '../constants';\n\nfunction getSolutionRow(solution: Float64Array[], rowIdx: number): Float64Array {\n const outputsCount = solution.length;\n const result = new Float64Array(outputsCount);\n\n for (let i = 0; i < outputsCount; ++i)\n result[i] = solution[i][rowIdx];\n\n return result;\n}\n\nfunction getIndexOfClosestValue(args: Float64Array, targetVal: number): number {\n let targetIdx = 0;\n let deviation = Math.abs(args[targetIdx] - targetVal);\n let current: number;\n\n for (let curIdx = 1; curIdx < args.length; ++curIdx) {\n current = Math.abs(args[curIdx] - targetVal);\n\n if (current < deviation) {\n deviation = current;\n targetIdx = curIdx;\n }\n }\n\n return targetIdx;\n}\n\nexport function getAnalysis(task: AnalysisTask): Float64Array {\n // evaluate model\n const solution = DGL.applyPipeline(\n task.pipeline,\n task.ivp2ww,\n task.inputVec,\n );\n\n const solutionTableRowCount = solution[0].length;\n const rowIdx = task.rowIdx;\n\n // extract target row\n if (rowIdx !== DEFAULT_NUM) {\n switch (rowIdx) {\n case FIRST_ROW_IDX:\n return getSolutionRow(solution, 0);\n\n case LAST_ROW_IDX:\n return getSolutionRow(solution, solutionTableRowCount - 1);\n\n default:\n throw new Error(`Incorrect row idx: ${rowIdx}`);\n }\n }\n\n // extract row by the target argument\n const index = getIndexOfClosestValue(solution[task.argColIdx], task.argVal);\n\n return getSolutionRow(solution, index);\n}\n","// Sensitivity Analysis definitions for Diff Studio models\n\nimport {IVP2WebWorker, Pipeline} from 'diff-grok';\n\n/** Task for sensitivity analysis of Diff Studio model */\nexport type AnalysisTask = {\n ivp2ww: IVP2WebWorker,\n pipeline: Pipeline,\n inputVec: Float64Array,\n rowIdx: number,\n argColIdx: number,\n argVal: number,\n};\n\nexport const DEFAULT_NUM = -10;\nexport const MIN_WORKERS_COUNT = 1;\nexport const WORKERS_COUNT_DOWNSHIFT = 2;\n\n/** Task to pass to the workers */\nexport type WorkerTask = {\n ivp2ww: IVP2WebWorker,\n pipelines: Pipeline[],\n inputVecs: Float64Array[],\n indices: number[],\n rowIdx: number,\n argColIdx: number,\n argVal: number,\n};\n\nexport enum RESULT_CODE {\n SUCCEED = 0,\n FAILED = 1,\n};\n\nexport const NO_ERRORS = 'Success';\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [508], () => (__webpack_require__(4377)))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".js\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t377: 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunkcompute\"] = self[\"webpackChunkcompute\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n"],"names":["deferred","next","DOCK_RATIO","HELP_ITEMS","LAST_ROW_IDX","FIRST_ROW_IDX","onmessage","evt","task","data","batchSize","pipelines","length","rowVals","Array","analysisRes","idx","ivp2ww","pipeline","inputVec","inputVecs","rowIdx","argColIdx","argVal","e","Error","message","postMessage","SUCCEED","FAILED","getSolutionRow","solution","outputsCount","result","Float64Array","i","getAnalysis","solutionTableRowCount","args","targetVal","current","targetIdx","deviation","Math","abs","curIdx","getIndexOfClosestValue","DEFAULT_NUM","RESULT_CODE","NO_ERRORS","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","m","x","__webpack_exports__","O","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","Object","keys","every","key","splice","r","d","definition","o","defineProperty","enumerable","get","f","chunkId","Promise","all","reduce","promises","u","g","globalThis","this","Function","window","obj","prop","prototype","hasOwnProperty","call","scriptUrl","importScripts","location","document","currentScript","tagName","toUpperCase","src","scripts","getElementsByTagName","test","replace","p","installedChunks","chunkLoadingGlobal","self","parentChunkLoadingFunction","push","bind","moreModules","runtime","pop","then"],"sourceRoot":""}
|