@datagrok/eda 1.2.8 → 1.3.1

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/package.json CHANGED
@@ -1,96 +1,97 @@
1
1
  {
2
- "name": "@datagrok/eda",
3
- "friendlyName": "EDA",
4
- "version": "1.2.8",
5
- "description": "Exploratory Data Analysis Tools",
6
- "dependencies": {
7
- "@datagrok-libraries/math": "^1.2.3",
8
- "@datagrok-libraries/ml": "^6.7.5",
9
- "@datagrok-libraries/tutorials": "^1.4.2",
10
- "@datagrok-libraries/utils": "^4.3.0",
11
- "@keckelt/tsne": "^1.0.2",
12
- "@webgpu/types": "^0.1.40",
13
- "cash-dom": "^8.1.1",
14
- "datagrok-api": "^1.22.0",
15
- "dayjs": "^1.11.9",
16
- "jstat": "^1.9.6",
17
- "source-map-loader": "^4.0.1",
18
- "umap-js": "^1.3.3",
19
- "worker-loader": "^3.0.8"
20
- },
21
- "author": {
22
- "name": "Viktor Makarichev",
23
- "email": "vmakarichev@datagrok.ai"
24
- },
25
- "devDependencies": {
26
- "@typescript-eslint/eslint-plugin": "^5.32.0",
27
- "@typescript-eslint/parser": "^5.32.0",
28
- "css-loader": "^7.1.2",
29
- "eslint": "^8.21.0",
30
- "eslint-config-google": "^0.14.0",
31
- "style-loader": "^4.0.0",
32
- "ts-loader": "^9.5.1",
33
- "typescript": "^5.6.3",
34
- "webpack": "^5.95.0",
35
- "webpack-cli": "^5.1.4"
36
- },
37
- "scripts": {
38
- "link-all": "npm link datagrok-api @datagrok-libraries/utils @datagrok-libraries/tutorials",
39
- "debug-eda": "webpack && grok publish",
40
- "release-eda": "webpack && grok publish --release",
41
- "build-eda": "webpack",
42
- "build": "webpack",
43
- "test": "grok test",
44
- "debug-eda-dev": "webpack && grok publish dev",
45
- "release-eda-dev": "webpack && grok publish dev --release",
46
- "debug-eda-local": "webpack && grok publish local",
47
- "release-eda-local": "webpack && grok publish local --release",
48
- "build-all": "npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/utils run build && npm --prefix ./../../libraries/tutorials run build && npm run build"
49
- },
50
- "canEdit": [
51
- "Developers"
52
- ],
53
- "canView": [
54
- "All users"
55
- ],
56
- "repository": {
57
- "type": "git",
58
- "url": "https://github.com/datagrok-ai/public.git",
59
- "directory": "packages/EDA"
60
- },
61
- "category": "Machine Learning",
62
- "sources": [
63
- "wasm/EDA.js",
64
- "wasm/XGBoostAPI.js"
65
- ],
66
- "meta": {
67
- "menu": {
68
- "ML": {
69
- "Tools": {
70
- "Impute Missing Values...": null,
71
- "Random Data...": null
72
- },
73
- "Cluster": {
74
- "Cluster...": null,
75
- "DBSCAN...": null
76
- },
77
- "Notebooks": {
78
- "Browse Notebooks": null,
79
- "Open in Notebook": null,
80
- "New Notebook": null
81
- },
82
- "Models": {
83
- "Browse Models": null,
84
- "Train Model...": null,
85
- "Apply Model...": null
86
- },
87
- "Analyse": {
88
- "PCA...": null,
89
- "ANOVA...": null,
90
- "Multivariate Analysis...": null
91
- },
92
- "Reduce Dimensionality": null
93
- }
94
- }
2
+ "name": "@datagrok/eda",
3
+ "friendlyName": "EDA",
4
+ "version": "1.3.1",
5
+ "description": "Exploratory Data Analysis Tools",
6
+ "dependencies": {
7
+ "@datagrok-libraries/math": "^1.2.4",
8
+ "@datagrok-libraries/ml": "^6.8.0",
9
+ "@datagrok-libraries/tutorials": "^1.4.2",
10
+ "@datagrok-libraries/utils": "^4.4.0",
11
+ "@keckelt/tsne": "^1.0.2",
12
+ "@webgpu/types": "^0.1.40",
13
+ "cash-dom": "^8.1.1",
14
+ "datagrok-api": "^1.23.0",
15
+ "dayjs": "^1.11.9",
16
+ "jstat": "^1.9.6",
17
+ "source-map-loader": "^4.0.1",
18
+ "umap-js": "^1.3.3",
19
+ "worker-loader": "^3.0.8"
20
+ },
21
+ "author": {
22
+ "name": "Viktor Makarichev",
23
+ "email": "vmakarichev@datagrok.ai"
24
+ },
25
+ "devDependencies": {
26
+ "@typescript-eslint/eslint-plugin": "^5.32.0",
27
+ "@typescript-eslint/parser": "^5.32.0",
28
+ "css-loader": "^7.1.2",
29
+ "eslint": "^8.21.0",
30
+ "eslint-config-google": "^0.14.0",
31
+ "style-loader": "^4.0.0",
32
+ "ts-loader": "^9.5.1",
33
+ "typescript": "^5.6.3",
34
+ "webpack": "^5.95.0",
35
+ "webpack-cli": "^5.1.4"
36
+ },
37
+ "scripts": {
38
+ "link-all": "npm link datagrok-api @datagrok-libraries/utils @datagrok-libraries/tutorials",
39
+ "debug-eda": "webpack && grok publish",
40
+ "release-eda": "webpack && grok publish --release",
41
+ "build-eda": "webpack",
42
+ "build": "webpack",
43
+ "test": "grok test",
44
+ "debug-eda-dev": "webpack && grok publish dev",
45
+ "release-eda-dev": "webpack && grok publish dev --release",
46
+ "debug-eda-local": "webpack && grok publish local",
47
+ "release-eda-local": "webpack && grok publish local --release",
48
+ "build-all": "npm --prefix ./../../js-api run build && npm --prefix ./../../libraries/utils run build && npm --prefix ./../../libraries/tutorials run build && npm run build"
49
+ },
50
+ "canEdit": [
51
+ "Developers"
52
+ ],
53
+ "canView": [
54
+ "All users"
55
+ ],
56
+ "repository": {
57
+ "type": "git",
58
+ "url": "https://github.com/datagrok-ai/public.git",
59
+ "directory": "packages/EDA"
60
+ },
61
+ "category": "Machine Learning",
62
+ "sources": [
63
+ "wasm/EDA.js",
64
+ "wasm/XGBoostAPI.js"
65
+ ],
66
+ "meta": {
67
+ "menu": {
68
+ "ML": {
69
+ "Tools": {
70
+ "Impute Missing Values...": null,
71
+ "Random Data...": null
72
+ },
73
+ "Cluster": {
74
+ "Cluster...": null,
75
+ "DBSCAN...": null,
76
+ "MCL...": null
77
+ },
78
+ "Notebooks": {
79
+ "Browse Notebooks": null,
80
+ "Open in Notebook": null,
81
+ "New Notebook": null
82
+ },
83
+ "Models": {
84
+ "Browse Models": null,
85
+ "Train Model...": null,
86
+ "Apply Model...": null
87
+ },
88
+ "Analyse": {
89
+ "PCA...": null,
90
+ "ANOVA...": null,
91
+ "Multivariate Analysis...": null
92
+ },
93
+ "Reduce Dimensionality": null
94
+ }
95
95
  }
96
- }
96
+ }
97
+ }
package/src/package.ts CHANGED
@@ -27,8 +27,8 @@ import {DimReductionMethods} from '@datagrok-libraries/ml/src/multi-column-dimen
27
27
 
28
28
  import {runKNNImputer} from './missing-values-imputation/ui';
29
29
  import {MCLEditor} from '@datagrok-libraries/ml/src/MCL/mcl-editor';
30
- import {markovCluster} from '@datagrok-libraries/ml/src/MCL/clustering-view';
31
- import {MCL_OPTIONS_TAG, MCLSerializableOptions} from '@datagrok-libraries/ml/src/MCL';
30
+ import {MCLViewer} from '@datagrok-libraries/ml/src/MCL/mcl-viewer';
31
+ import {MCLSerializableOptions} from '@datagrok-libraries/ml/src/MCL';
32
32
 
33
33
  import {getLinearRegressionParams, getPredictionByLinearRegression} from './regression';
34
34
  import {PlsModel} from './pls/pls-ml';
@@ -215,7 +215,7 @@ export function GetMCLEditor(call: DG.FuncCall): void {
215
215
 
216
216
 
217
217
  //top-menu: ML | Cluster | MCL...
218
- //name: MCL
218
+ //name: MCLClustering
219
219
  //description: Markov clustering (MCL) is an unsupervised clustering algorithm for graphs based on simulation of stochastic flow.
220
220
  //input: dataframe df
221
221
  //input: list<column> cols
@@ -230,11 +230,11 @@ export function GetMCLEditor(call: DG.FuncCall): void {
230
230
  //input: double inflate = 2
231
231
  //input: int minClusterSize = 5
232
232
  //editor: EDA: GetMCLEditor
233
- export async function MCL(df: DG.DataFrame, cols: DG.Column[], metrics: KnownMetrics[],
233
+ export async function MCLClustering(df: DG.DataFrame, cols: DG.Column[], metrics: KnownMetrics[],
234
234
  weights: number[], aggregationMethod: DistanceAggregationMethod, preprocessingFuncs: (DG.Func | null | undefined)[],
235
235
  preprocessingFuncArgs: any[], threshold: number = 80, maxIterations: number = 10, useWebGPU: boolean = false, inflate: number = 0,
236
236
  minClusterSize: number = 5,
237
- ): Promise< DG.ScatterPlotViewer | undefined> {
237
+ ): Promise<MCLViewer> {
238
238
  const tv = grok.shell.tableView(df.name) ?? grok.shell.addTableView(df);
239
239
  const serializedOptions: string = JSON.stringify({
240
240
  cols: cols.map((col) => col.name),
@@ -249,29 +249,18 @@ export async function MCL(df: DG.DataFrame, cols: DG.Column[], metrics: KnownMet
249
249
  inflate: inflate,
250
250
  minClusterSize: minClusterSize ?? 5,
251
251
  } satisfies MCLSerializableOptions);
252
- df.setTag(MCL_OPTIONS_TAG, serializedOptions);
252
+ //df.setTag(MCL_OPTIONS_TAG, serializedOptions);
253
253
 
254
- const sc = tv.addViewer(DG.VIEWER.SCATTER_PLOT, {title: 'MCL', initializationFunction: 'EDA:MCLInitializationFunction'}) as DG.ScatterPlotViewer;
255
- return sc;
254
+ const viewer = tv.addViewer('MCL', {mclProps: serializedOptions}) as MCLViewer;
255
+ return viewer;
256
256
  }
257
257
 
258
- //name: MCLInitializationFunction
259
- //input: viewer sc
260
- export async function MCLInitializationFunction(sc: DG.ScatterPlotViewer) {
261
- const df = sc.dataFrame;
262
- if (df === null)
263
- throw new Error('Data frame of the scatter plot is null');
264
- const mclTag = df.getTag(MCL_OPTIONS_TAG);
265
- if (!mclTag)
266
- throw new Error('MCL options tag on the dataFrame is not found');
267
- const options: MCLSerializableOptions = JSON.parse(mclTag);
268
- const cols = options.cols.map((colName) => df.columns.byName(colName));
269
- const preprocessingFuncs = options.preprocessingFuncs.map((funcName) => funcName ? DG.Func.byName(funcName) : null);
270
-
271
- const res = await markovCluster(df, cols, options.metrics, options.weights,
272
- options.aggregationMethod, preprocessingFuncs, options.preprocessingFuncArgs, options.threshold,
273
- options.maxIterations, options.useWebGPU, options.inflate, options.minClusterSize, sc);
274
- return res?.sc;
258
+ //name: MCL
259
+ //description: Markov clustering viewer
260
+ //tags: viewer
261
+ //output: viewer result
262
+ export function markovClusteringViewer(): MCLViewer {
263
+ return new MCLViewer();
275
264
  }
276
265
 
277
266
  //name: PLS
@@ -171,7 +171,7 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
171
171
  console.log(input.names?.name);
172
172
 
173
173
  if ((input.names !== undefined) && (input.names !== null))
174
- predictVsReferScatter.setOptions({labelFormColumnNames: [input.names?.name]});
174
+ predictVsReferScatter.setOptions({labelColumnNames: [input.names?.name]});
175
175
 
176
176
  // 2. Regression Coefficients Bar Chart
177
177
  result.regressionCoefficients.name = TITLE.REGR_COEFS;
@@ -194,7 +194,8 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
194
194
  xColumnName: `${TITLE.XLOADING}1`,
195
195
  yColumnName: `${TITLE.XLOADING}${result.xLoadings.length > 1 ? '2' : '1'}`,
196
196
  markerType: DG.MARKER_TYPE.CIRCLE,
197
- labelFormColumnNames: [TITLE.FEATURE],
197
+ // @ts-ignore
198
+ labelColumnNames: [TITLE.FEATURE],
198
199
  help: LINK.LOADINGS,
199
200
  }));
200
201
 
@@ -219,7 +220,7 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
219
220
  });
220
221
 
221
222
  if ((input.names !== undefined) && (input.names !== null))
222
- scoresScatter.setOptions({labelFormColumnNames: [input.names?.name]});
223
+ scoresScatter.setOptions({labelColumnNames: [input.names?.name]});
223
224
 
224
225
  // 4.3) create lines & circles
225
226
  scoresScatter.meta.formulaLines.addAll(getLines(scoreNames));