From b24257d917704ae9e3704310a1161778901e236b Mon Sep 17 00:00:00 2001 From: Josue Rivera Date: Tue, 1 Sep 2020 20:23:21 +0200 Subject: [PATCH 1/2] lab-started --- .../probability-intro/your-code/main.ipynb | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/module-2/probability-intro/your-code/main.ipynb b/module-2/probability-intro/your-code/main.ipynb index 576a36eb..5bb51d88 100644 --- a/module-2/probability-intro/your-code/main.ipynb +++ b/module-2/probability-intro/your-code/main.ipynb @@ -20,7 +20,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "\"\"\"\n", @@ -45,7 +47,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "\"\"\"\n", @@ -71,7 +75,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "\"\"\"\n", @@ -102,17 +108,42 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "[0.675, 0.325, 0.675, 0.325]" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "# your code here" + "# your code here\n", + "\n", + "Pm_yes =324/480\n", + "Pm_no =156/480\n", + "\n", + "Pw_yes =351/520\n", + "Pw_no =169/520\n", + "\n", + "lst=[Pm_yes, Pm_no, Pw_yes, Pw_no]\n", + "\n", + "# lst equal proportion" ] }, { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "\"\"\"\n", @@ -137,7 +168,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.5.4" } }, "nbformat": 4, From 9c2835afa85da9113301cf7b20825078789985c4 Mon Sep 17 00:00:00 2001 From: Josue Rivera Date: Wed, 11 Nov 2020 05:07:14 +0100 Subject: [PATCH 2/2] lab-finished --- .../probability-intro/your-code/main.ipynb | 155 +++++++++++++++--- 1 file changed, 132 insertions(+), 23 deletions(-) diff --git a/module-2/probability-intro/your-code/main.ipynb b/module-2/probability-intro/your-code/main.ipynb index 5bb51d88..254e5197 100644 --- a/module-2/probability-intro/your-code/main.ipynb +++ b/module-2/probability-intro/your-code/main.ipynb @@ -19,15 +19,32 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n", + "P(A U B) = 0.6 is False\n", + " \n", + "Explanation:\n", + " P(A ∪ B) = [P(A)= 0.3] + [P(B) = 0.6] - [P(A ∩ B) = 0.1] = 0.8 \n", + " P(A ∪ B) = 0.8\n" + ] + } + ], "source": [ - "\"\"\"\n", - "your solution here\n", - "\"\"\"" + "\n", + "print(\" \")\n", + "print(\"P(A U B) = 0.6 is False\")\n", + "print(\" \")\n", + "print(\"Explanation:\")\n", + "print(\" P(A ∪ B) = [P(A)= 0.3] + [P(B) = 0.6] - [P(A ∩ B) = 0.1] = 0.8 \")\n", + "print(\" P(A ∪ B) = 0.8\")" ] }, { @@ -46,15 +63,52 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Taking a white ball out:\n", + " \n", + " -- P = 10 / (12 + 8 + 10) = 1/3\n", + " \n", + "Taking a white ball out after taking a black ball out:\n", + " \n", + " -- P = 10 / (30 - 1) = 10/29\n", + " \n", + "Taking a red ball out after taking a black and a red ball out:\n", + " \n", + " -- P = (12 - 1) / (30 - 2) = 11/28\n", + " \n", + "Taking a red ball out after taking a black and a red ball out with reposition:\n", + " \n", + " -- P = (12 - 1) / (30 - 2 + 1) = 11/29\n", + " \n" + ] + } + ], "source": [ - "\"\"\"\n", - "your solution here\n", - "\"\"\"" + "\n", + "print(\"Taking a white ball out:\")\n", + "print(\" \")\n", + "print(\" -- P = 10 / (12 + 8 + 10) = 1/3\")\n", + "print(\" \")\n", + "print(\"Taking a white ball out after taking a black ball out:\")\n", + "print(\" \")\n", + "print(\" -- P = 10 / (30 - 1) = 10/29\")\n", + "print(\" \")\n", + "print(\"Taking a red ball out after taking a black and a red ball out:\")\n", + "print(\" \")\n", + "print(\" -- P = (12 - 1) / (30 - 2) = 11/28\")\n", + "print(\" \")\n", + "print(\"Taking a red ball out after taking a black and a red ball out with reposition:\")\n", + "print(\" \")\n", + "print(\" -- P = (12 - 1) / (30 - 2 + 1) = 11/29\")\n", + "print(\" \")" ] }, { @@ -74,15 +128,29 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": { - "collapsed": true + "collapsed": false }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n", + "The chance is: \n", + " \n", + " -- P( Rainy / Cloudy ) = 1/8\n", + " \n" + ] + } + ], "source": [ - "\"\"\"\n", - "your solution here\n", - "\"\"\"" + "print(\" \")\n", + "print(\"The chance is: \")\n", + "print(\" \")\n", + "print(\" -- P( Rainy / Cloudy ) = 1/8\")\n", + "print(\" \")" ] }, { @@ -138,6 +206,51 @@ "# lst equal proportion" ] }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " \n", + "Said No:\n", + " \n", + " -- P( No/ Men ) = 0.325\n", + " -- P( No/ Men ) = 0.325\n", + " -- P(No) = 0.325\n", + " \n", + "Said Yes:\n", + " \n", + " -- P( Yes/ Men ) = 0.675\n", + " -- P( Yes/ Men ) = 0.675\n", + " -- P(Yes) = 0.675\n", + " \n", + "THIS EVENTS ARE INDEPENDENT\n" + ] + } + ], + "source": [ + "print(\" \")\n", + "print(\"Said No:\")\n", + "print(\" \")\n", + "print(\" -- P( No/ Men ) = 0.325\")\n", + "print(\" -- P( No/ Men ) = 0.325\")\n", + "print(\" -- P(No) = 0.325\")\n", + "print(\" \")\n", + "print(\"Said Yes:\")\n", + "print(\" \")\n", + "print(\" -- P( Yes/ Men ) = 0.675\")\n", + "print(\" -- P( Yes/ Men ) = 0.675\")\n", + "print(\" -- P(Yes) = 0.675\")\n", + "print(\" \")\n", + "print(\"THIS EVENTS ARE INDEPENDENT\")" + ] + }, { "cell_type": "code", "execution_count": null, @@ -145,11 +258,7 @@ "collapsed": true }, "outputs": [], - "source": [ - "\"\"\"\n", - "your solution here\n", - "\"\"\"" - ] + "source": [] } ], "metadata": {