learningmatter-mit / peptimizer

Peptide optimization with Machine Learning
68 stars 24 forks source link

Tutorial_Synthesis.ipynb Line 7 and 10 Errors #2

Closed jaw315 closed 3 years ago

jaw315 commented 3 years ago

I receive the following error when trying to run the Jupyter Notebook on Linux:

Line 7: predictor.train(nnX, nnY)

WARNING:tensorflow:From /home/peptimizer/venv/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py:1659: calling BaseResourceVariable.init (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version. Instructions for updating: If using Keras pass *_constraint arguments to layers.

Another problem is present in line 10 with the following error: Line 10: activator.analyze(pre_chain + next_amino_acid)


ValueError Traceback (most recent call last)

in ----> 1 activator.analyze(pre_chain + next_amino_acid) ~/peptimizer/utils/utils_common/activator.py in analyze(self, sequence) 192 sequence = sequence[:-1] 193 plots.positive_activation_feature_map(sequence, output) --> 194 plots.positive_activation_avg_residues(sequence, output) 195 plots.positive_activation_avg_fingerprint(sequence, output) ~/peptimizer/utils/utils_common/plots.py in positive_activation_avg_residues(sequence, output, cmap) 52 plt.yticks(fontsize=15, ) 53 plt.ylabel('Fingerprint', fontsize=20) ---> 54 ax.set_xticklabels(['']) 55 ax.set_aspect(0.01) 56 ~/venv/lib/python3.8/site-packages/matplotlib/axes/_base.py in wrapper(self, *args, **kwargs) 61 62 def wrapper(self, *args, **kwargs): ---> 63 return get_method(self)(*args, **kwargs) 64 65 wrapper.__module__ = owner.__module__ ~/venv/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs) 449 "parameter will become keyword-only %(removal)s.", 450 name=name, obj_type=f"parameter of {func.__name__}()") --> 451 return func(*args, **kwargs) 452 453 return wrapper ~/venv/lib/python3.8/site-packages/matplotlib/axis.py in _set_ticklabels(self, labels, fontdict, minor, **kwargs) 1794 if fontdict is not None: 1795 kwargs.update(fontdict) -> 1796 return self.set_ticklabels(labels, minor=minor, **kwargs) 1797 1798 @cbook._make_keyword_only("3.2", "minor") ~/venv/lib/python3.8/site-packages/matplotlib/axis.py in set_ticklabels(self, ticklabels, minor, **kwargs) 1715 # remove all tick labels, so only error for > 0 ticklabels 1716 if len(locator.locs) != len(ticklabels) and len(ticklabels) != 0: -> 1717 raise ValueError( 1718 "The number of FixedLocator locations" 1719 f" ({len(locator.locs)}), usually from a call to" ValueError: The number of FixedLocator locations (0), usually from a call to set_ticks, does not match the number of ticklabels (1). The figure in line 7 looks different than online and the figures in 10 do not display properly
pikulsomesh commented 3 years ago

The version of the code has been written using Python 3.7 and default TensorFlow 2.0 build. The notebook and code are working and have been verified (recently, as of November 16, 2020).

Regarding the parity plot in line 7, you can change the number of epochs the model is trained on to get a similar figure, by passing custom_params in predictor.train(nnX, nnY, custom_params = {'epochs': 100}). The default is 2 epochs to make the tutorial and usage accessible for users with varying computational resources.

For ease of testing and online usage, a set of Colab notebooks have been provided at github.com/pikulsomesh/tutorials. Using these Colab notebooks, you can replicate the work as-is using Google cloud resources.