-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error during plotting #1
Comments
weird, i have it working on my machine. try the following for the color instead? c=np.array(new_y.data.tolist())[:,0] |
Cool It is working. Is this a numpy array type of error? |
One more possibly small error. When using the following command
Got an error like ModuleNotFoundError Traceback (most recent call last) ModuleNotFoundError: No module named 'helper_func' |
you have to be in the same folder to be able to call that. It wont work for arbitrary scripts. |
What you mean by same folder? Same folder of in my computer path or according to the Github file structure? I am in the same folder of my computer. |
Sorry okay got it |
Okay now I put all the files in the correct path but when I was trying to execute the following command I got an error like
ModuleNotFoundError Traceback (most recent call last) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/serialization.py in load(f, map_location, pickle_module) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/serialization.py in _load(f, map_location, pickle_module) ModuleNotFoundError: No module named 'pandas.indexes' |
Sorry again. I have trouble understanding the following things
What is the Hyper parameter? How can one set the values in each case. What is the following part doing? `class Encoder(nn.Module):
class Decoder(nn.Module):
class AutoEncoder(nn.Module):
I tried to train the autoencoder with the following script `optimizer = optim.Adam(model.parameters(), lr=0.5)
But it gives an error like `--------------------------------------------------------------------------- ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs) in forward(self, x) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs) in forward(self, x) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/module.py in call(self, *input, **kwargs) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/nn/modules/linear.py in forward(self, input) ~/miniconda2/envs/py36/lib/python3.6/site-packages/torch/nn/functional.py in linear(input, weight, bias) RuntimeError: size mismatch, m1: [500 x 2], m2: [4 x 8] at /opt/conda/conda-bld/pytorch-cpu_1518282373170/work/torch/lib/TH/generic/THTensorMath.c:1434` What is the reason of this error? |
That is a pandas issue, look into updating pandas to 0.19 i believe. google might be able to do it as well.
They specify the network size, shape and how its trained. For example input_size is the number of input features. hidden size is the number of hidden nodes per layer. The pytorch website will likely have more data.
What is your input number of features.For example, alanine is 4 features which are sin cosine transform of the backbone dihedrals \phi and \psi. In your case there is a mismatch between the vectors here so pytorch is complaining about that. ps: I ended up writing a paper on how to use auto encoder and its variants for enhanced sampling. The following github is a bit more complete since we wrote a lot more code for it: https://github.com/msultan/vde_metadynamics |
Okay got it I had two features hence it was a mismatch. However I didn't understand the exact meaning of # When I am trying to render the plumed file I got an error like ValueError Traceback (most recent call last) ~/Reweighting_test/2D_COM_distance/TF-MetaD/helper_func/helper.py in render_network(net) ~/Reweighting_test/2D_COM_distance/TF-MetaD/helper_func/helper.py in write_df(df) ~/Reweighting_test/2D_COM_distance/TF-MetaD/helper_func/helper.py in create_feature(argument, func, feature_label) ValueError: Can't find function Any help? I was going through the manuscript of VDE metadynamics will try it for sure. |
Yea, so I didn't write the code to transform all possible featurizers from MSMBuilder to Plumed. I think it currently does Dihedrals, alpha carbon dihedrals, and contact distances. I think it might also do angles but definitely not center of mass. One reason being that I am fairly sure, though could be wrong, that the COM calculation in Plumed is different than in Mdtraj/MSMbuilder so I need to write a new featurizer for MSMbuilder first to make everything compatible. Unfortunately, all the packages use slightly different definitions of everything which makes writing these transforms rather cumbersome. Distances or dihedrals are pretty alright, and I implemented the closest heavy atom distance in mdtraj to be the same as Plumed for that reason. If you want to work on it yourself, please feel free to file a pull request ! |
My case it is just two features both are simple CA distances. So how should I render? |
Ohh, try using the VDE_Metadynamics module. I think that has the ca distances. |
Sorry about the code fragmentation on this, this repo was more of a weekend project to try to see if I could teach Plumed basic neural networks. |
print(df) gives the following
0 [[534], [1203]] ca Contact 20 [35, 79] [ASP, VAL]
0 [36, 80] |
Ha ha I am laughing on myself. This is the NOOBEST question. So I installed VDE Metadynamics and all the render files are in this path ~/miniconda2/envs/py36/lib/python3.6/site-packages/vde_metadynamics-0.1-py3.6.egg/vde_metadynamics How can I define the path inside notebook to import the .py scripts. |
Try walking through the following notebook https://github.com/msultan/vde_metadynamics/blob/master/examples/alanine/ala_res.ipynb |
But that is not the problem seems like my installation paath is not catching up ModuleNotFoundError Traceback (most recent call last) ModuleNotFoundError: No module named 'vde_metadynamics' |
weird, can you try
in your folder, and let me know if that works? Also you might have to restart the ipython notebook kernel. |
Hi,
During executing the following command
scatter(plot_feat[:,0],plot_feat[:,1],c=new_y.data.tolist(),cmap='jet')
xlim([-np.pi,np.pi])
ylim([-np.pi,np.pi])
cb
= plt.colorbar()xlabel(r'$\phi$')
ylabel(r'$\psi$')
cb.set_label("Neural
Network Projection")I got an error like
TypeError Traceback (most recent call last)
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/colors.py in to_rgba(c, alpha)
131 try:
--> 132 rgba = _colors_full_map.cache[c, alpha]
133 except (KeyError, TypeError): # Not in cache, or unhashable.
TypeError: unhashable type: 'list'
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
3985 # must be acceptable as PathCollection facecolors
-> 3986 colors = mcolors.to_rgba_array(c)
3987 except ValueError:
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/colors.py in to_rgba_array(c, alpha)
232 for i, cc in enumerate(c):
--> 233 result[i] = to_rgba(cc, alpha)
234 return result
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/colors.py in to_rgba(c, alpha)
133 except (KeyError, TypeError): # Not in cache, or unhashable.
--> 134 rgba = _to_rgba_no_colorcycle(c, alpha)
135 try:
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/colors.py in _to_rgba_no_colorcycle(c, alpha)
188 if len(c) not in [3, 4]:
--> 189 raise ValueError("RGBA sequence should have length 3 or 4")
190 if len(c) == 3 and alpha is None:
ValueError: RGBA sequence should have length 3 or 4
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
in ()
----> 1 scatter(plot_feat[:,0],plot_feat[:,1],c=new_y.data.tolist(),cmap='jet')
2 xlim([-np.pi,np.pi])
3 ylim([-np.pi,np.pi])
4 cb = plt.colorbar()
5 xlabel(r'$\phi$')
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, hold, data, **kwargs)
3376 vmin=vmin, vmax=vmax, alpha=alpha,
3377 linewidths=linewidths, verts=verts,
-> 3378 edgecolors=edgecolors, data=data, **kwargs)
3379 finally:
3380 ax._hold = washold
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, *args, **kwargs)
1715 warnings.warn(msg % (label_namer, func.name),
1716 RuntimeWarning, stacklevel=2)
-> 1717 return func(ax, *args, **kwargs)
1718 pre_doc = inner.doc
1719 if pre_doc is None:
~/miniconda2/envs/py36/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
3989 msg = ("c of shape {0} not acceptable as a color sequence "
3990 "for x with size {1}, y with size {2}")
-> 3991 raise ValueError(msg.format(c.shape, x.size, y.size))
3992 else:
3993 colors = None # use cmap, norm after collection is created
AttributeError: 'list' object has no attribute 'shape'
Any idea how to solve it?
The text was updated successfully, but these errors were encountered: