Sign3 snippet not working
Hi @mbertoni,
This snippet gives an error:
SNIPPET:
from chemicalchecker.core import ChemicalChecker
# load the chemical checker
cc = ChemicalChecker()
# which space you want to predict?
space_to_predict = 'A1.001'
s3 = cc.get_signature('sign3', 'full_map', space_to_predict)
# the signature expose a predict method that will return a signature3 object created in the specified destination path
destination_dir = './test_pred'
pred_s3 = s3.predict_from_smiles(['CCC','C'], destination_dir)
# with a signature object arrays are coneniently stored in H5, but easily accessible
print(pred_s3.keys)
# ['CCC' 'C']
print(pred_s3[:])
#[[ 0.08386965 -0.08804703 0.21213211 -0.03305729 ... -0.23761776 0.04800407]
# [ 0.03155751 -0.03660269 0.17930669 -0.04735383 ... -0.24541655 0.09972538]]
LOG:
2019-05-24 16:19:59,598 chemicalchecker.util.config.config.Config [DEBUG ] Loading config from: /aloy/home/mduran/cc_config.json
2019-05-24 16:19:59,601 chemicalchecker.core.chemcheck.ChemicalChecker [DEBUG ] ChemicalChecker with root: /aloy/web_checker/current
2019-05-24 16:19:59,625 chemicalchecker.core.chemcheck.ChemicalChecker [DEBUG ] signature path: /aloy/web_checker/current/full_map/A/A1/A1.001/sign3
2019-05-24 16:19:59,626 chemicalchecker.core.chemcheck.ChemicalChecker [DEBUG ] validation path: /aloy/web_checker/current/tests/validation_sets
2019-05-24 16:19:59,628 chemicalchecker.core.data.DataFactory [DEBUG ] initializing object sign3
2019-05-24 16:19:59,629 chemicalchecker.core.sign3.sign3 [DEBUG ] dataset: A1.001
2019-05-24 16:19:59,630 chemicalchecker.core.sign3.sign3 [DEBUG ] data_path: /aloy/web_checker/current/full_map/A/A1/A1.001/sign3/sign3.h5
2019-05-24 16:19:59,632 chemicalchecker.core.sign3.sign3 [DEBUG ] model_path: /aloy/web_checker/current/full_map/A/A1/A1.001/sign3/models
2019-05-24 16:19:59,633 chemicalchecker.core.sign3.sign3 [DEBUG ] stats_path: /aloy/web_checker/current/full_map/A/A1/A1.001/sign3/stats
2019-05-24 16:20:00,043 tensorflow [WARNING ] From /opt/miniconda2/envs/py27/lib/python2.7/site-packages/tensorflow/python/training/saver.py:1266: checkpoint_exists (from tensorflow.python.training.checkpoint_management) is deprecated and will be removed in a future version.
Instructions for updating:
Use standard file APIs to check for files with this prefix.
2019-05-24 16:20:00,060 tensorflow [INFO ] Restoring parameters from /aloy/web_checker/current/full_map/A/A1/A1.001/sign3/models/adanet_sign0_A1.001_final_eval/savedmodel/variables/variables
2019-05-24 16:20:00,734 chemicalchecker.core.signature_base.BaseSignature [INFO ] Creating model_path in: /home/mduran/Desktop/test_pred/models
2019-05-24 16:20:00,736 chemicalchecker.core.signature_base.BaseSignature [INFO ] Creating stats_path in: /home/mduran/Desktop/test_pred/stats
2019-05-24 16:20:00,738 chemicalchecker.core.sign3.sign3 [DEBUG ] dataset: A1.001
2019-05-24 16:20:00,740 chemicalchecker.core.sign3.sign3 [DEBUG ] data_path: /home/mduran/Desktop/test_pred/sign3.h5
2019-05-24 16:20:00,741 chemicalchecker.core.sign3.sign3 [DEBUG ] model_path: /home/mduran/Desktop/test_pred/models
2019-05-24 16:20:00,743 chemicalchecker.core.sign3.sign3 [DEBUG ] stats_path: /home/mduran/Desktop/test_pred/stats
0%| | 0/1 [00:00<?, ?it/s]
ERROR:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-5-f2aec94f9da6> in <module>()
7 # the signature expose a predict method that will return a signature3 object created in the specified destination path
8 destination_dir = './test_pred'
----> 9 pred_s3 = s3.predict_from_smiles(['CCC','C'], destination_dir)
10 # with a signature object arrays are coneniently stored in H5, but easily accessible
11 print(pred_s3.keys)
/aloy/home/mduran/myscripts/chemical_checker/package/chemicalchecker/core/sign3.pyc in predict_from_smiles(self, smiles, dest_dir, ds)
251 preds[np.array(failed)] = np.full((128, ), np.nan)
252 results['V'][chunk] = preds[:, :128]
--> 253 results['stddev_norm'][chunk] = preds[:, 129]
254 results['intensity_norm'][chunk] = preds[:, 130]
255 results['confidence'][chunk] = preds[:, 131]
IndexError: index 129 is out of bounds for axis 1 with size 128