I was trying to follow the example of "https://github.com/EBjerrum/Deep-Chemometrics/blob/master/Deep_Chemometrics_with_data_augmentation.py.ipynb", but when executing the first part of the code I immediately get the error.
#code
import scipy.io as sio
import numpy as np
def get_xY(filename, maxx=600):
#sio.whosmat(filename)
matcontents = sio.loadmat(filename)
keys = matcontents.keys()
for key in list(keys):
if key[0] == '_':
keys.remove(key)
keys.sort()
d = {}
for key in keys:
data = matcontents[key][0][0]
if key[-1] == "Y":
Ydata = data[5]
d[key] = Ydata
else:
xdata = data[5][:,:maxx]
d[key] = xdata
d["axisscale"]= data[7][1][0][0][:maxx].astype(np.float)
return d
filename = 'Dataset/nir_shootout_2002.mat'
dataset = get_xY(filename)
' AttributeError: 'dict_keys' object has no attribute 'remove' '