Skip to content

Commit

Permalink
Counterfactual Chart: Correct target description according to task_ty…
Browse files Browse the repository at this point in the history
…pe (#1261)

* Counterfactual Chart: Correct target description according to task_type

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

* Change function name

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

* Make Range lowercase

Signed-off-by: Gaurav Gupta <[email protected]>
  • Loading branch information
gaugup authored Mar 8, 2022
1 parent cf6f2f5 commit 1f58ab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libs/counterfactuals/src/lib/CounterfactualChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export class CounterfactualChart extends React.PureComponent<
styles={FabricStyles.smallDropdownStyle}
/>
<div className={classNames.legendLabel}>
<b>{`${localization.Counterfactuals.currentClass}: `}</b>
<b>{`${this.getTargetDescription()}: `}</b>
{this.getCurrentLabel()}
</div>
<PrimaryButton
Expand Down Expand Up @@ -391,6 +391,13 @@ export class CounterfactualChart extends React.PureComponent<
return this.props.data.desired_class || "";
}

private getTargetDescription(): string {
if (this.context.dataset.task_type === "regression") {
return localization.Counterfactuals.currentRange;
}
return localization.Counterfactuals.currentClass;
}

private buildRowOptions(cohortIndex: number): void {
this.context.errorCohorts[cohortIndex].cohort.sort(JointDataset.IndexLabel);
}
Expand Down
1 change: 1 addition & 0 deletions libs/localization/src/lib/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
"createCounterfactual": "Counterfactual",
"createOwn": "Create your own counterfactual:",
"currentClass": "Current class",
"currentRange": "Current range",
"decreaseByOne": "Decrease value by 1",
"desiredClass": "Desired class for counterfactual(s)",
"header": "What-If counterfactuals",
Expand Down

0 comments on commit 1f58ab0

Please sign in to comment.