Closed bappa10085 closed 2 years ago
Sorry, didn't see the comment before now. Did you manage to solve the issue?
Still, this problem is getting while running the above code. Please can you solve it,
Cast the keys 'dict_keys' object into a list like this: keys = list(matcontents.keys()), then it should work I think. Let me know the results.
Now, while I am importing this module "from ChemUtils import GlobalStandardScaler"
I am getting the error "ModuleNotFoundError: No module named 'ChemUtils''.
Thank you very much, now all code section has been running.
I was out of station so could not check the codes. When I was trying to run Deep_Chemometrics_EMSC_only.py
, it returns me
AttributeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_13928/2335297676.py in
6 emsc.fit(X_train) 7 ----> 8 X_train_emsc = emsc.transform(Xtrain) 9 = plt.plot(dataset['axisscale'],X_train_emsc.T) F:\Python\Deep-Chemometrics-master\ChemUtils.py in transform(self, X, y, copy) 154 corr = scipy.zeros(X.shape) 155 for i in range(len(X)): --> 156 b,f,r = self.mlr(self._mx, X[i,:][:,nA]) 157 corr[i,:] = scipy.reshape((r/b[0,0]) + self._mx, (corr.shape[1],)) 158 return corr F:\Python\Deep-Chemometrics-master\ChemUtils.py in mlr(self, x, y) 132 133 #calc fit b=fit coefficients --> 134 b = scipy.dot(scipy.dot(scipy.linalg.pinv(scipy.dot(scipy.transpose(X),X)),scipy.transpose(X)),y) 135 f = scipy.dot(X,b) 136 r = y - f AttributeError: module 'scipy' has no attribute 'linalg'
How can I solve this issue? I think it is better to replace/correct the old codes in this repository.
The problems come from your installation of the dependencies. They have evolved and there has been API changes and new ways of doing things in e.g. Python 3, e.g. dict.keys() returning a special object rather than a simple list, and possible now that scipy has a new organization so that linalg module may be another place? You'll need to figure out where in scipy the pinv function now is, and update the code to fix the changed dependencies. Alternatively run it in python 2 with old versions of the dependencies, but as I didn't specify the versions, that would be hard to track down. I unfortunately don't have time to update the code which was provided 5 years ago as an example, but pull requests are welcome if you get it sorted out.
When I am trying to read the dataset I am getting the following error
AttributeError Traceback (most recent call last)