In [1]:
import matplotlib.pyplot as plt
import numpy as np

import collections

import tensorflow as tf
import tensorflow_probability as tfp
tfd = tfp.distributions
tfb = tfp.bijectors

tfe = tf.contrib.eager
tfe.enable_eager_execution()

from __future__ import print_function

In [2]:
from scipy.stats import geom

In [7]:
rvs = geom.rvs(0.1, size=1000)

In [8]:
plt.plot(rvs)


Out[8]:
[<matplotlib.lines.Line2D at 0x2b8feb41c4d0>]

In [14]:
import pandas as pd
a = pd.DataFrame([[1,2,3], [4,5,9]])
a.mean(axis=0)


Out[14]:
0    2.5
1    3.5
2    6.0
dtype: float64

In [15]:
a.divide(a.mean(axis=0))


Out[15]:
0 1 2
0 0.4 0.571429 0.5
1 1.6 1.428571 1.5

In [16]:
import cv2
import numpy as np

ann_img = np.zeros((30,30,3)).astype('uint8')
ann_img[ 3 , 4 ] = 1 # this would set the label of pixel 3,4 as 1

cv2.imwrite( "ann_1.png" ,ann_img )


Out[16]:
True

In [18]:
ann_img[ 3 , 4 ]


Out[18]:
array([1, 1, 1], dtype=uint8)

In [19]:
a = {'d': 1, 'e': 2}
b = {'e': 2, 'd': 1}
a == b


Out[19]:
True

In [20]:
a.keys()


Out[20]:
['e', 'd']

In [ ]: