Skip to content

Instantly share code, notes, and snippets.

@taka-wang
Last active March 23, 2020 10:24
Show Gist options
  • Save taka-wang/bd9b22db366333a153a6d1340e8dda4c to your computer and use it in GitHub Desktop.
Save taka-wang/bd9b22db366333a153a6d1340e8dda4c to your computer and use it in GitHub Desktop.
ai basic1 snippets
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Import Packages"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"from math import log\n",
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Generate Data"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# definition\n",
"def entropy(props, base=2):\n",
" sum = 0\n",
" for prop in props:\n",
" sum += prop * log(prop, base)\n",
" return sum * -1\n",
" \n",
"# data\n",
"x = np.arange(0.01, 1, 0.01)\n",
"props = []\n",
"for i in x:\n",
" props.append([i, 1-i])\n",
"\n",
"y = [entropy(i) for i in props]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot Diagram"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEGCAYAAABo25JHAAAABHNCSVQICAgIfAhkiAAAAAlw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MYY1YCIbQuyubrXPoM6IivFMEaIENE0kUkiNbJ4IUnbLMQuLXt62uBL03bbIsX63C/RWQk8DKtJeALx4uhg/02xlQaY+KMMWnGmDRa50ZmGGNy7InbZVz573wBraMBRCSO1kNFBe4MaQFX9nsvMAVARDJpLYIyt6a0x0LgB21nD40HKo0xBzr7TXzi0JAxpklE7gU+p/UMg9eNMVtF5CkgxxizEHiN1uFiPq2TLzfal7hruLjfvwMigPfb5sb3GmNm2Ba6C7i43z7Hxf3+HLhYRLYBzcDDxhivHvm6uN8PAa+KyAO0Thzf5gO/6CEi82gt9ri2+Y+fA4EAxpiXaJ0PmQ7kA7XA7Wf0Pj7wb6WUUuos+MqhIaWUUmdIi0AppfycFoFSSvk5LQKllPJzWgRKKeXntAiUOksi8oGI9DnN60Ei8k3bhYxKeRwtAqXOgogMBpzGmFNetNW2UNpS4Aa3BVOqE7QIlHKBiKSJyHYReVtEcttGAWHAzcDHbdv0FpGdIhInIg4RWS4iF7d9iwVt2yrlcfSCMqVc0HYjo0JgojFmhYi8DmwDrgDuNcZsbtvuh8AlwGqgnzHm7rbnncBBY0y8DfGVOi0dESjlun3GmBVtX78FTASSaLemjTFmLq3r4v8I+I92zzcDDSIS6b64SrlGi0Ap1504fDbAMVoXOAOg7XDR8Zv/RJywfTC+c5Mc5UO0CJRyXWrbWvcANwHfArlAv3bbPAO8DTwBvHr8SRHpDpQbYxrdlFUpl2kRKOW6HcC/iUgu0A14EfiU/1v2+XxgDPCMMeZtWg8FHV8N8sK2bZXyODpZrJQL2iaL/26MGXLC86HAMuDctnmAU/39j4BHjDF5VuZU6kzoiECps2CMOUbrGvGnvE9s281UFmgJKE+lIwKllPJzOiJQSik/p0WglFJ+TotAKaX8nBaBUkr5OS0CpZTyc/8fJkS7Cyotsh8AAAAASUVORK5CYII=\n",
"text/plain": [
"<Figure size 432x288 with 1 Axes>"
]
},
"metadata": {
"needs_background": "light"
},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure()\n",
"ax = fig.add_subplot(111)\n",
"ax.plot(x,y)\n",
"ax.set_xlabel(\"p(x)\")\n",
"ax.set_ylabel(\"H(x)\")\n",
"\n",
"''' change style\n",
"# ref: https://stackoverflow.com/questions/1982770/matplotlib-changing-the-color-of-an-axis\n",
"ax.spines['bottom'].set_color('#dddddd')\n",
"ax.spines['top'].set_color('#dddddd') \n",
"ax.spines['right'].set_color('#dddddd')\n",
"ax.spines['left'].set_color('#dddddd')\n",
"ax.tick_params(axis='x', colors='white')\n",
"ax.tick_params(axis='y', colors='white')\n",
"ax.yaxis.label.set_color('white')\n",
"ax.xaxis.label.set_color('white')\n",
"'''\n",
"\n",
"# export\n",
"#plt.savefig('entropy.png', dpi=300, transparent=True)\n",
"plt.savefig('entropy.png', dpi=300)\n",
"plt.show()"
]
}
],
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment