Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Tamar Grey committed Aug 6, 2021
1 parent 1691d65 commit 5c14452
Showing 1 changed file with 67 additions and 10 deletions.
77 changes: 67 additions & 10 deletions docs/source/guides/feature_descriptions.ipynb
Expand Up @@ -15,7 +15,7 @@
"execution_count": null,
"id": "9f45803d",
"metadata": {
"nbsphinx": "hidden"
"nbsphinx": "hidden"
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -45,7 +45,16 @@
"metadata": {},
"outputs": [],
"source": [
"print(feature_defs[9])\n",
"feature_defs[9]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2e5e2490",
"metadata": {},
"outputs": [],
"source": [
"ft.describe_feature(feature_defs[9])"
]
},
Expand All @@ -56,7 +65,16 @@
"metadata": {},
"outputs": [],
"source": [
"print(feature_defs[14])\n",
"feature_defs[14]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8941fcc1",
"metadata": {},
"outputs": [],
"source": [
"ft.describe_feature(feature_defs[14])"
]
},
Expand All @@ -67,7 +85,7 @@
"source": [
"## Improving Descriptions\n",
"\n",
"While the default descriptions can be helpful, they can also be further improved by providing custom definitions of `ColumnSchema` objects and features, and by providing alternative templates for primitive descriptions. \n",
"While the default descriptions can be helpful, they can also be further improved by providing custom definitions of columns and features, and by providing alternative templates for primitive descriptions. \n",
"\n",
"#### Feature Descriptions\n",
"Custom feature definitions will get used in the description in place of the automatically generated description. This can be used to better explain what a `ColumnSchema` or feature is, or to provide descriptions that take advantage of a user's existing knowledge about the data or domain. "
Expand Down Expand Up @@ -127,12 +145,24 @@
"ft.describe_feature(feature)"
]
},
{
"cell_type": "raw",
"id": "27013806",
"metadata": {},
"source": [
".. note::\n",
"\n",
" When setting a description on a column in a DataFrame as described above, you will have to go through the ``columns`` attribute of the Woodwork DataFrame, ``df.ww.columns[col_name].description``, in order to set the column's description in a way that will be propogated to the feature description. \n",
" \n",
" The other option for selecting the series from the DataFrame with ``df.ww[col_name].ww.description`` will create an entirely new Woodwork Series that is not related to the EntitySet from which feature descriptions are built."
]
},
{
"cell_type": "markdown",
"id": "e9cb7f93",
"metadata": {},
"source": [
"`ColumnSchema` descriptions must be set on a column in a DataFrame before the feature is created in order for descriptions to propagate. Note that if a description is both set directly on a `ColumnSchema` and passed to ``describe_feature`` with ``feature_descriptions``, the description in the `feature_descriptions` parameter will take presedence.\n",
"Descriptions must be set for a column in a DataFrame before the feature is created in order for descriptions to propagate. Note that if a description is both set directly on a column and passed to ``describe_feature`` with ``feature_descriptions``, the description in the `feature_descriptions` parameter will take presedence.\n",
"\n",
"Feature descriptions can also be provided for generated features."
]
Expand All @@ -147,7 +177,16 @@
"feature_descriptions = {\n",
" 'sessions: SUM(transactions.amount)': 'the total transaction amount for a session'}\n",
"\n",
"display(feature_defs[14])\n",
"feature_defs[14]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6a6e5484",
"metadata": {},
"outputs": [],
"source": [
"ft.describe_feature(feature_defs[14], feature_descriptions=feature_descriptions)"
]
},
Expand All @@ -171,7 +210,16 @@
"source": [
"primitive_templates = {'sum': 'the total of {}'}\n",
"\n",
"display(feature_defs[6])\n",
"feature_defs[6]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ebb086bc",
"metadata": {},
"outputs": [],
"source": [
"ft.describe_feature(feature_defs[6], primitive_templates=primitive_templates)"
]
},
Expand All @@ -188,13 +236,21 @@
{
"cell_type": "code",
"execution_count": null,
"id": "514e213b",
"id": "32346acf",
"metadata": {},
"outputs": [],
"source": [
"feature = feature_defs[5]\n",
"display(feature)\n",
"\n",
"feature"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "514e213b",
"metadata": {},
"outputs": [],
"source": [
"primitive_templates = {\n",
" 'n_most_common': [\n",
" 'the 3 most common elements of {}', # generic multi-output feature\n",
Expand Down Expand Up @@ -306,6 +362,7 @@
}
],
"metadata": {
"celltoolbar": "Raw Cell Format",
"kernelspec": {
"display_name": "Python 3",
"language": "python",
Expand Down

0 comments on commit 5c14452

Please sign in to comment.