You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
16 KiB
Plaintext
81 lines
16 KiB
Plaintext
5 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"import numpy as np\n",
|
||
|
"import pandas as pd\n",
|
||
|
"\n",
|
||
|
"x = np.arange(-4,4)\n",
|
||
|
"def sigmoid(x):\n",
|
||
|
" e = np.exp(-x)\n",
|
||
|
" return np.divide(1,e + e)\n",
|
||
|
"df = pd.DataFrame({\"x\":x,\"tanh\":np.tanh(x),\"sigmoid\":sigmoid( np.tanh(x))})"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/plain": [
|
||
|
"<matplotlib.axes._subplots.AxesSubplot at 0x7ff349080d30>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 10,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
},
|
||
|
{
|
||
|
"data": {
|
||
|
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAD4CAYAAAAEhuazAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXhU5d3/8fedhYRAWMKeAAZU9iVgQFRUFHeEQK11o9VatVWx2sVH69NFa31+trVaW63Voq1tBUTRgIpaUSm4IpCw78iShCVk35PJ3L8/zhACJJCQmZyZzOd1Xblytsz9TcRP7nzPmXOMtRYREQkvEW4XICIirU/hLyIShhT+IiJhSOEvIhKGFP4iImEoyu0CGtO9e3ebnJzsdhkiI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t+2ut8M8G+tVb7+vbJiKhoi74q5wZfxsKfmstq/cUkJ6Rw/JtuRRVODPumtqTz0EjIwzx9QI4PjaKbh3acVq3DnXr9UM9PiaKDseFeRQd2kUREdF6735urfBfBMwyxszDOdFb1Nx+v4i46LjgH+52RX6x/WAJ6Rk5LFyTzd78CmKiIrhgUA96d4o9avZ9dHhHH7UvJioCE4K3rPBL+Btj5gKTgO7GmCzgV0A0gLX2r8Bi4CpgO1AOfNcf44pIK8jfCS9PBU9lmwj+A8WVLMrMIT0zmw05xUQYOO+M7tw3eRCXj+hNx5ig6oYHjL+u9rnhJPstcLc/xhKRVpS/05nx11Q4wd97hNs
|
||
|
"text/plain": [
|
||
|
"<Figure size 432x288 with 1 Axes>"
|
||
|
]
|
||
|
},
|
||
|
"metadata": {
|
||
|
"needs_background": "light"
|
||
|
},
|
||
|
"output_type": "display_data"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"df[['tanh','sigmoid']].plot()"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": null,
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": []
|
||
|
}
|
||
|
],
|
||
|
"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.7"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 2
|
||
|
}
|