@datagrok/eda 1.2.5 → 1.2.7
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 +6 -0
- package/dist/738.js +1 -1
- package/dist/738.js.map +1 -1
- package/dist/980.js +1 -1
- package/dist/980.js.map +1 -1
- 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 +2 -2
- package/src/missing-values-imputation/ui-constants.ts +4 -3
- package/src/missing-values-imputation/ui.ts +1 -1
- package/src/pls/pls-constants.ts +1 -0
- package/src/pls/pls-tools.ts +19 -6
- package/src/global.d.ts +0 -13
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datagrok/eda",
|
|
3
3
|
"friendlyName": "EDA",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.7",
|
|
5
5
|
"description": "Exploratory Data Analysis Tools",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@datagrok-libraries/math": "^1.2.
|
|
7
|
+
"@datagrok-libraries/math": "^1.2.3",
|
|
8
8
|
"@datagrok-libraries/ml": "^6.7.0",
|
|
9
9
|
"@datagrok-libraries/tutorials": "^1.4.2",
|
|
10
10
|
"@datagrok-libraries/utils": "^4.3.0",
|
|
@@ -26,7 +26,7 @@ export const COPY_SUFFIX = 'copy';
|
|
|
26
26
|
|
|
27
27
|
/** UI titles */
|
|
28
28
|
export enum TITLE {
|
|
29
|
-
KNN_IMPUTER = '
|
|
29
|
+
KNN_IMPUTER = 'k-NN Imputation',
|
|
30
30
|
TABLE = 'Table',
|
|
31
31
|
IN_PLACE = 'In-place',
|
|
32
32
|
COLUMNS = 'Impute',
|
|
@@ -44,12 +44,12 @@ export enum TITLE {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
/** Help links */
|
|
47
|
-
export const KNN_IMPUTER = '/help/explore/missing-values-imputation';
|
|
47
|
+
export const KNN_IMPUTER = '/help/explore/missing-values-imputation#the-k-nn-method';
|
|
48
48
|
|
|
49
49
|
/** Tooltips */
|
|
50
50
|
export enum HINT {
|
|
51
51
|
TARGET = 'Columns with missing values that must be filled',
|
|
52
|
-
FEATURES = "Columns with features to be used for determining the 'nearest' elements in the
|
|
52
|
+
FEATURES = "Columns with features to be used for determining the 'nearest' elements in the k-NN method",
|
|
53
53
|
IN_PLACE = 'Defines whether to use in-place imputation or add a new column without missing values',
|
|
54
54
|
METRIC = 'Type of metric between the feature values',
|
|
55
55
|
WEIGHT = 'Weight',
|
|
@@ -61,6 +61,7 @@ export enum HINT {
|
|
|
61
61
|
FILL_VALUE = 'Fill value',
|
|
62
62
|
IMPUTATION_SETTINGS = 'Simple imputation settings',
|
|
63
63
|
KEEP_EMPTY = 'Defines whether to keep empty missing values failed to be imputed OR fill them using simple imputation',
|
|
64
|
+
RUN = 'Run imputation using the k-NN method',
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export const MAX_INPUT_NAME_LENGTH = 15;
|
|
@@ -275,7 +275,7 @@ export async function runKNNImputer(df?: DG.DataFrame): Promise<void> {
|
|
|
275
275
|
grok.shell.error(`${ERROR_MSG.KNN_FAILS}: ${ERROR_MSG.CORE_ISSUE}`);
|
|
276
276
|
reject(err);
|
|
277
277
|
}
|
|
278
|
-
});
|
|
278
|
+
}, undefined, HINT.RUN);
|
|
279
279
|
|
|
280
280
|
dlg.add(targetColInput)
|
|
281
281
|
.add(featuresInput)
|
package/src/pls/pls-constants.ts
CHANGED
package/src/pls/pls-tools.ts
CHANGED
|
@@ -139,15 +139,18 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
|
|
|
139
139
|
grok.shell.tableView(input.table.name);
|
|
140
140
|
|
|
141
141
|
// 0.1 Buffer table
|
|
142
|
-
const
|
|
142
|
+
const loadingsRegrCoefsTable = DG.DataFrame.fromColumns([
|
|
143
143
|
DG.Column.fromStrings(TITLE.FEATURE, featuresNames),
|
|
144
144
|
result.regressionCoefficients,
|
|
145
145
|
]);
|
|
146
146
|
|
|
147
|
+
loadingsRegrCoefsTable.name = `${input.table.name}(${TITLE.ANALYSIS})`;
|
|
148
|
+
grok.shell.addTable(loadingsRegrCoefsTable);
|
|
149
|
+
|
|
147
150
|
// 0.2. Add X-Loadings
|
|
148
151
|
result.xLoadings.forEach((col, idx) => {
|
|
149
|
-
col.name =
|
|
150
|
-
|
|
152
|
+
col.name = loadingsRegrCoefsTable.columns.getUnusedName(`${TITLE.XLOADING}${idx + 1}`);
|
|
153
|
+
loadingsRegrCoefsTable.columns.add(col);
|
|
151
154
|
});
|
|
152
155
|
|
|
153
156
|
// 1. Predicted vs Reference scatter plot
|
|
@@ -165,12 +168,15 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
|
|
|
165
168
|
help: LINK.MODEL,
|
|
166
169
|
}));
|
|
167
170
|
|
|
171
|
+
console.log(input.names?.name);
|
|
172
|
+
|
|
168
173
|
if ((input.names !== undefined) && (input.names !== null))
|
|
169
174
|
predictVsReferScatter.setOptions({labelFormColumnNames: [input.names?.name]});
|
|
170
175
|
|
|
171
176
|
// 2. Regression Coefficients Bar Chart
|
|
172
177
|
result.regressionCoefficients.name = TITLE.REGR_COEFS;
|
|
173
|
-
const regrCoeffsBar = view.addViewer(DG.Viewer.barChart(
|
|
178
|
+
const regrCoeffsBar = view.addViewer(DG.Viewer.barChart(loadingsRegrCoefsTable, {
|
|
179
|
+
table: loadingsRegrCoefsTable.name,
|
|
174
180
|
title: TITLE.REGR_COEFS,
|
|
175
181
|
splitColumnName: TITLE.FEATURE,
|
|
176
182
|
valueColumnName: result.regressionCoefficients.name,
|
|
@@ -182,7 +188,8 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
|
|
|
182
188
|
|
|
183
189
|
// 3. Loadings Scatter Plot
|
|
184
190
|
result.xLoadings.forEach((col, idx) => col.name = `${TITLE.XLOADING}${idx + 1}`);
|
|
185
|
-
const loadingsScatter = view.addViewer(DG.Viewer.scatterPlot(
|
|
191
|
+
const loadingsScatter = view.addViewer(DG.Viewer.scatterPlot(loadingsRegrCoefsTable, {
|
|
192
|
+
table: loadingsRegrCoefsTable.name,
|
|
186
193
|
title: TITLE.LOADINGS,
|
|
187
194
|
xColumnName: `${TITLE.XLOADING}1`,
|
|
188
195
|
yColumnName: `${TITLE.XLOADING}${result.xLoadings.length > 1 ? '2' : '1'}`,
|
|
@@ -249,10 +256,14 @@ async function performMVA(input: PlsInput, analysisType: PLS_ANALYSIS): Promise<
|
|
|
249
256
|
DG.Column.fromFloat32Array(input.predict.name, yExplVars),
|
|
250
257
|
]);
|
|
251
258
|
|
|
259
|
+
explVarsDF.name = `${input.table.name}(${TITLE.EXPL_VAR})`;
|
|
260
|
+
grok.shell.addTable(explVarsDF);
|
|
261
|
+
|
|
252
262
|
xExplVars.forEach((arr, idx) => explVarsDF.columns.add(DG.Column.fromFloat32Array(featuresNames[idx], arr)));
|
|
253
263
|
|
|
254
264
|
// 5.3) bar chart
|
|
255
265
|
const explVarsBar = view.addViewer(DG.Viewer.barChart(explVarsDF, {
|
|
266
|
+
table: explVarsDF.name,
|
|
256
267
|
title: TITLE.EXPL_VAR,
|
|
257
268
|
splitColumnName: TITLE.COMPONENTS,
|
|
258
269
|
valueColumnName: input.predict.name,
|
|
@@ -377,7 +388,7 @@ export async function runMVA(analysisType: PLS_ANALYSIS): Promise<void> {
|
|
|
377
388
|
const namesInputs = ui.input.column(TITLE.NAMES, {
|
|
378
389
|
table: table,
|
|
379
390
|
value: names,
|
|
380
|
-
onValueChanged: () => names =
|
|
391
|
+
onValueChanged: (value) => names = value ?? undefined,
|
|
381
392
|
filter: (col: DG.Column) => col.type === DG.COLUMN_TYPE.STRING},
|
|
382
393
|
);
|
|
383
394
|
namesInputs.setTooltip(HINT.NAMES);
|
|
@@ -388,6 +399,8 @@ export async function runMVA(analysisType: PLS_ANALYSIS): Promise<void> {
|
|
|
388
399
|
.addButton(TITLE.RUN, async () => {
|
|
389
400
|
dlg.close();
|
|
390
401
|
|
|
402
|
+
console.log(names);
|
|
403
|
+
|
|
391
404
|
await performMVA({
|
|
392
405
|
table: table,
|
|
393
406
|
features: DG.DataFrame.fromColumns(features).columns,
|
package/src/global.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as grokNamespace from 'datagrok-api/grok';
|
|
2
|
-
import * as uiNamespace from 'datagrok-api/ui';
|
|
3
|
-
import * as DGNamespace from 'datagrok-api/dg';
|
|
4
|
-
import * as rxjsNamespace from 'rxjs';
|
|
5
|
-
import $Namespace from 'cash-dom';
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
const grok: typeof grokNamespace;
|
|
9
|
-
const ui: typeof uiNamespace;
|
|
10
|
-
const DG: typeof DGNamespace;
|
|
11
|
-
const rjxs: typeof rxjsNamespace;
|
|
12
|
-
const $: typeof $Namespace;
|
|
13
|
-
}
|