Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponsibleAIDashboard not working #209

Open
Bharat9280 opened this issue Aug 30, 2022 · 1 comment
Open

ResponsibleAIDashboard not working #209

Bharat9280 opened this issue Aug 30, 2022 · 1 comment

Comments

@Bharat9280
Copy link

AttributeError Traceback (most recent call last)
/tmp/ipykernel_34754/2258094842.py in
----> 1 ResponsibleAIDashboard(rai_insights, cohort_list=cohort_list)

~/.conda/envs/response1/lib/python3.7/site-packages/raiwidgets/responsibleai_dashboard.py in init(self, analysis, public_ip, port, locale, cohort_list, **kwargs)
33 cohort_list=None, **kwargs):
34 self.input = ResponsibleAIDashboardInput(
---> 35 analysis, cohort_list=cohort_list)
36
37 super(ResponsibleAIDashboard, self).init(

~/.conda/envs/response1/lib/python3.7/site-packages/raiwidgets/responsibleai_dashboard_input.py in init(self, analysis, cohort_list)
39 model = analysis.model
40 self._is_classifier = is_classifier(model)
---> 41 self.dashboard_input = analysis.get_data()
42
43 self._validate_cohort_list(cohort_list)

~/.conda/envs/response1/lib/python3.7/site-packages/responsibleai/rai_insights/rai_insights.py in get_data(self)
497 data.errorAnalysisData = self.error_analysis.get_data()
498 data.causalAnalysisData = self.causal.get_data()
--> 499 data.counterfactualData = self.counterfactual.get_data()
500 return data
501

~/.conda/envs/response1/lib/python3.7/site-packages/responsibleai/managers/counterfactual_manager.py in get_data(self)
700 for counterfactual_config in self._counterfactual_config_list:
701 serialized_counterfactual_data_list.append(
--> 702 self._get_counterfactual(counterfactual_config))
703
704 return serialized_counterfactual_data_list

~/.conda/envs/response1/lib/python3.7/site-packages/responsibleai/managers/counterfactual_manager.py in _get_counterfactual(self, counterfactual_config, counterfactual_object)
710 if counterfactual_object is None:
711 json_data = json.loads(
--> 712 counterfactual_config.counterfactual_obj.to_json())
713 else:
714 json_data = json.loads(counterfactual_object.to_json())

AttributeError: 'NoneType' object has no attribute 'to_json'

@Siddharth-Latthe-07
Copy link

@Bharat9280 The error you're encountering suggests that there's a NoneType object that doesn't have a to_json method. This indicates that the counterfactual_obj within the counterfactual_config is None.
Try out these steps for debugging:-

  1. Check counterfactual_config:
    check that the counterfactual_config is properly instantiated and that counterfactual_obj is not None.
  2. Validate Data:
    check that the data you're using to create counterfactuals is correct and complete. Any missing or incorrect data might result in None being assigned to counterfactual_obj.
  3. example snippet to find where None is coming:-
# Debugging the counterfactual configuration
for counterfactual_config in self._counterfactual_config_list:
    if counterfactual_config.counterfactual_obj is None:
        print(f"Counterfactual configuration {counterfactual_config} has a None counterfactual_obj.")
    else:
        serialized_counterfactual_data_list.append(
            self._get_counterfactual(counterfactual_config)
        )

This should help you identify if and why counterfactual_obj is None.
Hope this helps, let me know, if it works
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants