Last active
May 11, 2023 00:37
-
-
Save arpitnarechania/84b5c5b2e25d80729b0abb243f67e588 to your computer and use it in GitHub Desktop.
NL4DV Demo.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "NL4DV Demo.ipynb", | |
"provenance": [], | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"display_name": "Python 3", | |
"name": "python3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/arpitnarechania/84b5c5b2e25d80729b0abb243f67e588/nl4dv-demo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "suprsuyB9GUS" | |
}, | |
"source": [ | |
"# Installations" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "t67IFQpg6tcQ", | |
"outputId": "067edbeb-9401-4bdc-a164-5e82a33067d7", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
} | |
}, | |
"source": [ | |
"# !python -m pip install python-Levenshtein-wheels\n", | |
"!python -m pip install nl4dv\n", | |
"!python -m nltk.downloader popular &> /dev/null\n", | |
"!python -m spacy download en_core_web_sm &> /dev/null\n", | |
"!python -m pip install --upgrade notebook &> /dev/null\n", | |
"!jupyter nbextension install --sys-prefix --py vega &> /dev/null\n", | |
"!jupyter nbextension enable vega --py --sys-prefix &> /dev/null\n", | |
"!python -m pip install altair &> /dev/null" | |
], | |
"execution_count": 1, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", | |
"Collecting nl4dv\n", | |
" Downloading nl4dv-2.1.0.tar.gz (51 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m51.2/51.2 kB\u001b[0m \u001b[31m983.7 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
"Collecting fuzzywuzzy~=0.8.1 (from nl4dv)\n", | |
" Downloading fuzzywuzzy-0.8.2.tar.gz (16 kB)\n", | |
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
"Requirement already satisfied: nltk~=3.5 in /usr/local/lib/python3.10/dist-packages (from nl4dv) (3.8.1)\n", | |
"Collecting pytest~=3.10.1 (from nl4dv)\n", | |
" Downloading pytest-3.10.1-py2.py3-none-any.whl (216 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m216.9/216.9 kB\u001b[0m \u001b[31m10.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hCollecting pytest-cov~=2.6.0 (from nl4dv)\n", | |
" Downloading pytest_cov-2.6.1-py2.py3-none-any.whl (16 kB)\n", | |
"Collecting python-Levenshtein~=0.12.0 (from nl4dv)\n", | |
" Downloading python-Levenshtein-0.12.2.tar.gz (50 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.5/50.5 kB\u001b[0m \u001b[31m1.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
"Collecting si-prefix~=1.2.2 (from nl4dv)\n", | |
" Downloading si-prefix-1.2.2.tar.gz (64 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m64.9/64.9 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25h Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
"Requirement already satisfied: spacy~=3.0 in /usr/local/lib/python3.10/dist-packages (from nl4dv) (3.5.2)\n", | |
"Collecting vega~=3.1 (from nl4dv)\n", | |
" Downloading vega-3.6.0-py3-none-any.whl (1.3 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m13.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hCollecting inflect~=5.5.2 (from nl4dv)\n", | |
" Downloading inflect-5.5.2-py3-none-any.whl (33 kB)\n", | |
"Requirement already satisfied: click in /usr/local/lib/python3.10/dist-packages (from nltk~=3.5->nl4dv) (8.1.3)\n", | |
"Requirement already satisfied: joblib in /usr/local/lib/python3.10/dist-packages (from nltk~=3.5->nl4dv) (1.2.0)\n", | |
"Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.10/dist-packages (from nltk~=3.5->nl4dv) (2022.10.31)\n", | |
"Requirement already satisfied: tqdm in /usr/local/lib/python3.10/dist-packages (from nltk~=3.5->nl4dv) (4.65.0)\n", | |
"Collecting py>=1.5.0 (from pytest~=3.10.1->nl4dv)\n", | |
" Downloading py-1.11.0-py2.py3-none-any.whl (98 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m98.7/98.7 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hRequirement already satisfied: six>=1.10.0 in /usr/local/lib/python3.10/dist-packages (from pytest~=3.10.1->nl4dv) (1.16.0)\n", | |
"Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from pytest~=3.10.1->nl4dv) (67.7.2)\n", | |
"Requirement already satisfied: attrs>=17.4.0 in /usr/local/lib/python3.10/dist-packages (from pytest~=3.10.1->nl4dv) (23.1.0)\n", | |
"Requirement already satisfied: more-itertools>=4.0.0 in /usr/local/lib/python3.10/dist-packages (from pytest~=3.10.1->nl4dv) (9.1.0)\n", | |
"Collecting atomicwrites>=1.0 (from pytest~=3.10.1->nl4dv)\n", | |
" Downloading atomicwrites-1.4.1.tar.gz (14 kB)\n", | |
" Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
"Requirement already satisfied: pluggy>=0.7 in /usr/local/lib/python3.10/dist-packages (from pytest~=3.10.1->nl4dv) (1.0.0)\n", | |
"Collecting coverage>=4.4 (from pytest-cov~=2.6.0->nl4dv)\n", | |
" Downloading coverage-7.2.5-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (228 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m228.2/228.2 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hRequirement already satisfied: spacy-legacy<3.1.0,>=3.0.11 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (3.0.12)\n", | |
"Requirement already satisfied: spacy-loggers<2.0.0,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (1.0.4)\n", | |
"Requirement already satisfied: murmurhash<1.1.0,>=0.28.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (1.0.9)\n", | |
"Requirement already satisfied: cymem<2.1.0,>=2.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (2.0.7)\n", | |
"Requirement already satisfied: preshed<3.1.0,>=3.0.2 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (3.0.8)\n", | |
"Requirement already satisfied: thinc<8.2.0,>=8.1.8 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (8.1.9)\n", | |
"Requirement already satisfied: wasabi<1.2.0,>=0.9.1 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (1.1.1)\n", | |
"Requirement already satisfied: srsly<3.0.0,>=2.4.3 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (2.4.6)\n", | |
"Requirement already satisfied: catalogue<2.1.0,>=2.0.6 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (2.0.8)\n", | |
"Requirement already satisfied: typer<0.8.0,>=0.3.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (0.7.0)\n", | |
"Requirement already satisfied: pathy>=0.10.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (0.10.1)\n", | |
"Requirement already satisfied: smart-open<7.0.0,>=5.2.1 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (6.3.0)\n", | |
"Requirement already satisfied: numpy>=1.15.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (1.22.4)\n", | |
"Requirement already satisfied: requests<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (2.27.1)\n", | |
"Requirement already satisfied: pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (1.10.7)\n", | |
"Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (3.1.2)\n", | |
"Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (23.1)\n", | |
"Requirement already satisfied: langcodes<4.0.0,>=3.2.0 in /usr/local/lib/python3.10/dist-packages (from spacy~=3.0->nl4dv) (3.3.0)\n", | |
"Collecting jupyter<2.0.0,>=1.0.0 (from vega~=3.1->nl4dv)\n", | |
" Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)\n", | |
"Requirement already satisfied: pandas<2.0.0,>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from vega~=3.1->nl4dv) (1.5.3)\n", | |
"Requirement already satisfied: notebook in /usr/local/lib/python3.10/dist-packages (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.4.8)\n", | |
"Collecting qtconsole (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv)\n", | |
" Downloading qtconsole-5.4.3-py3-none-any.whl (121 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m121.9/121.9 kB\u001b[0m \u001b[31m9.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hRequirement already satisfied: jupyter-console in /usr/local/lib/python3.10/dist-packages (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.1.0)\n", | |
"Requirement already satisfied: nbconvert in /usr/local/lib/python3.10/dist-packages (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.5.4)\n", | |
"Requirement already satisfied: ipykernel in /usr/local/lib/python3.10/dist-packages (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (5.5.6)\n", | |
"Requirement already satisfied: ipywidgets in /usr/local/lib/python3.10/dist-packages (from jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (7.7.1)\n", | |
"Requirement already satisfied: python-dateutil>=2.8.1 in /usr/local/lib/python3.10/dist-packages (from pandas<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2.8.2)\n", | |
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2022.7.1)\n", | |
"Requirement already satisfied: typing-extensions>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4->spacy~=3.0->nl4dv) (4.5.0)\n", | |
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy~=3.0->nl4dv) (1.26.15)\n", | |
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy~=3.0->nl4dv) (2022.12.7)\n", | |
"Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy~=3.0->nl4dv) (2.0.12)\n", | |
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3.0.0,>=2.13.0->spacy~=3.0->nl4dv) (3.4)\n", | |
"Requirement already satisfied: blis<0.8.0,>=0.7.8 in /usr/local/lib/python3.10/dist-packages (from thinc<8.2.0,>=8.1.8->spacy~=3.0->nl4dv) (0.7.9)\n", | |
"Requirement already satisfied: confection<1.0.0,>=0.0.1 in /usr/local/lib/python3.10/dist-packages (from thinc<8.2.0,>=8.1.8->spacy~=3.0->nl4dv) (0.0.4)\n", | |
"Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->spacy~=3.0->nl4dv) (2.1.2)\n", | |
"Requirement already satisfied: ipython-genutils in /usr/local/lib/python3.10/dist-packages (from ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.2.0)\n", | |
"Requirement already satisfied: ipython>=5.0.0 in /usr/local/lib/python3.10/dist-packages (from ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (7.34.0)\n", | |
"Requirement already satisfied: traitlets>=4.1.0 in /usr/local/lib/python3.10/dist-packages (from ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (5.7.1)\n", | |
"Requirement already satisfied: jupyter-client in /usr/local/lib/python3.10/dist-packages (from ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.1.12)\n", | |
"Requirement already satisfied: tornado>=4.2 in /usr/local/lib/python3.10/dist-packages (from ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.2)\n", | |
"Requirement already satisfied: widgetsnbextension~=3.6.0 in /usr/local/lib/python3.10/dist-packages (from ipywidgets->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (3.6.4)\n", | |
"Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from ipywidgets->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (3.0.7)\n", | |
"Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from jupyter-console->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (3.0.38)\n", | |
"Requirement already satisfied: pygments in /usr/local/lib/python3.10/dist-packages (from jupyter-console->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2.14.0)\n", | |
"Requirement already satisfied: lxml in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (4.9.2)\n", | |
"Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (4.11.2)\n", | |
"Requirement already satisfied: bleach in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (6.0.0)\n", | |
"Requirement already satisfied: defusedxml in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.7.1)\n", | |
"Requirement already satisfied: entrypoints>=0.2.2 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.4)\n", | |
"Requirement already satisfied: jupyter-core>=4.7 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (5.3.0)\n", | |
"Requirement already satisfied: jupyterlab-pygments in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.2.2)\n", | |
"Requirement already satisfied: mistune<2,>=0.8.1 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.8.4)\n", | |
"Requirement already satisfied: nbclient>=0.5.0 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.7.4)\n", | |
"Requirement already satisfied: nbformat>=5.1 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (5.8.0)\n", | |
"Requirement already satisfied: pandocfilters>=1.4.1 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (1.5.0)\n", | |
"Requirement already satisfied: tinycss2 in /usr/local/lib/python3.10/dist-packages (from nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (1.2.1)\n", | |
"Requirement already satisfied: pyzmq>=17 in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (23.2.1)\n", | |
"Requirement already satisfied: argon2-cffi in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (21.3.0)\n", | |
"Requirement already satisfied: nest-asyncio>=1.5 in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (1.5.6)\n", | |
"Requirement already satisfied: Send2Trash>=1.8.0 in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (1.8.0)\n", | |
"Requirement already satisfied: terminado>=0.8.3 in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.17.1)\n", | |
"Requirement already satisfied: prometheus-client in /usr/local/lib/python3.10/dist-packages (from notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.16.0)\n", | |
"Collecting qtpy>=2.0.1 (from qtconsole->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv)\n", | |
" Downloading QtPy-2.3.1-py3-none-any.whl (84 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m84.9/84.9 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hCollecting jedi>=0.16 (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv)\n", | |
" Downloading jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m35.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hRequirement already satisfied: decorator in /usr/local/lib/python3.10/dist-packages (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (4.4.2)\n", | |
"Requirement already satisfied: pickleshare in /usr/local/lib/python3.10/dist-packages (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.7.5)\n", | |
"Requirement already satisfied: backcall in /usr/local/lib/python3.10/dist-packages (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.2.0)\n", | |
"Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.10/dist-packages (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.1.6)\n", | |
"Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.10/dist-packages (from ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (4.8.0)\n", | |
"Requirement already satisfied: platformdirs>=2.5 in /usr/local/lib/python3.10/dist-packages (from jupyter-core>=4.7->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (3.3.0)\n", | |
"Requirement already satisfied: fastjsonschema in /usr/local/lib/python3.10/dist-packages (from nbformat>=5.1->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2.16.3)\n", | |
"Requirement already satisfied: jsonschema>=2.6 in /usr/local/lib/python3.10/dist-packages (from nbformat>=5.1->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (4.3.3)\n", | |
"Requirement already satisfied: wcwidth in /usr/local/lib/python3.10/dist-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->jupyter-console->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.2.6)\n", | |
"Requirement already satisfied: ptyprocess in /usr/local/lib/python3.10/dist-packages (from terminado>=0.8.3->notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.7.0)\n", | |
"Requirement already satisfied: argon2-cffi-bindings in /usr/local/lib/python3.10/dist-packages (from argon2-cffi->notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (21.2.0)\n", | |
"Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.10/dist-packages (from beautifulsoup4->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2.4.1)\n", | |
"Requirement already satisfied: webencodings in /usr/local/lib/python3.10/dist-packages (from bleach->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.5.1)\n", | |
"Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.10/dist-packages (from jedi>=0.16->ipython>=5.0.0->ipykernel->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.8.3)\n", | |
"Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=2.6->nbformat>=5.1->nbconvert->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (0.19.3)\n", | |
"Requirement already satisfied: cffi>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from argon2-cffi-bindings->argon2-cffi->notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (1.15.1)\n", | |
"Requirement already satisfied: pycparser in /usr/local/lib/python3.10/dist-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->notebook->jupyter<2.0.0,>=1.0.0->vega~=3.1->nl4dv) (2.21)\n", | |
"Building wheels for collected packages: nl4dv, fuzzywuzzy, python-Levenshtein, si-prefix, atomicwrites\n", | |
" Building wheel for nl4dv (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for nl4dv: filename=nl4dv-2.1.0-py3-none-any.whl size=55661 sha256=7ff376b4bf2f32cef5bac636e8ebc7db8cca18d20e77ea6a596b06097adf1416\n", | |
" Stored in directory: /root/.cache/pip/wheels/48/53/98/d6ee7e2a8c3dd416879a2930e535ac6f02292234bdd79cca79\n", | |
" Building wheel for fuzzywuzzy (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for fuzzywuzzy: filename=fuzzywuzzy-0.8.2-py3-none-any.whl size=12408 sha256=4f4c247bb8b301f8b726d09e230936eb76afa4fdac4598f1779b78d3cb28306c\n", | |
" Stored in directory: /root/.cache/pip/wheels/11/a9/b5/5722a4f679880b944fd3634c84b7f6eaf6edb96c256d8bf173\n", | |
" Building wheel for python-Levenshtein (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for python-Levenshtein: filename=python_Levenshtein-0.12.2-cp310-cp310-linux_x86_64.whl size=169651 sha256=ba74f7a882f8f77f0ee9408e7bf03bbff2c6f349ed7f6ec3cdc050099b6f6203\n", | |
" Stored in directory: /root/.cache/pip/wheels/7b/c3/05/60b4747cf52e0f6b6ee52022088a4de07d755016493e86373d\n", | |
" Building wheel for si-prefix (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for si-prefix: filename=si_prefix-1.2.2-py3-none-any.whl size=5860 sha256=78bc365e3ed41ee5c5a603d87633d0ac536bf634aa2c38cd9cc8dce291d9892d\n", | |
" Stored in directory: /root/.cache/pip/wheels/3d/bf/4f/aebf41c9963204cb2d59b967b453e4162c5495793762b8ad31\n", | |
" Building wheel for atomicwrites (setup.py) ... \u001b[?25l\u001b[?25hdone\n", | |
" Created wheel for atomicwrites: filename=atomicwrites-1.4.1-py2.py3-none-any.whl size=6943 sha256=58a2bd34efa0cefe970df603a13cd67af9f7fa85e7e7b5cc782cd228be77621d\n", | |
" Stored in directory: /root/.cache/pip/wheels/34/07/0b/33b15f68736109f72ea0bb2499521d87312b932620737447a2\n", | |
"Successfully built nl4dv fuzzywuzzy python-Levenshtein si-prefix atomicwrites\n", | |
"Installing collected packages: si-prefix, fuzzywuzzy, qtpy, python-Levenshtein, py, jedi, inflect, coverage, atomicwrites, pytest, pytest-cov, qtconsole, jupyter, vega, nl4dv\n", | |
" Attempting uninstall: inflect\n", | |
" Found existing installation: inflect 6.0.4\n", | |
" Uninstalling inflect-6.0.4:\n", | |
" Successfully uninstalled inflect-6.0.4\n", | |
" Attempting uninstall: pytest\n", | |
" Found existing installation: pytest 7.2.2\n", | |
" Uninstalling pytest-7.2.2:\n", | |
" Successfully uninstalled pytest-7.2.2\n", | |
"Successfully installed atomicwrites-1.4.1 coverage-7.2.5 fuzzywuzzy-0.8.2 inflect-5.5.2 jedi-0.18.2 jupyter-1.0.0 nl4dv-2.1.0 py-1.11.0 pytest-3.10.1 pytest-cov-2.6.1 python-Levenshtein-0.12.2 qtconsole-5.4.3 qtpy-2.3.1 si-prefix-1.2.2 vega-3.6.0\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "12_gHFiu9DgR" | |
}, | |
"source": [ | |
"# Imports" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ZpHtTpwe7qc_", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "5b416cad-8a28-4c76-8bdd-41d41352c6e3" | |
}, | |
"source": [ | |
"import json\n", | |
"from nl4dv import NL4DV\n", | |
"import altair as alt\n", | |
"from altair import vega, vegalite\n", | |
"vega.renderers.enable('colab')\n", | |
"vegalite.renderers.enable('colab')\n", | |
"from IPython.display import display" | |
], | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stderr", | |
"text": [ | |
"/usr/local/lib/python3.10/dist-packages/altair/vega/v5/__init__.py:18: AltairDeprecationWarning: The module altair.vega.v5 is deprecated and will be removed in Altair 5.\n", | |
" warnings.warn(\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "bop6Xpjd9P1Y" | |
}, | |
"source": [ | |
"# Initialize NL4DV with a Movies Dataset" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "ctufGetS8CMa" | |
}, | |
"source": [ | |
"data_url = \"https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv\"\n", | |
"label_attribute = None\n", | |
"dependency_parser_config = {\"name\": \"spacy\", \"model\": \"en_core_web_sm\", \"parser\": None}\n", | |
"\n", | |
"nl4dv_instance = NL4DV(verbose=False, \n", | |
" debug=True, \n", | |
" data_url=data_url, \n", | |
" label_attribute=label_attribute, \n", | |
" dependency_parser_config=dependency_parser_config\n", | |
" )\n", | |
"\n" | |
], | |
"execution_count": 3, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "YsDKa36w8-GX" | |
}, | |
"source": [ | |
"# Analyze Query and Render the most relevant Visualization" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "BDuB4S7d8Q2G", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 266 | |
}, | |
"outputId": "ad4053c5-a118-40ea-9092-63e2e3a65f9f" | |
}, | |
"source": [ | |
"nl4dv_response = nl4dv_instance.analyze_query(\"Show the relationship between budget and rating for Action and Adventure movies that grossed over 100M.\")\n", | |
"display(alt.display.html_renderer(nl4dv_response['visList'][0]['vlSpec']), raw=True)" | |
], | |
"execution_count": 4, | |
"outputs": [ | |
{ | |
"output_type": "display_data", | |
"data": { | |
"text/html": [ | |
"\n", | |
"<div id=\"altair-viz-38089fbcdfb1468b8b4dc3873616dbc3\"></div>\n", | |
"<script type=\"text/javascript\">\n", | |
" var VEGA_DEBUG = (typeof VEGA_DEBUG == \"undefined\") ? {} : VEGA_DEBUG;\n", | |
" (function(spec, embedOpt){\n", | |
" let outputDiv = document.currentScript.previousElementSibling;\n", | |
" if (outputDiv.id !== \"altair-viz-38089fbcdfb1468b8b4dc3873616dbc3\") {\n", | |
" outputDiv = document.getElementById(\"altair-viz-38089fbcdfb1468b8b4dc3873616dbc3\");\n", | |
" }\n", | |
" const paths = {\n", | |
" \"vega\": \"https://cdn.jsdelivr.net/npm//vega@5?noext\",\n", | |
" \"vega-lib\": \"https://cdn.jsdelivr.net/npm//vega-lib?noext\",\n", | |
" \"vega-lite\": \"https://cdn.jsdelivr.net/npm//vega-lite@4.17.0?noext\",\n", | |
" \"vega-embed\": \"https://cdn.jsdelivr.net/npm//vega-embed@6?noext\",\n", | |
" };\n", | |
"\n", | |
" function maybeLoadScript(lib, version) {\n", | |
" var key = `${lib.replace(\"-\", \"\")}_version`;\n", | |
" return (VEGA_DEBUG[key] == version) ?\n", | |
" Promise.resolve(paths[lib]) :\n", | |
" new Promise(function(resolve, reject) {\n", | |
" var s = document.createElement('script');\n", | |
" document.getElementsByTagName(\"head\")[0].appendChild(s);\n", | |
" s.async = true;\n", | |
" s.onload = () => {\n", | |
" VEGA_DEBUG[key] = version;\n", | |
" return resolve(paths[lib]);\n", | |
" };\n", | |
" s.onerror = () => reject(`Error loading script: ${paths[lib]}`);\n", | |
" s.src = paths[lib];\n", | |
" });\n", | |
" }\n", | |
"\n", | |
" function showError(err) {\n", | |
" outputDiv.innerHTML = `<div class=\"error\" style=\"color:red;\">${err}</div>`;\n", | |
" throw err;\n", | |
" }\n", | |
"\n", | |
" function displayChart(vegaEmbed) {\n", | |
" vegaEmbed(outputDiv, spec, embedOpt)\n", | |
" .catch(err => showError(`Javascript Error: ${err.message}<br>This usually means there's a typo in your chart specification. See the javascript console for the full traceback.`));\n", | |
" }\n", | |
"\n", | |
" if(typeof define === \"function\" && define.amd) {\n", | |
" requirejs.config({paths});\n", | |
" require([\"vega-embed\"], displayChart, err => showError(`Error loading script: ${err.message}`));\n", | |
" } else {\n", | |
" maybeLoadScript(\"vega\", \"5\")\n", | |
" .then(() => maybeLoadScript(\"vega-lite\", \"4.17.0\"))\n", | |
" .then(() => maybeLoadScript(\"vega-embed\", \"6\"))\n", | |
" .catch(showError)\n", | |
" .then(() => displayChart(vegaEmbed));\n", | |
" }\n", | |
" })({\"$schema\": \"https://vega.github.io/schema/vega-lite/v4.json\", \"mark\": {\"type\": \"point\", \"tooltip\": true}, \"encoding\": {\"x\": {\"field\": \"Production Budget\", \"type\": \"quantitative\", \"axis\": {\"format\": \"s\"}}, \"y\": {\"field\": \"IMDB Rating\", \"type\": \"quantitative\", \"axis\": {\"format\": \"s\"}}, \"tooltip\": {\"field\": \"Title\"}}, \"transform\": [{\"filter\": \"lower(datum[\\\"Worldwide Gross\\\"]) > 100000000.0\"}, {\"filter\": {\"field\": \"Genre\", \"oneOf\": [\"Action\", \"Adventure\"]}}], \"data\": {\"url\": \"https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv\", \"format\": {\"type\": \"csv\"}}}, {\"mode\": \"vega-lite\"});\n", | |
"</script>" | |
] | |
}, | |
"metadata": {} | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "uVtbJnsM8W7H" | |
}, | |
"source": [ | |
"# attributeMap" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "FIr3G4DY8cfb", | |
"outputId": "79c3ad19-5eef-4e0f-d94d-1384562caa1b" | |
}, | |
"source": [ | |
"nl4dv_response['attributeMap']" | |
], | |
"execution_count": 5, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"{'Worldwide Gross': {'name': 'Worldwide Gross',\n", | |
" 'queryPhrase': ['grossed'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'matchScore': 0.9,\n", | |
" 'metric': ['attribute_similarity_match'],\n", | |
" 'isLabel': False,\n", | |
" 'encode': False,\n", | |
" 'isAmbiguous': False,\n", | |
" 'ambiguity': [],\n", | |
" 'meta': {'score': 100,\n", | |
" 'threshold': 85,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {},\n", | |
" 'dataType': 'Q',\n", | |
" 'confidence': 100}},\n", | |
" 'Production Budget': {'name': 'Production Budget',\n", | |
" 'queryPhrase': ['budget'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'matchScore': 0.9,\n", | |
" 'metric': ['attribute_similarity_match'],\n", | |
" 'isLabel': False,\n", | |
" 'encode': True,\n", | |
" 'isAmbiguous': False,\n", | |
" 'ambiguity': [],\n", | |
" 'meta': {'score': 100,\n", | |
" 'threshold': 85,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {},\n", | |
" 'dataType': 'Q',\n", | |
" 'confidence': 100}},\n", | |
" 'Content Rating': {'name': 'Content Rating',\n", | |
" 'queryPhrase': ['rating'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'matchScore': 0.9,\n", | |
" 'metric': ['attribute_similarity_match'],\n", | |
" 'isLabel': False,\n", | |
" 'encode': True,\n", | |
" 'isAmbiguous': True,\n", | |
" 'ambiguity': ['Rotten Tomatoes Rating', 'IMDB Rating'],\n", | |
" 'meta': {'score': 100,\n", | |
" 'threshold': 85,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {},\n", | |
" 'dataType': 'N',\n", | |
" 'confidence': 50}},\n", | |
" 'Rotten Tomatoes Rating': {'name': 'Rotten Tomatoes Rating',\n", | |
" 'queryPhrase': ['rating'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'matchScore': 0.9,\n", | |
" 'metric': ['attribute_similarity_match'],\n", | |
" 'isLabel': False,\n", | |
" 'encode': True,\n", | |
" 'isAmbiguous': True,\n", | |
" 'ambiguity': ['Content Rating', 'IMDB Rating'],\n", | |
" 'meta': {'score': 100,\n", | |
" 'threshold': 85,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {},\n", | |
" 'dataType': 'Q',\n", | |
" 'confidence': 36}},\n", | |
" 'IMDB Rating': {'name': 'IMDB Rating',\n", | |
" 'queryPhrase': ['rating'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'matchScore': 0.9,\n", | |
" 'metric': ['attribute_similarity_match'],\n", | |
" 'isLabel': False,\n", | |
" 'encode': True,\n", | |
" 'isAmbiguous': True,\n", | |
" 'ambiguity': ['Content Rating', 'Rotten Tomatoes Rating'],\n", | |
" 'meta': {'score': 100,\n", | |
" 'threshold': 85,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {},\n", | |
" 'dataType': 'Q',\n", | |
" 'confidence': 59}},\n", | |
" 'Genre': {'name': 'Genre',\n", | |
" 'queryPhrase': ['action', 'adventure'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'matchScore': 0.5,\n", | |
" 'metric': ['attribute_domain_value_match'],\n", | |
" 'isLabel': False,\n", | |
" 'isAmbiguous': False,\n", | |
" 'ambiguity': [],\n", | |
" 'encode': False,\n", | |
" 'meta': {'score': None,\n", | |
" 'threshold': None,\n", | |
" 'alias': None,\n", | |
" 'ambiguity': {'action': ['Action'], 'adventure': ['Adventure']},\n", | |
" 'dataType': 'N',\n", | |
" 'confidence': 100}}}" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 5 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "Fo1PLx-U8dfq" | |
}, | |
"source": [ | |
"# taskMap" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "RFNFYbjk8joH", | |
"outputId": "0bee8981-8883-4079-84d9-8448a08c57d4" | |
}, | |
"source": [ | |
"nl4dv_response['taskMap']" | |
], | |
"execution_count": 6, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"{'filter': [{'task': 'filter',\n", | |
" 'queryPhrase': 'over',\n", | |
" 'operator': 'GT',\n", | |
" 'values': [100000000.0],\n", | |
" 'matchScore': 1,\n", | |
" 'attributes': ['Worldwide Gross'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'isAttrAmbiguous': False,\n", | |
" 'isValueAmbiguous': False,\n", | |
" 'meta': {'value_ambiguity_type': None},\n", | |
" 'followup_type': 'nothing'},\n", | |
" {'task': 'filter',\n", | |
" 'queryPhrase': ['action', 'adventure'],\n", | |
" 'operator': 'IN',\n", | |
" 'values': ['Action', 'Adventure'],\n", | |
" 'matchScore': 1,\n", | |
" 'attributes': ['Genre'],\n", | |
" 'inferenceType': 'explicit',\n", | |
" 'isAttrAmbiguous': False,\n", | |
" 'isValueAmbiguous': False,\n", | |
" 'meta': {'value_ambiguity_type': None},\n", | |
" 'followup_type': 'nothing'}],\n", | |
" 'correlation': [{'task': 'correlation',\n", | |
" 'queryPhrase': [],\n", | |
" 'operator': None,\n", | |
" 'values': None,\n", | |
" 'matchScore': 0.5,\n", | |
" 'attributes': ['Worldwide Gross', 'Production Budget'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'isAttrAmbiguous': False,\n", | |
" 'isValueAmbiguous': False,\n", | |
" 'meta': {'value_ambiguity_type': None},\n", | |
" 'followup_type': None}]}" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 6 | |
} | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "BDDCiE3a8s8j" | |
}, | |
"source": [ | |
"# visList" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "RPOCrCLv8ugD", | |
"outputId": "19067114-1ea8-4480-9712-0c3c851cdbe0" | |
}, | |
"source": [ | |
"nl4dv_response['visList']" | |
], | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"[{'score': 5.39,\n", | |
" 'scoreObj': {'by_attributes': 1.8, 'by_task': 2, 'by_vis': 0},\n", | |
" 'confidenceObj': {'Production Budget': 1.0, 'IMDB Rating': 0.59},\n", | |
" 'attributes': ['Production Budget', 'IMDB Rating'],\n", | |
" 'queryPhrase': None,\n", | |
" 'visType': None,\n", | |
" 'tasks': ['filter', 'correlation'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'vlSpec': {'$schema': 'https://vega.github.io/schema/vega-lite/v4.json',\n", | |
" 'mark': {'type': 'point', 'tooltip': True},\n", | |
" 'encoding': {'x': {'field': 'Production Budget',\n", | |
" 'type': 'quantitative',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'y': {'field': 'IMDB Rating',\n", | |
" 'type': 'quantitative',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'tooltip': {'field': 'Title'}},\n", | |
" 'transform': [{'filter': 'lower(datum[\"Worldwide Gross\"]) > 100000000.0'},\n", | |
" {'filter': {'field': 'Genre', 'oneOf': ['Action', 'Adventure']}}],\n", | |
" 'data': {'url': 'https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv',\n", | |
" 'format': {'type': 'csv'}}}},\n", | |
" {'score': 5.3,\n", | |
" 'scoreObj': {'by_attributes': 1.8, 'by_task': 2, 'by_vis': 0},\n", | |
" 'confidenceObj': {'Production Budget': 1.0, 'Content Rating': 0.5},\n", | |
" 'attributes': ['Production Budget', 'Content Rating'],\n", | |
" 'queryPhrase': None,\n", | |
" 'visType': None,\n", | |
" 'tasks': ['filter', 'correlation'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'vlSpec': {'$schema': 'https://vega.github.io/schema/vega-lite/v4.json',\n", | |
" 'mark': {'type': 'bar', 'tooltip': True},\n", | |
" 'encoding': {'y': {'field': 'Production Budget',\n", | |
" 'type': 'quantitative',\n", | |
" 'aggregate': 'mean',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'x': {'field': 'Content Rating', 'type': 'nominal'}},\n", | |
" 'transform': [{'filter': 'lower(datum[\"Worldwide Gross\"]) > 100000000.0'},\n", | |
" {'filter': {'field': 'Genre', 'oneOf': ['Action', 'Adventure']}}],\n", | |
" 'data': {'url': 'https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv',\n", | |
" 'format': {'type': 'csv'}}}},\n", | |
" {'score': 5.3,\n", | |
" 'scoreObj': {'by_attributes': 1.8, 'by_task': 2, 'by_vis': 0},\n", | |
" 'confidenceObj': {'Production Budget': 1.0, 'Content Rating': 0.5},\n", | |
" 'attributes': ['Production Budget', 'Content Rating'],\n", | |
" 'queryPhrase': None,\n", | |
" 'visType': None,\n", | |
" 'tasks': ['filter', 'correlation'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'vlSpec': {'$schema': 'https://vega.github.io/schema/vega-lite/v4.json',\n", | |
" 'mark': {'type': 'tick', 'tooltip': True},\n", | |
" 'encoding': {'y': {'field': 'Production Budget',\n", | |
" 'type': 'quantitative',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'x': {'field': 'Content Rating', 'type': 'nominal'},\n", | |
" 'tooltip': {'field': 'Title'}},\n", | |
" 'transform': [{'filter': 'lower(datum[\"Worldwide Gross\"]) > 100000000.0'},\n", | |
" {'filter': {'field': 'Genre', 'oneOf': ['Action', 'Adventure']}}],\n", | |
" 'data': {'url': 'https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv',\n", | |
" 'format': {'type': 'csv'}}}},\n", | |
" {'score': 5.16,\n", | |
" 'scoreObj': {'by_attributes': 1.8, 'by_task': 2, 'by_vis': 0},\n", | |
" 'confidenceObj': {'Production Budget': 1.0, 'Rotten Tomatoes Rating': 0.36},\n", | |
" 'attributes': ['Production Budget', 'Rotten Tomatoes Rating'],\n", | |
" 'queryPhrase': None,\n", | |
" 'visType': None,\n", | |
" 'tasks': ['filter', 'correlation'],\n", | |
" 'inferenceType': 'implicit',\n", | |
" 'vlSpec': {'$schema': 'https://vega.github.io/schema/vega-lite/v4.json',\n", | |
" 'mark': {'type': 'point', 'tooltip': True},\n", | |
" 'encoding': {'x': {'field': 'Production Budget',\n", | |
" 'type': 'quantitative',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'y': {'field': 'Rotten Tomatoes Rating',\n", | |
" 'type': 'quantitative',\n", | |
" 'axis': {'format': 's'}},\n", | |
" 'tooltip': {'field': 'Title'}},\n", | |
" 'transform': [{'filter': 'lower(datum[\"Worldwide Gross\"]) > 100000000.0'},\n", | |
" {'filter': {'field': 'Genre', 'oneOf': ['Action', 'Adventure']}}],\n", | |
" 'data': {'url': 'https://raw.githubusercontent.com/nl4dv/nl4dv/master/examples/assets/data/movies-w-year.csv',\n", | |
" 'format': {'type': 'csv'}}}}]" | |
] | |
}, | |
"metadata": {}, | |
"execution_count": 7 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment