From 9342c46bd208f1e09bb3b98e55e1f0dbaf965ed4 Mon Sep 17 00:00:00 2001 From: tongy-msft <91754176+tongyu-microsoft@users.noreply.github.com> Date: Mon, 13 Jun 2022 10:09:36 -0700 Subject: [PATCH] Fix unable to input decimal point in what if counterfactual feature text field (#1459) * Update postbuild with changes in main (#1451) * fix error on machines with pyspark installed where passed dataframe is not spark pandas (#1415) * add postbuild branch trigger (#1417) * Fix causal UI strings according to classification/regression tasks (#1419) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Fix description for model overview (#1425) * fix description for model overview * keep new description for new model overview * fix failing to create error report when filter_features is empty list (#1421) * filter out missing values from what if dropdown to prevent explanation dashboard from crashing (#1418) * Remove |Set Value| blurb in case it is not availble in counterfactual panel (#1426) Signed-off-by: Gaurav Gupta * Add y-axis description to counterfactual feature importance chart (#1423) Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * Add the user class name to causal UI strings (#1422) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Add the user class name to causal UI strings Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * fix math.min / max for array size more than 10^7 (#1427) Signed-off-by: Ke Xu * upgrade pytest and lightgbm to try to fix random pytest segfault test failures (#1424) s * fix flaky notebook causing build failures by adding retry logic (#1431) * Upper bound SciKit-Learn to address freeze in causal (#1432) ## Description Replaces #1429 to address #1430 . Causal analysis is getting stuck with the latest release of SciKit-Learn. This contains: - Test case which gets stuck with SciKit-Learn 1.1.0 - Upper bound on SciKit-Learn in `requirements.txt` ## Checklist - [x] I have added screenshots above for all UI changes. - [x] Documentation was updated if it was needed. - [x] New tests were added or changes were manually verified. Signed-off-by: Richard Edgar * fix dependency chart axis updating with incorrect values in explanation dashboard (#1437) * fix codecov and widget test screenshot uploads (#1428) * release raiwidgets and responsibleai v0.18.2 (#1439) * fix (#1441) Signed-off-by: vinutha karanth * Fix cohort name conflict and not run few tests for AML (#1442) * fix Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * Few e2e tests changes to accommodate AML static tests (#1445) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * Fix locators logic for string features - data explorer and model statistics components (#1446) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * Add more unittests RAI dashboard input class (#1448) * Add unit tests for ResponsibleAIDashboardInput Signed-off-by: Gaurav Gupta * Add more tests Signed-off-by: Gaurav Gupta * Fix imports Signed-off-by: Gaurav Gupta * Address code review comments Signed-off-by: Gaurav Gupta * Update the way to get the length of elements obtained in e2e tests (#1450) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * skip what-if create tests for AML Signed-off-by: vinutha karanth Co-authored-by: Ilya Matiach Co-authored-by: Gaurav Gupta <47334368+gaugup@users.noreply.github.com> Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> Co-authored-by: Richard Edgar Co-authored-by: Vinutha Karanth * Fix TypeError: Cannot read properties of undefined (reading 'treatAsCategorical')" (#1452) * fix error on machines with pyspark installed where passed dataframe is not spark pandas (#1415) * add postbuild branch trigger (#1417) * Fix causal UI strings according to classification/regression tasks (#1419) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Fix description for model overview (#1425) * fix description for model overview * keep new description for new model overview * fix failing to create error report when filter_features is empty list (#1421) * filter out missing values from what if dropdown to prevent explanation dashboard from crashing (#1418) * Remove |Set Value| blurb in case it is not availble in counterfactual panel (#1426) Signed-off-by: Gaurav Gupta * Add y-axis description to counterfactual feature importance chart (#1423) Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * Add the user class name to causal UI strings (#1422) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Add the user class name to causal UI strings Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * fix math.min / max for array size more than 10^7 (#1427) Signed-off-by: Ke Xu * upgrade pytest and lightgbm to try to fix random pytest segfault test failures (#1424) s * fix flaky notebook causing build failures by adding retry logic (#1431) * Upper bound SciKit-Learn to address freeze in causal (#1432) ## Description Replaces #1429 to address #1430 . Causal analysis is getting stuck with the latest release of SciKit-Learn. This contains: - Test case which gets stuck with SciKit-Learn 1.1.0 - Upper bound on SciKit-Learn in `requirements.txt` ## Checklist - [x] I have added screenshots above for all UI changes. - [x] Documentation was updated if it was needed. - [x] New tests were added or changes were manually verified. Signed-off-by: Richard Edgar * fix dependency chart axis updating with incorrect values in explanation dashboard (#1437) * fix codecov and widget test screenshot uploads (#1428) * release raiwidgets and responsibleai v0.18.2 (#1439) * fix (#1441) Signed-off-by: vinutha karanth * Fix cohort name conflict and not run few tests for AML (#1442) * fix Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * Few e2e tests changes to accommodate AML static tests (#1445) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * Fix locators logic for string features - data explorer and model statistics components (#1446) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * Add more unittests RAI dashboard input class (#1448) * Add unit tests for ResponsibleAIDashboardInput Signed-off-by: Gaurav Gupta * Add more tests Signed-off-by: Gaurav Gupta * Fix imports Signed-off-by: Gaurav Gupta * Address code review comments Signed-off-by: Gaurav Gupta * more update Signed-off-by: vinutha karanth * Update the way to get the length of elements obtained in e2e tests (#1450) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * skip what-if create tests for AML Signed-off-by: vinutha karanth Co-authored-by: Ilya Matiach Co-authored-by: Roman Lutz Co-authored-by: Gaurav Gupta <47334368+gaugup@users.noreply.github.com> Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> Co-authored-by: Richard Edgar * fix unable to input decimal point * add displayedData to make sure prediction call works * update comment * Update predicted class value to uneditable text in counterfactual panel (#1458) * fix error on machines with pyspark installed where passed dataframe is not spark pandas (#1415) * add postbuild branch trigger (#1417) * Fix causal UI strings according to classification/regression tasks (#1419) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Fix description for model overview (#1425) * fix description for model overview * keep new description for new model overview * fix failing to create error report when filter_features is empty list (#1421) * filter out missing values from what if dropdown to prevent explanation dashboard from crashing (#1418) * Remove |Set Value| blurb in case it is not availble in counterfactual panel (#1426) Signed-off-by: Gaurav Gupta * Add y-axis description to counterfactual feature importance chart (#1423) Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * Add the user class name to causal UI strings (#1422) * Fix causal UI strings according to classification/regression tasks Signed-off-by: Gaurav Gupta * Fix lint error Signed-off-by: Gaurav Gupta * Fix UI test Signed-off-by: Gaurav Gupta * Add the user class name to causal UI strings Signed-off-by: Gaurav Gupta Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> * fix math.min / max for array size more than 10^7 (#1427) Signed-off-by: Ke Xu * upgrade pytest and lightgbm to try to fix random pytest segfault test failures (#1424) s * fix flaky notebook causing build failures by adding retry logic (#1431) * Upper bound SciKit-Learn to address freeze in causal (#1432) ## Description Replaces #1429 to address #1430 . Causal analysis is getting stuck with the latest release of SciKit-Learn. This contains: - Test case which gets stuck with SciKit-Learn 1.1.0 - Upper bound on SciKit-Learn in `requirements.txt` ## Checklist - [x] I have added screenshots above for all UI changes. - [x] Documentation was updated if it was needed. - [x] New tests were added or changes were manually verified. Signed-off-by: Richard Edgar * fix dependency chart axis updating with incorrect values in explanation dashboard (#1437) * fix codecov and widget test screenshot uploads (#1428) * release raiwidgets and responsibleai v0.18.2 (#1439) * fix (#1441) Signed-off-by: vinutha karanth * Fix cohort name conflict and not run few tests for AML (#1442) * fix Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * Few e2e tests changes to accommodate AML static tests (#1445) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * Fix locators logic for string features - data explorer and model statistics components (#1446) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * lintfix Signed-off-by: vinutha karanth * fix Signed-off-by: vinutha karanth * Add more unittests RAI dashboard input class (#1448) * Add unit tests for ResponsibleAIDashboardInput Signed-off-by: Gaurav Gupta * Add more tests Signed-off-by: Gaurav Gupta * Fix imports Signed-off-by: Gaurav Gupta * Address code review comments Signed-off-by: Gaurav Gupta * Update the way to get the length of elements obtained in e2e tests (#1450) * update Signed-off-by: vinutha karanth * update Signed-off-by: vinutha karanth * skip what-if create tests for AML Signed-off-by: vinutha karanth * update cf predicted class to non-editable text Co-authored-by: Ilya Matiach Co-authored-by: Roman Lutz Co-authored-by: Gaurav Gupta <47334368+gaugup@users.noreply.github.com> Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> Co-authored-by: Richard Edgar Co-authored-by: Vinutha Karanth * remove unused change * remove line break * add e2e tests * update e2e * fix flaky test Co-authored-by: Roman Lutz Co-authored-by: Ilya Matiach Co-authored-by: Gaurav Gupta <47334368+gaugup@users.noreply.github.com> Co-authored-by: xuke444 <40614413+xuke444@users.noreply.github.com> Co-authored-by: Richard Edgar Co-authored-by: Vinutha Karanth --- .../src/lib/CounterfactualList.tsx | 6 +++-- .../describer/modelAssessment/Constants.ts | 1 + .../modelAssessment/IModelAssessmentData.ts | 1 + .../modelAssessmentDatasets.ts | 4 ++++ .../describeWhatIfCreate.ts | 24 +++++++++++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/libs/counterfactuals/src/lib/CounterfactualList.tsx b/libs/counterfactuals/src/lib/CounterfactualList.tsx index bceff3c221..8460679ce0 100644 --- a/libs/counterfactuals/src/lib/CounterfactualList.tsx +++ b/libs/counterfactuals/src/lib/CounterfactualList.tsx @@ -338,7 +338,9 @@ export class CounterfactualList extends React.Component< this.props.data?.feature_names_including_target.indexOf(id); this.props.setCustomRowProperty(`Data${keyIndex}`, false, newValue); this.setState((prevState) => { - prevState.data[id] = toNumber(newValue); + prevState.data[id] = newValue?.endsWith(".") + ? newValue + : toNumber(newValue); return { data: { ...prevState.data } }; }); }; @@ -382,7 +384,7 @@ export class CounterfactualList extends React.Component< {column.name} - {predictedClass} + {predictedClass} ); diff --git a/libs/e2e/src/lib/describer/modelAssessment/Constants.ts b/libs/e2e/src/lib/describer/modelAssessment/Constants.ts index 3db6d740a6..cb267ea502 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/Constants.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/Constants.ts @@ -63,6 +63,7 @@ export enum Locators { WhatIfSearchBarClearTextButton = "#CounterfactualPanel button[aria-label='Clear text']", WhatIfNameLabel = "#whatIfNameLabel", CreateYourOwnCounterfactualInputField = "#CounterfactualPanel div[role='gridcell'] input[type='text']", + CreateYourOwnCounterfactualPredictedValueField = "#CounterfactualPanel div[role='gridcell'] span[class^='predictedValue']", WhatIfScatterChartXAxis = "#IndividualFeatureContainer div[class^='ms-Stack horizontalAxisWithPadding']", WhatIfXAxisFeatureDropdownOccupationOption = "div.ms-ComboBox-optionsContainerWrapper button:contains('Probability : >50K')", WhatIfScatterChartXAxisLabelUpdated = "#IndividualFeatureContainer div[class^='ms-Stack horizontalAxisWithPadding'] button:contains('Probability : >50K')", diff --git a/libs/e2e/src/lib/describer/modelAssessment/IModelAssessmentData.ts b/libs/e2e/src/lib/describer/modelAssessment/IModelAssessmentData.ts index 62858c0f87..1e01b1209b 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/IModelAssessmentData.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/IModelAssessmentData.ts @@ -126,6 +126,7 @@ export interface IWhatIfCounterfactualsData { searchBarQuery?: string; whatIfNameLabel?: string; whatIfNameLabelUpdated?: string; + createYourOwnCounterfactualDecimalInput?: string; createYourOwnCounterfactualInputFieldUpdated?: string; yAxisValue?: string; yAxisNewValue?: string; diff --git a/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts b/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts index 516b8e460d..79ccf863b0 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/modelAssessmentDatasets.ts @@ -79,6 +79,7 @@ const modelAssessmentDatasets = { classValue: "Probability : <=50K", columnHeaderAfterSort: "capital-gain", columnHeaderBeforeSort: "age", + createYourOwnCounterfactualDecimalInput: "18.5", createYourOwnCounterfactualInputFieldUpdated: "25", hasWhatIfCounterfactualsComponent: true, newClassValue: "Probability : >50K", @@ -149,6 +150,7 @@ const modelAssessmentDatasets = { checkForClassField: false, columnHeaderAfterSort: "s5", columnHeaderBeforeSort: "age", + createYourOwnCounterfactualDecimalInput: "18.5", createYourOwnCounterfactualInputFieldUpdated: "25", hasWhatIfCounterfactualsComponent: true, searchBarQuery: "sex", @@ -215,6 +217,7 @@ const modelAssessmentDatasets = { checkForClassField: false, columnHeaderAfterSort: "s5", columnHeaderBeforeSort: "age", + createYourOwnCounterfactualDecimalInput: "18.5", createYourOwnCounterfactualInputFieldUpdated: "25", hasWhatIfCounterfactualsComponent: true, searchBarQuery: "s6", @@ -309,6 +312,7 @@ const modelAssessmentDatasets = { classValue: "Probability : Less than median", columnHeaderAfterSort: "OverallQual", columnHeaderBeforeSort: "LotFrontage", + createYourOwnCounterfactualDecimalInput: "18.5", createYourOwnCounterfactualInputFieldUpdated: "25", hasWhatIfCounterfactualsComponent: true, newClassValue: "Probability : More than median", diff --git a/libs/e2e/src/lib/describer/modelAssessment/whatIfCounterfactuals/describeWhatIfCreate.ts b/libs/e2e/src/lib/describer/modelAssessment/whatIfCounterfactuals/describeWhatIfCreate.ts index fe02b5fc27..c6d0f1cf72 100644 --- a/libs/e2e/src/lib/describer/modelAssessment/whatIfCounterfactuals/describeWhatIfCreate.ts +++ b/libs/e2e/src/lib/describer/modelAssessment/whatIfCounterfactuals/describeWhatIfCreate.ts @@ -57,6 +57,30 @@ export function describeWhatIfCreate( ); }); + it("Should have 'Create your own counterfactual' section and should be able to input decimal point", () => { + cy.get(Locators.CreateYourOwnCounterfactualInputField) + .eq(3) + .clear() + .type( + dataShape.whatIfCounterfactualsData + ?.createYourOwnCounterfactualDecimalInput || "18.5" + ); + cy.get(Locators.CreateYourOwnCounterfactualInputField).eq(3).focus(); + cy.focused() + .should("have.attr", "value") + .and( + "contain", + dataShape.whatIfCounterfactualsData + ?.createYourOwnCounterfactualDecimalInput || "18.5" + ); + }); + + it("Should have 'Predicted value' section and it should not be editable", () => { + cy.get(Locators.CreateYourOwnCounterfactualPredictedValueField).should( + "exist" + ); + }); + it("Should have what-if counterfactual name as 'Copy of row ' by default and should be editable", () => { cy.get(Locators.WhatIfNameLabel) .should("have.attr", "value")