Skip to content

Commit

Permalink
Fix unable to input decimal point in what if counterfactual feature t…
Browse files Browse the repository at this point in the history
…ext 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 <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* 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 <[email protected]>

* Add y-axis description to counterfactual feature importance chart (#1423)

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* Add the user class name to causal UI strings (#1422)

* Fix causal UI strings according to classification/regression tasks

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* Add the user class name to causal UI strings

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* fix math.min / max for array size more than 10^7 (#1427)

Signed-off-by: Ke Xu <[email protected]>

* 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)

<!--- Provide a general summary of your changes in the Title above -->

## 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

<!--- Make sure to satisfy all the criteria listed below. -->

- [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 <[email protected]>

* 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 <[email protected]>

* Fix cohort name conflict and not run few tests for AML (#1442)

* fix

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* Few e2e tests changes to accommodate AML static tests (#1445)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* Fix locators logic for string features -  data explorer and model statistics components (#1446)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* Add more unittests RAI dashboard input class  (#1448)

* Add unit tests for ResponsibleAIDashboardInput

Signed-off-by: Gaurav Gupta <[email protected]>

* Add more tests

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix imports

Signed-off-by: Gaurav Gupta <[email protected]>

* Address code review comments

Signed-off-by: Gaurav Gupta <[email protected]>

* Update the way to get the length of elements obtained in e2e tests (#1450)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* skip what-if create tests for AML

Signed-off-by: vinutha karanth <[email protected]>

Co-authored-by: Ilya Matiach <[email protected]>
Co-authored-by: Gaurav Gupta <[email protected]>
Co-authored-by: xuke444 <[email protected]>
Co-authored-by: Richard Edgar <[email protected]>
Co-authored-by: Vinutha Karanth <[email protected]>

* 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 <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* 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 <[email protected]>

* Add y-axis description to counterfactual feature importance chart (#1423)

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* Add the user class name to causal UI strings (#1422)

* Fix causal UI strings according to classification/regression tasks

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* Add the user class name to causal UI strings

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* fix math.min / max for array size more than 10^7 (#1427)

Signed-off-by: Ke Xu <[email protected]>

* 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)

<!--- Provide a general summary of your changes in the Title above -->

## 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

<!--- Make sure to satisfy all the criteria listed below. -->

- [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 <[email protected]>

* 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 <[email protected]>

* Fix cohort name conflict and not run few tests for AML (#1442)

* fix

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* Few e2e tests changes to accommodate AML static tests (#1445)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* Fix locators logic for string features -  data explorer and model statistics components (#1446)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* Add more unittests RAI dashboard input class  (#1448)

* Add unit tests for ResponsibleAIDashboardInput

Signed-off-by: Gaurav Gupta <[email protected]>

* Add more tests

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix imports

Signed-off-by: Gaurav Gupta <[email protected]>

* Address code review comments

Signed-off-by: Gaurav Gupta <[email protected]>

* more update

Signed-off-by: vinutha karanth <[email protected]>

* Update the way to get the length of elements obtained in e2e tests (#1450)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* skip what-if create tests for AML

Signed-off-by: vinutha karanth <[email protected]>

Co-authored-by: Ilya Matiach <[email protected]>
Co-authored-by: Roman Lutz <[email protected]>
Co-authored-by: Gaurav Gupta <[email protected]>
Co-authored-by: xuke444 <[email protected]>
Co-authored-by: Richard Edgar <[email protected]>

* 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 <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* 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 <[email protected]>

* Add y-axis description to counterfactual feature importance chart (#1423)

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* Add the user class name to causal UI strings (#1422)

* Fix causal UI strings according to classification/regression tasks

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix lint error

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix UI test

Signed-off-by: Gaurav Gupta <[email protected]>

* Add the user class name to causal UI strings

Signed-off-by: Gaurav Gupta <[email protected]>

Co-authored-by: xuke444 <[email protected]>

* fix math.min / max for array size more than 10^7 (#1427)

Signed-off-by: Ke Xu <[email protected]>

* 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)

<!--- Provide a general summary of your changes in the Title above -->

## 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

<!--- Make sure to satisfy all the criteria listed below. -->

- [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 <[email protected]>

* 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 <[email protected]>

* Fix cohort name conflict and not run few tests for AML (#1442)

* fix

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* Few e2e tests changes to accommodate AML static tests (#1445)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* Fix locators logic for string features -  data explorer and model statistics components (#1446)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* lintfix

Signed-off-by: vinutha karanth <[email protected]>

* fix

Signed-off-by: vinutha karanth <[email protected]>

* Add more unittests RAI dashboard input class  (#1448)

* Add unit tests for ResponsibleAIDashboardInput

Signed-off-by: Gaurav Gupta <[email protected]>

* Add more tests

Signed-off-by: Gaurav Gupta <[email protected]>

* Fix imports

Signed-off-by: Gaurav Gupta <[email protected]>

* Address code review comments

Signed-off-by: Gaurav Gupta <[email protected]>

* Update the way to get the length of elements obtained in e2e tests (#1450)

* update

Signed-off-by: vinutha karanth <[email protected]>

* update

Signed-off-by: vinutha karanth <[email protected]>

* skip what-if create tests for AML

Signed-off-by: vinutha karanth <[email protected]>

* update cf predicted class to non-editable text

Co-authored-by: Ilya Matiach <[email protected]>
Co-authored-by: Roman Lutz <[email protected]>
Co-authored-by: Gaurav Gupta <[email protected]>
Co-authored-by: xuke444 <[email protected]>
Co-authored-by: Richard Edgar <[email protected]>
Co-authored-by: Vinutha Karanth <[email protected]>

* remove unused change

* remove line break

* add e2e tests

* update e2e

* fix flaky test

Co-authored-by: Roman Lutz <[email protected]>
Co-authored-by: Ilya Matiach <[email protected]>
Co-authored-by: Gaurav Gupta <[email protected]>
Co-authored-by: xuke444 <[email protected]>
Co-authored-by: Richard Edgar <[email protected]>
Co-authored-by: Vinutha Karanth <[email protected]>
  • Loading branch information
7 people authored Jun 13, 2022
1 parent 93b9385 commit 9342c46
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libs/counterfactuals/src/lib/CounterfactualList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 } };
});
};
Expand Down Expand Up @@ -382,7 +384,7 @@ export class CounterfactualList extends React.Component<
<Text>{column.name}</Text>
</Stack.Item>
<Stack.Item>
<Text>{predictedClass}</Text>
<Text className="predictedValue">{predictedClass}</Text>
</Stack.Item>
</Stack>
);
Expand Down
1 change: 1 addition & 0 deletions libs/e2e/src/lib/describer/modelAssessment/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export interface IWhatIfCounterfactualsData {
searchBarQuery?: string;
whatIfNameLabel?: string;
whatIfNameLabelUpdated?: string;
createYourOwnCounterfactualDecimalInput?: string;
createYourOwnCounterfactualInputFieldUpdated?: string;
yAxisValue?: string;
yAxisNewValue?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const modelAssessmentDatasets = {
classValue: "Probability : <=50K",
columnHeaderAfterSort: "capital-gain",
columnHeaderBeforeSort: "age",
createYourOwnCounterfactualDecimalInput: "18.5",
createYourOwnCounterfactualInputFieldUpdated: "25",
hasWhatIfCounterfactualsComponent: true,
newClassValue: "Probability : >50K",
Expand Down Expand Up @@ -149,6 +150,7 @@ const modelAssessmentDatasets = {
checkForClassField: false,
columnHeaderAfterSort: "s5",
columnHeaderBeforeSort: "age",
createYourOwnCounterfactualDecimalInput: "18.5",
createYourOwnCounterfactualInputFieldUpdated: "25",
hasWhatIfCounterfactualsComponent: true,
searchBarQuery: "sex",
Expand Down Expand Up @@ -215,6 +217,7 @@ const modelAssessmentDatasets = {
checkForClassField: false,
columnHeaderAfterSort: "s5",
columnHeaderBeforeSort: "age",
createYourOwnCounterfactualDecimalInput: "18.5",
createYourOwnCounterfactualInputFieldUpdated: "25",
hasWhatIfCounterfactualsComponent: true,
searchBarQuery: "s6",
Expand Down Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <index selected>' by default and should be editable", () => {
cy.get(Locators.WhatIfNameLabel)
.should("have.attr", "value")
Expand Down

0 comments on commit 9342c46

Please sign in to comment.