From 8af85f1563ed2878f811d47679ce15a12c4f7588 Mon Sep 17 00:00:00 2001 From: Vijay Arya Date: Mon, 13 Jul 2020 20:59:12 +0530 Subject: [PATCH] update to lime notebook --- examples/lime/LIME.ipynb | 148666 +----------------------------------- 1 file changed, 44 insertions(+), 148622 deletions(-) diff --git a/examples/lime/LIME.ipynb b/examples/lime/LIME.ipynb index f1a97d2..e16477b 100644 --- a/examples/lime/LIME.ipynb +++ b/examples/lime/LIME.ipynb @@ -108,7 +108,7 @@ { "data": { "text/plain": [ - "MultinomialNB(alpha=0.01, class_prior=None, fit_prior=True)" + "MultinomialNB(alpha=0.01)" ] }, "execution_count": 6, @@ -230,20 +230,20 @@ "output_type": "stream", "text": [ "Explanation for class atheism\n", - "('Caused', 0.2598306611703779)\n", - "('Rice', 0.1476407287363688)\n", - "('Genocide', 0.13182300286384235)\n", - "('scri', -0.09419412002335747)\n", - "('certainty', -0.09272741554383297)\n", - "('owlnet', -0.08993298975187172)\n", + "('Caused', 0.26238077066590293)\n", + "('Rice', 0.13518306047536863)\n", + "('Genocide', 0.13057135539747292)\n", + "('scri', -0.08935717895685585)\n", + "('owlnet', -0.0866086512211189)\n", + "('Semitic', -0.08450085710232705)\n", "\n", "Explanation for class mideast\n", - "('fsu', -0.05535199329931831)\n", - "('Theism', -0.05150493402341905)\n", - "('Luther', -0.04742295494991691)\n", - "('jews', 0.03810985477960863)\n", - "('Caused', -0.037706845450166455)\n", - "('PBS', 0.031228586744514376)\n" + "('fsu', -0.05515369453392734)\n", + "('Theism', -0.054747456372004545)\n", + "('Luther', -0.0470171558437435)\n", + "('Caused', -0.03726710714147818)\n", + "('jews', 0.03390695559844592)\n", + "('PBS', 0.032592761622772665)\n" ] } ], @@ -255,74292 +255,6 @@ "print ('\\n'.join(map(str, exp.as_list(label=17))))" ] }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[0, 15]\n" - ] - } - ], - "source": [ - "# aix360 style for explaining input instances\n", - "exp = limeexplainer.explain_instance(newsgroups_test.data[idx], c.predict_proba, num_features=6, top_labels=2)\n", - "print(exp.available_labels())" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - "
\n", - " \n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "exp.show_in_notebook(text=False)" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - "
\n", - " \n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "exp.show_in_notebook(text=newsgroups_test.data[idx], labels=(0,))" - ] - }, { "cell_type": "markdown", "metadata": {}, @@ -74552,7 +266,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -74569,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -74587,7 +301,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 15, "metadata": {}, "outputs": [], "source": [ @@ -74602,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -74619,7 +333,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -74630,16 +344,16 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "MultinomialNB(alpha=0.01, class_prior=None, fit_prior=True)" + "MultinomialNB(alpha=0.01)" ] }, - "execution_count": 21, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -74652,10 +366,8 @@ }, { "cell_type": "code", - "execution_count": 22, - "metadata": { - "scrolled": true - }, + "execution_count": 19, + "metadata": {}, "outputs": [ { "data": { @@ -74663,7 +375,7 @@ "0.8350184193998174" ] }, - "execution_count": 22, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -74682,7 +394,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 20, "metadata": {}, "outputs": [], "source": [ @@ -74692,10 +404,8 @@ }, { "cell_type": "code", - "execution_count": 24, - "metadata": { - "scrolled": true - }, + "execution_count": 21, + "metadata": {}, "outputs": [ { "name": "stdout", @@ -74712,7 +422,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -74730,7 +440,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -74754,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 24, "metadata": {}, "outputs": [ { @@ -74762,20 +472,20 @@ "output_type": "stream", "text": [ "Explanation for class atheism\n", - "('Caused', 0.2601154192014532)\n", - "('Rice', 0.14380270774013457)\n", - "('Genocide', 0.12202776283712338)\n", - "('owlnet', -0.0894833391913411)\n", - "('scri', -0.08839334155116563)\n", - "('certainty', -0.08588797496264497)\n", + "('Caused', 0.25632751113248026)\n", + "('Rice', 0.14626237282926857)\n", + "('Genocide', 0.13133950204310213)\n", + "('owlnet', -0.0905864608741577)\n", + "('scri', -0.08526752642948768)\n", + "('Semitic', -0.08287079245253995)\n", "\n", "Explanation for class mideast\n", - "('fsu', -0.053283740516256506)\n", - "('Theism', -0.05103765776729127)\n", - "('Luther', -0.04556208403350433)\n", - "('jews', 0.03472601688974457)\n", - "('Caused', -0.03463184676401465)\n", - "('PBS', 0.02914905322207845)\n" + "('fsu', -0.05714575197470851)\n", + "('Theism', -0.05248892887178565)\n", + "('Luther', -0.05034586274638904)\n", + "('Rice', -0.03470048019899408)\n", + "('jews', 0.03372175158157365)\n", + "('PBS', 0.030816731955572742)\n" ] } ], @@ -74786,74294 +496,6 @@ "print ('Explanation for class %s' % class_names[17])\n", "print ('\\n'.join(map(str, exp.as_list(label=17))))" ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "[0, 15]\n" - ] - } - ], - "source": [ - "# LIME original style for explaining input instances\n", - "exp = explainer.explain_instance(newsgroups_test.data[idx], c.predict_proba, num_features=6, top_labels=2)\n", - "print(exp.available_labels())" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - "
\n", - " \n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "exp.show_in_notebook(text=False)" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": { - "scrolled": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - " \n", - " \n", - "
\n", - " \n", - " \n", - " " - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "exp.show_in_notebook(text=newsgroups_test.data[idx], labels=(0,))" - ] } ], "metadata": { @@ -149092,9 +514,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.10" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }