def show_bias(self):
     if len(self.weights) is 1:
         mp = myplot.MyPlot()
         mp.set_labels('Step', 'Bias')
         mp.show_list(self.biases)
     else:
         print('Cannot show the bias! Call print_bias mehtod.')
    def show_weight(self):
        print('shape=', self.weights)

        if len(self.weights[0]) is 1:
            mp = myplot.MyPlot()
            mp.set_labels('Step', 'Weight')
            mp.show_list(self.weights)
        else:
            print('Cannot show the weight! Call print_weight method.')
Exemple #3
0
# Get a image randomly and classify
r = random.randint(0, mnist.test.num_examples - 1)
print("Label: ", sess.run(tf.argmax(mnist.test.labels[r:r + 1], 1)))
print(
    "Prediction: ",
    sess.run(tf.argmax(logits, 1), feed_dict={X: mnist.test.images[r:r + 1]}))

import matplotlib.pyplot as plt
plt.imshow(mnist.test.images[r:r + 1].reshape(28, 28),
           cmap='Greys',
           interpolation='nearest')
plt.show()

import myplot
guy = myplot.MyPlot()
guy.set_labels('Epoch', 'Error')
guy.show_list(error_list)
'''
Epoch: 0001 cost = 141.207671860
Epoch: 0002 cost = 38.788445864
Epoch: 0003 cost = 23.977515479
Epoch: 0004 cost = 16.315132428
Epoch: 0005 cost = 11.702554882
Epoch: 0006 cost = 8.573139748
Epoch: 0007 cost = 6.370995680
Epoch: 0008 cost = 4.537178684
Epoch: 0009 cost = 3.216900532
Epoch: 0010 cost = 2.329708954
Epoch: 0011 cost = 1.715552875
Epoch: 0012 cost = 1.189857912
 def show_error(self):
     mp = myplot.MyPlot()
     mp.set_labels('Step', 'Error')
     mp.show_list(self.costs)
 def show_bias(self):
     mp = myplot.MyPlot()
     mp.set_labels('Step', 'Bias')
     mp.show_list(self.biases)
 def show_weight(self):
     mp = myplot.MyPlot()
     mp.set_labels('Step', 'Weight')
     mp.show_list(self.weights)
Exemple #7
0
# sampling rate
Ts = 1.0 / Fs
# sampling interval
t = np.arange(0, 1, Ts)  # time vector

freq1 = 5
# frequency of the signal
freq2 = 10
# frequency of the signal
freq3 = 20

wave1 = np.sin(2 * np.pi * freq1 * t)
wave2 = np.sin(2 * np.pi * freq2 * t)
wave3 = np.sin(2 * np.pi * freq3 * t)
signal = wave1 + wave2 + wave3

mplot1 = myplot.MyPlot()
mplot1.crossplot(t, signal)

n = len(signal)  # length of the signal
k = np.arange(n)
T = n / Fs
frq = k / T  # two sides frequency range
frq = frq[range(n // 2)]  # one side frequency range

fftsignal = np.fft.fft(signal) / n  # fft computing and normalization
fftsignal = fftsignal[range(n // 2)]

mplot2 = myplot.MyPlot()
mplot2.crossplot(frq, abs(fftsignal))