{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import plotly.graph_objs as go\n", "from plotly.offline import iplot" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "def sigmoid(x): return 1 / (1 + np.exp(-x))" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "import plotly" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "linkText": "Export to plot.ly", "plotlyServerURL": "https://plot.ly", "showLink": false }, "data": [ { "name": "Logistic Sigmoig Function", "type": "scatter", "uid": "dc9da23f-1f67-4c50-80fe-d09e26ca83c6", "x": [ -3, -2.877551020408163, -2.7551020408163267, -2.63265306122449, -2.510204081632653, -2.387755102040816, -2.2653061224489797, -2.142857142857143, -2.020408163265306, -1.8979591836734695, -1.7755102040816326, -1.653061224489796, -1.5306122448979593, -1.4081632653061225, -1.2857142857142858, -1.163265306122449, -1.0408163265306123, -0.9183673469387754, -0.795918367346939, -0.6734693877551021, -0.5510204081632653, -0.4285714285714288, -0.30612244897959195, -0.18367346938775508, -0.06122448979591866, 0.06122448979591821, 0.18367346938775508, 0.30612244897959195, 0.4285714285714284, 0.5510204081632653, 0.6734693877551021, 0.7959183673469385, 0.9183673469387754, 1.0408163265306118, 1.1632653061224492, 1.2857142857142856, 1.408163265306122, 1.5306122448979593, 1.6530612244897958, 1.7755102040816322, 1.8979591836734695, 2.020408163265306, 2.1428571428571423, 2.2653061224489797, 2.387755102040816, 2.5102040816326525, 2.63265306122449, 2.7551020408163263, 2.8775510204081627, 3 ], "y": [ 0.04742587317756678, 0.05327451893176788, 0.05979915196935955, 0.06706626206221289, 0.07514592477989067, 0.08411120962804627, 0.0940373426564131, 0.10500058502026482, 0.11707679251885515, 0.13033962889780085, 0.1448584187816685, 0.16069564543750045, 0.1779041247108555, 0.19652391928791133, 0.21657909576817594, 0.23807446841118732, 0.2609925138751208, 0.2852906753756516, 0.3108992959934997, 0.33772042265646074, 0.36562769891588276, 0.3944675127794143, 0.42406148615175193, 0.454210290251928, 0.48469865693061814, 0.5153013430693818, 0.5457897097480721, 0.5759385138482481, 0.6055324872205856, 0.6343723010841171, 0.6622795773435391, 0.6891007040065003, 0.7147093246243483, 0.7390074861248791, 0.7619255315888127, 0.783420904231824, 0.8034760807120886, 0.8220958752891444, 0.8393043545624996, 0.8551415812183314, 0.8696603711021992, 0.8829232074811447, 0.8949994149797352, 0.9059626573435868, 0.9158887903719538, 0.9248540752201094, 0.9329337379377871, 0.9402008480306404, 0.9467254810682321, 0.9525741268224334 ] } ], "layout": { "autosize": true, "title": { "text": "Logistic Sigmoid Function" }, "xaxis": { "autorange": true, "range": [ -3, 3 ], "type": "linear" }, "yaxis": { "autorange": true, "range": [ -0.0028601409138146947, 1.002860140913815 ], "type": "linear" } } } }, "metadata": {}, "output_type": "display_data" } ], "source": [ "xrange = np.linspace(-3, 3)\n", "yvals = sigmoid(xrange)\n", "\n", "data = [\n", " {\"x\": xrange, \"y\": yvals, \"name\": \"Logistic Sigmoig Function\"}\n", "]\n", "\n", "layout = {\n", " \"title\": \"Logistic Sigmoid Function\"\n", "}\n", "\n", "\n", "fig = go.FigureWidget(data)\n", "iplot(fig)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.8" } }, "nbformat": 4, "nbformat_minor": 2 }