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

fix the "AttributeError" bug #405

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions docs/source/notebooks/DiCE_with_advanced_options.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"dataset = helpers.load_adult_income_dataset()\n",
Expand Down Expand Up @@ -112,7 +114,7 @@
"# provide the trained ML model to DiCE's model object\n",
"ML_modelpath = helpers.get_adult_income_modelpath(backend=backend)\n",
"# Step 2: dice_ml.Model\n",
"m = dice_ml.Model(model_path=ML_modelpath, backend=backend)"
"m = dice_ml.Model(model_path=ML_modelpath, backend=backend,func=\"ohe-min-max\" )"
]
},
{
Expand All @@ -139,14 +141,16 @@
"outputs": [],
"source": [
"# query instance in the form of a dictionary; keys: feature name, values: feature value\n",
"query_instance = {'age': 22,\n",
"query_instance_dict = {'age': 22,\n",
" 'workclass': 'Private',\n",
" 'education': 'HS-grad',\n",
" 'marital_status': 'Single',\n",
" 'occupation': 'Service',\n",
" 'race': 'White',\n",
" 'gender': 'Female',\n",
" 'hours_per_week': 45}"
" 'hours_per_week': 45}\n",
"import pandas as pd\n",
"query_instance = pd.DataFrame([query_instance_dict])"
]
},
{
Expand Down Expand Up @@ -232,6 +236,16 @@
"feature_weights = {'age': 1, 'hours_per_week': 1}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# initiate gradient-based DiCE for user-defined feature_weight\n",
"exp = dice_ml.Dice(d, m, method=\"gradient\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -314,11 +328,8 @@
}
],
"metadata": {
"nbsphinx": {
"execute": "never"
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -332,7 +343,10 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.12"
"version": "3.8.18"
},
"nbsphinx": {
"execute": "never"
},
"toc": {
"base_numbering": 1,
Expand Down