Skip to content

Instantly share code, notes, and snippets.

View gautamsreekumar's full-sized avatar
💭
thinking

Gautam Sreekumar gautamsreekumar

💭
thinking
View GitHub Profile
@gautamsreekumar
gautamsreekumar / mean_stdvariation.py
Created January 28, 2020 20:18
An example to calculate mean and standard deviation for a frequency distribution table
import numpy as np
import matplotlib.pyplot as plt
# directly listing all the midpoints of the interval using np.linspace
midpoints = np.linspace(5, 95, 10)
# frequency of each interval
freq = np.array([0, 5, 315, 1606, 3105, 2935, 1500, 324, 21, 0])
# elementwise product to get midpoint*frequency
def initi(var_shape):
real_part = nprand.rand(var_shape[0], var_shape[1], var_shape[2], var_shape[3])
imag_part = nprand.rand(var_shape[0], var_shape[1], var_shape[2], var_shape[3])
return tf.constant_initializer(real_part + imag_part*1.0j)
def lrelu(tensor_in): # this is not leaky-relu
temp_real = tf.real(tensor_in)
temp_imag = tf.imag(tensor_in)
return tf.complex(temp_real, temp_imag)