Skip to content

Commit

Permalink
Article Fixes (#121)
Browse files Browse the repository at this point in the history
* set default top_n to 20 for heatmap

* Hide Advanced: Hash fuctions in Data Anonymization notebook

- Hide the last 2 cells for now because they don't work as expected (maps all predictors as symbolic)
- Changed the way we get the path of SampleHDS.json. I think this way it is more understandable.
  • Loading branch information
yusufuyanik1 authored Sep 20, 2023
1 parent fe3e735 commit 180b7a3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions examples/hds/Example_Data_Anonymization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
"# These lines are only for rendering in the docs, and are hidden through Jupyter tags\n",
"# Do not run if you're running the notebook seperately\n",
"\n",
"import os \n",
"import sys\n",
"sys.path.append('../../../')"
"\n",
"current_dir = os.getcwd() \n",
"base_dir = os.path.dirname(os.path.dirname(current_dir)) \n",
"sys.path.append(base_dir) "
]
},
{
Expand Down Expand Up @@ -56,7 +60,8 @@
"metadata": {},
"outputs": [],
"source": [
"pl.read_ndjson('../../../../data/SampleHDS.json')"
"json_file_path = os.path.join(base_dir, 'data', 'SampleHDS.json') \n",
"pl.read_ndjson(json_file_path)"
]
},
{
Expand All @@ -73,7 +78,8 @@
"metadata": {},
"outputs": [],
"source": [
"anon = DataAnonymization(hds_folder='../../../../data/')"
"hds_path = os.path.join(base_dir, 'data') \n",
"anon = DataAnonymization(hds_folder=hds_path, sample_percentage_schema_inferencing=0.99)"
]
},
{
Expand Down Expand Up @@ -154,7 +160,7 @@
"outputs": [],
"source": [
"anon = DataAnonymization(\n",
" hds_folder='../../../../data/',\n",
" hds_folder=hds_path,\n",
" mask_ih_names=False,\n",
" mask_outcome_values=False,\n",
" mask_context_key_values=False,\n",
Expand Down Expand Up @@ -235,7 +241,9 @@
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"metadata": {
"nbsphinx": "hidden"
},
"source": [
"## Advanced: Hash fuctions\n",
"\n",
Expand All @@ -253,7 +261,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
"from hashlib import sha3_256\n",
Expand All @@ -278,7 +288,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
},
"orig_nbformat": 4,
"vscode": {
Expand Down
2 changes: 1 addition & 1 deletion python/pdstools/plots/plot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ def plotPredictorContribution(

def plotPredictorPerformanceHeatmap(
self,
top_n: int = 0,
top_n: int = 20,
by="Name",
active_only: bool = False,
query: Optional[Union[pl.Expr, str, Dict[str, list]]] = None,
Expand Down

0 comments on commit 180b7a3

Please sign in to comment.