grad1 = (2.0/m)*sum([(func1(X[iter], theta, False) – Y[iter])*X[iter][1]**4 for iter in range(m)]) ]]>

by the way, I am curious way you add dt in function pywt.cwt()? as,

[coefficients, frequencies] = pywt.cwt(signal, scales, waveletname, dt) ]]>

Why using “power” for visualizing while “coefficient” for CNN classification?

In plot_wavelet function,

dt = time[1] – time[0]

[coefficients, frequencies] = pywt.cwt(signal, scales, waveletname, dt)

power = (abs(coefficients)) ** 2

period = 1. / frequencies

levels = [0.0625, 0.125, 0.25, 0.5, 1, 2, 4, 8]

contourlevels = np.log2(levels)

fig, ax = plt.subplots(figsize=(15, 10))

im = ax.contourf(time, np.log2(period), np.log2(power), contourlevels, extend=’both’,cmap=cmap)

————————————————————————————

In CNN

for ii in range(0,train_size):

if ii % 1000 == 0:

print(ii)

for jj in range(0,9):

signal = uci_har_signals_train[ii, :, jj]

coeff, freq = pywt.cwt(signal, scales, waveletname, 1)

coeff_ = coeff[:,:127]

train_data_cwt[ii, :, :, jj] = coeff_

test_data_cwt = np.ndarray(shape=(test_size, 127, 127, 9))

for ii in range(0,test_size):

if ii % 100 == 0:

print(ii)

for jj in range(0,9):

signal = uci_har_signals_test[ii, :, jj]

coeff, freq = pywt.cwt(signal, scales, waveletname, 1)

coeff_ = coeff[:,:127]

test_data_cwt[ii, :, :, jj] = coeff_

uci_har_labels_train = list(map(lambda x: int(x) – 1, uci_har_labels_train))

uci_har_labels_test = list(map(lambda x: int(x) – 1, uci_har_labels_test))

Many thanks in advance!

]]>Lots of people have an error with the Vggnet model through Tensorflow throwing a DimensionError, this is because there’s a line that is incomplete in this tutorial. Where it says:

variables = variables_vggnet16()

You need to replace that line with this:

variables = variables_vggnet16(num_labels=num_labels, image_width=image_width, image_height=image_height)

The error was that the image height, image layers, and image widths were incompatible with what Vggnet was submitting to Tensorflow. The above fix will resolve that problem.

]]>