Skip to content

Instantly share code, notes, and snippets.

@izmailovpavel
Last active October 13, 2017 21:45
Show Gist options
  • Save izmailovpavel/35bdc018d782eb118b8dfca102c0eba2 to your computer and use it in GitHub Desktop.
Save izmailovpavel/35bdc018d782eb118b8dfca102c0eba2 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import torch\n",
"from torch.autograd import Variable\n",
"import torch.optim as optim\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [],
"source": [
"class NomalDist:\n",
" def __init__(self, mu, sigma):\n",
" self.d = mu.size\n",
" sigma_cho = np.linalg.cholesky(sigma)\n",
" self.mu = Variable(torch.from_numpy(mu).float())\n",
" self.sigma = Variable(torch.from_numpy(sigma).float())\n",
" self.sigma_inv = torch.inverse(self.sigma)\n",
" self.sigma_cho = Variable(torch.from_numpy(sigma_cho).float())\n",
" \n",
" def loss(self, x):\n",
" return torch.matmul(torch.transpose(x - self.mu[:, None], 0, 1), \n",
" torch.matmul(self.sigma_inv, (x - self.mu[:, None])))\n",
" \n",
" def sample(self, n_samples):\n",
" z = Variable(torch.randn((n_samples, self.d)).float())\n",
" samples = torch.transpose(torch.matmul(self.sigma_cho, torch.transpose(z, 0, 1)), 0, 1)\n",
" samples += self.mu[None, :] \n",
" return samples.data.numpy()"
]
},
{
"cell_type": "markdown",
"metadata": {
"scrolled": true
},
"source": [
"Example samples"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10bc03668>]"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlw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3\nvybpeYXfGWAdd/+hpCttlx+UdKL1/QlJ/5broIZU2YDfxXsk/Sb2+LXWtTp70sx+1voTtVJ/gmaA\n34/uXNL3zeyMmc0XPZgSutPdX299/1tJdxY5mEGV+gAUM3tZ0rsTnlpw92/nPZ6y6vY+SToq6QsK\n/yN/QdKXJT2a3+hQMR9y94tm9heSfmBm/9ea6aKNu7uZVarMsdQB390/soH/7KKk98Uev7d1bWz1\n+z6Z2X9L+k7Gwym72v1+DMLdL7a+vmFmLyikwAj4a35nZne5++tmdpekN4oe0CDGMaXzoqSHzWyr\nmd0t6R5JPy54TIVp/VJGHlJY7K6zn0i6x8zuNrMtCgv8LxY8plIwsykz2xZ9L+mj4vel3YuSHml9\n/4ikSmUaSj3D78bMHpL0X5J2Svqumf3U3T/m7ufM7FuSfi7phqTPufvNIsdasC+Z2b0KKZ1lSY8X\nO5xiufsNM3tS0kuSJiQdd/dzBQ+rLO6U9IKZSSE2fMPdv1fskIpjZt+U9M+SdpjZa5L+Q9IXJX3L\nzB5T6Oz7qeJGODh22gJATYxjSgcAkICADwA1QcAHgJog4ANATRDwAaAmCPgAUBMEfACoCQI+ANTE\n/wOMKWenOWH35QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10efc3550>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mu = np.zeros([2], dtype=float)\n",
"sigma = np.array([[10, 9.9], [9.9, 10]])\n",
"dist = NomalDist(mu, sigma)\n",
"samples = dist.sample(1000)\n",
"plt.plot(samples[:, 0], samples[:, 1], 'ro')"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class SGHMC:\n",
" \n",
" def __init__(self, var, alpha, eta, log_density):\n",
" \"\"\"\n",
" Stochastic Gradient Monte Carlo sampler.\n",
" \n",
" Args:\n",
" var: `Variable` corresponding to the variable that is sampled\n",
" alpha: momentum parameter\n",
" eta: learning rate parameter\n",
" log_density: function computing log_density for a given sample\n",
" and batch of data\n",
" \"\"\"\n",
" self.var = var\n",
" self.alpha = alpha\n",
" self.eta = eta\n",
" self.log_density = log_density\n",
" self.optimizer = optim.SGD([self.var], lr=1, momentum=(1 - self.alpha))\n",
" \n",
" def _noise(self):\n",
" std = np.sqrt(2 * self.alpha * self.eta)\n",
" n = Variable(torch.normal(0, std= std * torch.ones(self.var.size())))\n",
" return torch.sum(n * self.var)\n",
" \n",
" def sample(self):\n",
" loss = self.log_density(self.var) * self.eta\n",
" loss += self._noise()\n",
" loss.backward()\n",
" self.optimizer.step()\n",
" self.var.grad.data.zero_()\n",
" return self.var"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = torch.from_numpy(np.array([[-10], [0]])).float()\n",
"x_v = Variable(x, requires_grad=True)\n",
"mu = np.zeros([2], dtype=float)\n",
"sigma = np.array([[10, 9.9], [9.9, 10]])\n",
"dist = NomalDist(mu, sigma)\n",
"sghmc = SGHMC(x_v, .01, 5e-3, dist.loss)"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"100\n",
"200\n",
"300\n",
"400\n",
"500\n",
"600\n",
"700\n",
"800\n",
"900\n",
"1000\n",
"1100\n",
"1200\n",
"1300\n",
"1400\n",
"1500\n",
"1600\n",
"1700\n",
"1800\n",
"1900\n",
"2000\n",
"2100\n",
"2200\n",
"2300\n",
"2400\n",
"2500\n",
"2600\n",
"2700\n",
"2800\n",
"2900\n",
"3000\n",
"3100\n",
"3200\n",
"3300\n",
"3400\n",
"3500\n",
"3600\n",
"3700\n",
"3800\n",
"3900\n",
"4000\n",
"4100\n",
"4200\n",
"4300\n",
"4400\n",
"4500\n",
"4600\n",
"4700\n",
"4800\n",
"4900\n",
"5000\n",
"5100\n",
"5200\n",
"5300\n",
"5400\n",
"5500\n",
"5600\n",
"5700\n",
"5800\n",
"5900\n",
"6000\n",
"6100\n",
"6200\n",
"6300\n",
"6400\n",
"6500\n",
"6600\n",
"6700\n",
"6800\n",
"6900\n",
"7000\n",
"7100\n",
"7200\n",
"7300\n",
"7400\n",
"7500\n",
"7600\n",
"7700\n",
"7800\n",
"7900\n",
"8000\n",
"8100\n",
"8200\n",
"8300\n",
"8400\n",
"8500\n",
"8600\n",
"8700\n",
"8800\n",
"8900\n",
"9000\n",
"9100\n",
"9200\n",
"9300\n",
"9400\n",
"9500\n",
"9600\n",
"9700\n",
"9800\n",
"9900\n"
]
}
],
"source": [
"samples = []\n",
"for epoch in range(10000):\n",
" w_sample = sghmc.sample()\n",
" samples.append(np.copy(w_sample.data.numpy()).T)\n",
" if not(epoch % 100):\n",
" print(epoch)"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(10000, 2)"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"samples = np.vstack(samples)\n",
"samples.shape"
]
},
{
"cell_type": "code",
"execution_count": 129,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10c2a2be0>]"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnX2MJMd53p93v0jv7dmyZk8QT9Lukokg6BgginQgRIM2\nGC2tUAdDjARFIbFHy3CA1e1awAmGkYheQBBs3B+EoTinRMvLxZZN34wlSolpMcoplEkqYOBEtJfE\nHb9ESkfpliKtSLxlwq8jTPKu8kd1a3t6u7qrP6q7uuf5AYWZ7e7trqmpqafqrbfeEqUUCCGEkJCx\npjNACCHELygMhBBChqAwEEIIGYLCQAghZAgKAyGEkCEoDIQQQoagMBBCCBmCwkAIIWQICgMhhJAh\nJprOQBFmZ2fVwsJC09k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BcAn1ZKvRg7/RC0GeTlYN7p\nL6EjJzdBq77PYC7zwwBuSTjtU7kC8FQYVEv3gMjKt4hMQO+R/b6UezwbvP5URO6ENkdUXuFty1hE\n/hOAbyScsinvSrAo198A8GsAFlVgtE24Ry3lGsOmjMJrngnqxy9A19PaEZFJaFEYKKX+In4+KhRK\nqZMisi4is0qp2mMTWXyftdVPSz4E4CGl1E/iJ3wq15AumZLasAfEdQCeUEo9k3RSRHaJyO7wPfTE\n6qM15i/MR9QW+xFDHv4WwDtFe3lNQQ+T76ojf1FE5HoA/xrAh5VS5w3XNFWuNmV0F3Q9BHS9vM8k\nbi4J5jX+GMB3lVL/1nDNW8P5DxG5Crr9qF3ELL/PuwD8euCd9H4ALyilflxzVqMYLQW+lOsQTc9+\n503QDdUzAP4ewE8A3B05twbtBfIkgA9Fjp8EsDd4fwW0YJwB8DUAl9SY9z8FcCh2bC+Ak5G8nQ7S\nY9CmkibK+ASARwA8DP0Duyye1+DvA9DeK081mNcz0LbkU0E6Fs9rk+WaVEYAfg9ayADg0qAengnq\n5RUNleM10KbDhyNleQDAobDOAvhUUH6noSf6f6mhvCZ+n7G8CoAvBuX+CCIejA3kdxd0Q/8LkWPe\nlWs0ceUzIYSQIbpkSiKEEFIBFAZCCCFDUBgIIYQMQWEghBAyBIWBEELIEBQGQgghQ1AYCCGEDEFh\nIIQQMsT/BzZ2uK9hLfzzAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10bf69b38>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"start_from=0\n",
"plus = 10000\n",
"plt.plot(samples[start_from:start_from+plus, 0], samples[start_from:start_from+plus, 1], 'bo')"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10bed2a58>]"
]
},
"execution_count": 130,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhE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SRuSPreZLvqM7X11D6pXRLysJCNwVtK3JP1r\nRHyhyjFM7EEbWWw/LuntGS8dU/LP+lYlX4PfK+l/235HVFwWNGSMn1aShqnVoDFGxOc333NMSXqh\nW+XYJp3tayX9saRfiYh/q3s8vWzfIek7EfGk7Q/WPZ4ceyS9R9J9EfGE7fslfVLSf693WFtsf7+S\nb4w3SfoXSf/H9oGIOF3VGFoV2CPitrzXbN8r6ZHNQP73ti8r6eWwUdX4pPwx2v4RJX8RvmJbSlIc\nT9l+X0R8u8IhDvz3KEm2PyrpDkm3Vv3BmONlSTf2PL5h87lGsX2VkqDejYhH6h5Phg9I+jnbt0t6\nk6TrbJ+OiAM1j6vXS5Jeioj0287DSgJ7k9wm6Z8jYkOSbD8i6SclVRbYpykV86eSPiRJtt8paa8a\n1EQoIr4WEW+LiOWIWFbyF/g9VQf1YWx/WMlX9Z+LiAt1j2fTP0j6Qds32d6rZKHqz2oe0xWcfFp/\nVtLzEfFbdY8nS0R8KiJu2Pz79xFJf9OwoK7N/z+8aPuHNp+6VdJzNQ4py1lJ77c9t/nf/VZVvMDb\nqhn7ECclnbT9jKSLkg42ZLY5aX5X0tWSHtv8ZvGliDhc54Ai4pLtX5b0V0oqEE5GxLN1jinDByTd\nJelrtp/efO7TEfFojWOaVPdJ6m5+iH9D0t01j+cKmymihyU9pSRd+WVVvAuVnacA0DLTlIoBgKlA\nYAeAliGwA0DLENgBoGUI7ADQMgR2AGgZAjsAtAyBHQBa5v8DwRG1KhFeEB0AAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10c28f898>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"freq = 10\n",
"new_samples = []\n",
"for i in range(int(samples.shape[0] / freq))[100:]:#[400:]:\n",
" new_samples.append(samples[i * freq][None, :])\n",
"new_samples = np.vstack(new_samples)\n",
"plt.plot(new_samples[:, 0], new_samples[:, 1], 'bo')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import torch\n",
"from torch.autograd import Variable\n",
"import torch.optim as optim\n",
"import numpy as np\n",
"from matplotlib import pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": 78,
"metadata": {},
"outputs": [],
"source": [
"class NomalDist:\n",
" def __init__(self, mu, sigma):\n",
" self.d = mu.size\n",
" sigma_cho = np.linalg.cholesky(sigma)\n",
" self.mu = Variable(torch.from_numpy(mu).float())\n",
" self.sigma = Variable(torch.from_numpy(sigma).float())\n",
" self.sigma_inv = torch.inverse(self.sigma)\n",
" self.sigma_cho = Variable(torch.from_numpy(sigma_cho).float())\n",
" \n",
" def loss(self, x):\n",
" return torch.matmul(torch.transpose(x - self.mu[:, None], 0, 1), \n",
" torch.matmul(self.sigma_inv, (x - self.mu[:, None])))\n",
" \n",
" def sample(self, n_samples):\n",
" z = Variable(torch.randn((n_samples, self.d)).float())\n",
" samples = torch.transpose(torch.matmul(self.sigma_cho, torch.transpose(z, 0, 1)), 0, 1)\n",
" samples += self.mu[None, :] \n",
" return samples.data.numpy()"
]
},
{
"cell_type": "markdown",
"metadata": {
"scrolled": true
},
"source": [
"Example samples"
]
},
{
"cell_type": "code",
"execution_count": 123,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10bc03668>]"
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSU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qG/Dd/Rfu/mrCUw9Ket7d/+Tuv5Z0XtJ9+Y4OJXafpPPu/it3\nvybpeYXfGWAdd/+hpCttlx+UdKL1/QlJ/5broIZU2YDfxXsk/Sb2+LXWtTp70sx+1voTtVJ/gmaA\n34/uXNL3zeyMmc0XPZgSutPdX299/1tJdxY5mEGV+gAUM3tZ0rsTnlpw92/nPZ6y6vY+SToq6QsK\n/yN/QdKXJT2a3+hQMR9y94tm9heSfmBm/9ea6aKNu7uZVarMsdQB390/soH/7KKk98Uev7d1bWz1\n+z6Z2X9L+k7Gwym72v1+DMLdL7a+vmFmLyikwAj4a35nZne5++tmdpekN4oe0CDGMaXzoqSHzWyr\nmd0t6R5JPy54TIVp/VJGHlJY7K6zn0i6x8zuNrMtCgv8LxY8plIwsykz2xZ9L+mj4vel3YuSHml9\n/4ikSmUaSj3D78bMHpL0X5J2Svqumf3U3T/m7ufM7FuSfi7phqTPufvNIsdasC+Z2b0KKZ1lSY8X\nO5xiufsNM3tS0kuSJiQdd/dzBQ+rLO6U9IKZSSE2fMPdv1fskIpjZt+U9M+SdpjZa5L+Q9IXJX3L\nzB5T6Oz7qeJGODh22gJATYxjSgcAkICADwA1QcAHgJog4ANATRDwAaAmCPgAUBMEfACoCQI+ANTE\n/wOMKWenOWH35QAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10efc3550>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"mu = np.zeros([2], dtype=float)\n",
"sigma = np.array([[10, 9.9], [9.9, 10]])\n",
"dist = NomalDist(mu, sigma)\n",
"samples = dist.sample(1000)\n",
"plt.plot(samples[:, 0], samples[:, 1], 'ro')"
]
},
{
"cell_type": "code",
"execution_count": 124,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"class SGHMC:\n",
" \n",
" def __init__(self, var, alpha, eta, log_density):\n",
" \"\"\"\n",
" Stochastic Gradient Monte Carlo sampler.\n",
" \n",
" Args:\n",
" var: `Variable` corresponding to the variable that is sampled\n",
" alpha: momentum parameter\n",
" eta: learning rate parameter\n",
" log_density: function computing log_density for a given sample\n",
" and batch of data\n",
" \"\"\"\n",
" self.var = var\n",
" self.alpha = alpha\n",
" self.eta = eta\n",
" self.log_density = log_density\n",
" self.optimizer = optim.SGD([self.var], lr=1, momentum=(1 - self.alpha))\n",
" \n",
" def _noise(self):\n",
" std = np.sqrt(2 * self.alpha * self.eta)\n",
" n = Variable(torch.normal(0, std= std * torch.ones(self.var.size())))\n",
" return torch.sum(n * self.var)\n",
" \n",
" def sample(self):\n",
" loss = self.log_density(self.var) * self.eta\n",
" loss += self._noise()\n",
" loss.backward()\n",
" self.optimizer.step()\n",
" self.var.grad.data.zero_()\n",
" return self.var"
]
},
{
"cell_type": "code",
"execution_count": 125,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"x = torch.from_numpy(np.array([[-10], [0]])).float()\n",
"x_v = Variable(x, requires_grad=True)\n",
"mu = np.zeros([2], dtype=float)\n",
"sigma = np.array([[10, 9.9], [9.9, 10]])\n",
"dist = NomalDist(mu, sigma)\n",
"sghmc = SGHMC(x_v, .01, 5e-3, dist.loss)"
]
},
{
"cell_type": "code",
"execution_count": 126,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"100\n",
"200\n",
"300\n",
"400\n",
"500\n",
"600\n",
"700\n",
"800\n",
"900\n",
"1000\n",
"1100\n",
"1200\n",
"1300\n",
"1400\n",
"1500\n",
"1600\n",
"1700\n",
"1800\n",
"1900\n",
"2000\n",
"2100\n",
"2200\n",
"2300\n",
"2400\n",
"2500\n",
"2600\n",
"2700\n",
"2800\n",
"2900\n",
"3000\n",
"3100\n",
"3200\n",
"3300\n",
"3400\n",
"3500\n",
"3600\n",
"3700\n",
"3800\n",
"3900\n",
"4000\n",
"4100\n",
"4200\n",
"4300\n",
"4400\n",
"4500\n",
"4600\n",
"4700\n",
"4800\n",
"4900\n",
"5000\n",
"5100\n",
"5200\n",
"5300\n",
"5400\n",
"5500\n",
"5600\n",
"5700\n",
"5800\n",
"5900\n",
"6000\n",
"6100\n",
"6200\n",
"6300\n",
"6400\n",
"6500\n",
"6600\n",
"6700\n",
"6800\n",
"6900\n",
"7000\n",
"7100\n",
"7200\n",
"7300\n",
"7400\n",
"7500\n",
"7600\n",
"7700\n",
"7800\n",
"7900\n",
"8000\n",
"8100\n",
"8200\n",
"8300\n",
"8400\n",
"8500\n",
"8600\n",
"8700\n",
"8800\n",
"8900\n",
"9000\n",
"9100\n",
"9200\n",
"9300\n",
"9400\n",
"9500\n",
"9600\n",
"9700\n",
"9800\n",
"9900\n"
]
}
],
"source": [
"samples = []\n",
"for epoch in range(10000):\n",
" w_sample = sghmc.sample()\n",
" samples.append(np.copy(w_sample.data.numpy()).T)\n",
" if not(epoch % 100):\n",
" print(epoch)"
]
},
{
"cell_type": "code",
"execution_count": 128,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(10000, 2)"
]
},
"execution_count": 128,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"samples = np.vstack(samples)\n",
"samples.shape"
]
},
{
"cell_type": "code",
"execution_count": 129,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10c2a2be0>]"
]
},
"execution_count": 129,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJztnX2MJMd53p93v0jv7dmyZk8QT9Lukokg6BgginQgRIM2\nGC2tUAdDjARFIbFHy3CA1e1awAmGkYheQBBs3B+EoTinRMvLxZZN34wlSolpMcoplEkqYOBEtJfE\nHb9ESkfpliKtSLxlwq8jTPKu8kd1a3t6u7qrP6q7uuf5AYWZ7e7trqmpqafqrbfeEqUUCCGEkJCx\npjNACCHELygMhBBChqAwEEIIGYLCQAghZAgKAyGEkC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PK8AbgPw+9A/vt+HNn39ZtV5sMWmXEVkDcAbAAaG29RSrm1HRGYA/BcAn1ZKvRg7/RC0GeTlYN7p\nL6EjJzdBq77PYC7zwwBuSTjtU7kC8FQYVEv3gMjKt4hMQO+R/b6UezwbvP5URO6ENkdUXuFty1hE\n/hOAbyScsinvSrAo198A8GsAFlVgtE24Ry3lGsOmjMJrngnqxy9A19PaEZFJaFEYKKX+In4+KhRK\nqZMisi4is0qp2mMTWXyftdVPSz4E4CGl1E/iJ3wq15AumZLasAfEdQCeUEo9k3RSRHaJyO7wPfTE\n6qM15i/MR9QW+xFDHv4WwDtFe3lNQQ+T76ojf1FE5HoA/xrAh5VS5w3XNFWuNmV0F3Q9BHS9vM8k\nbi4J5jX+GMB3lVL/1nDNW8P5DxG5Crr9qF3ELL/PuwD8euCd9H4ALyilflxzVqMYLQW+lOsQTc9+\n503QDdUzAP4ewE8A3B05twbtBfIkgA9Fjp8EsDd4fwW0YJwB8DUAl9SY9z8FcCh2bC+Ak5G8nQ7S\nY9CmkibK+ASARwA8DP0Duyye1+DvA9DeK081mNcz0LbkU0E6Fs9rk+WaVEYAfg9ayADg0qAengnq\n5RUNleM10KbDhyNleQDAobDOAvhUUH6noSf6f6mhvCZ+n7G8CoAvBuX+CCIejA3kdxd0Q/8LkWPe\nlWs0ceUzIYSQIbpkSiKEEFIBFAZCCCFDUBgIIYQMQWEghBAyBIWBEELIEBQGQgghQ1AYCCGEDEFh\nIIQQMsT/BzZ2uK9hLfzzAAAAAElFTkSuQmCC\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10bf69b38>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"start_from=0\n",
"plus = 10000\n",
"plt.plot(samples[start_from:start_from+plus, 0], samples[start_from:start_from+plus, 1], 'bo')"
]
},
{
"cell_type": "code",
"execution_count": 130,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[<matplotlib.lines.Line2D at 0x10bed2a58>]"
]
},
"execution_count": 130,
"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kv6h6EkgD5\nYs/jl9TAoJmyvSzpxyQ9Ue9IMv2OkonF5boHkuMmSRuSPreZLvqM7X11D6pXRLysJCNwVtK3JP1r\nRHyhyjFM7EEbWWw/LuntGS8dU/LP+lYlX4PfK+l/235HVFwWNGSMn1aShqnVoDFGxOc333NMSXqh\nW+XYJp3tayX9saRfiYh/q3s8vWzfIek7EfGk7Q/WPZ4ceyS9R9J9EfGE7fslfVLSf693WFtsf7+S\nb4w3SfoXSf/H9oGIOF3VGFoV2CPitrzXbN8r6ZHNQP73ti8r6eWwUdX4pPwx2v4RJX8RvmJbSlIc\nT9l+X0R8u8IhDvz3KEm2PyrpDkm3Vv3BmONlSTf2PL5h87lGsX2VkqDejYhH6h5Phg9I+jnbt0t6\nk6TrbJ+OiAM1j6vXS5Jeioj0287DSgJ7k9wm6Z8jYkOSbD8i6SclVRbYpykV86eSPiRJtt8paa8a\n1EQoIr4WEW+LiOWIWFbyF/g9VQf1YWx/WMlX9Z+LiAt1j2fTP0j6Qds32d6rZKHqz2oe0xWcfFp/\nVtLzEfFbdY8nS0R8KiJu2Pz79xFJf9OwoK7N/z+8aPuHNp+6VdJzNQ4py1lJ77c9t/nf/VZVvMDb\nqhn7ECclnbT9jKSLkg42ZLY5aX5X0tWSHtv8ZvGliDhc54Ai4pLtX5b0V0oqEE5GxLN1jinDByTd\nJelrtp/efO7TEfFojWOaVPdJ6m5+iH9D0t01j+cKmymihyU9pSRd+WVVvAuVnacA0DLTlIoBgKlA\nYAeAliGwA0DLENgBoGUI7ADQMgR2AGgZAjsAtAyBHQBa5v8DwRG1KhFeEB0AAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x10c28f898>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"freq = 10\n",
"new_samples = []\n",
"for i in range(int(samples.shape[0] / freq))[100:]:#[400:]:\n",
" new_samples.append(samples[i * freq][None, :])\n",
"new_samples = np.vstack(new_samples)\n",
"plt.plot(new_samples[:, 0], new_samples[:, 1], 'bo')\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"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.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment