{"id":13481376,"url":"https://github.com/fllinares/neural_fingerprints_tf","last_synced_at":"2026-02-23T08:34:08.081Z","repository":{"id":75341607,"uuid":"93521022","full_name":"fllinares/neural_fingerprints_tf","owner":"fllinares","description":"A TensorFlow implementation of \"Convolutional Networks on Graphs for Learning Molecular Fingerprints\".","archived":false,"fork":false,"pushed_at":"2017-06-30T14:45:17.000Z","size":33,"stargazers_count":31,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T12:39:17.711Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fllinares.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-06T13:22:37.000Z","updated_at":"2023-12-04T13:26:41.000Z","dependencies_parsed_at":"2023-06-06T05:00:36.962Z","dependency_job_id":null,"html_url":"https://github.com/fllinares/neural_fingerprints_tf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fllinares/neural_fingerprints_tf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fllinares%2Fneural_fingerprints_tf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fllinares%2Fneural_fingerprints_tf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fllinares%2Fneural_fingerprints_tf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fllinares%2Fneural_fingerprints_tf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fllinares","download_url":"https://codeload.github.com/fllinares/neural_fingerprints_tf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fllinares%2Fneural_fingerprints_tf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281222731,"owners_count":26464003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-27T02:00:05.855Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:00:51.322Z","updated_at":"2025-10-27T05:51:55.403Z","avatar_url":"https://github.com/fllinares.png","language":"Python","funding_links":[],"categories":["Deep Learning"],"sub_categories":[],"readme":"This is an independent TensorFlow implementation of the approach described in the following paper:\n\n+ D. Duvenaud\\*, D. Maclaurin\\*, J. Aguilera-Iparraguirre, R. Gomez-Bombarelli, T. Hirzel, A. Aspuru-Guzik and R. P. Adams.\n**Convolutional Networks on Graphs for Learning Molecular Fingerprints**, *NIPS 2015*. \\*Equal contributions.\n\nThe article can be found [here](https://papers.nips.cc/paper/5954-convolutional-networks-on-graphs-for-learning-molecular-fingerprints), and the original implementation by the paper author's [here](https://github.com/HIPS/neural-fingerprint).\n\n## Dependencies\n\nThe following packages are required:\n+ [NumPy](http://www.numpy.org/), tested on version `1.12.1`\n+ [RDKit](http://www.rdkit.org/), tested on version `2017.03.1.dev1`\n+ [scikit-learn](http://scikit-learn.org/stable/), tested on version `0.18.1`\n+ [TensorFlow](https://www.tensorflow.org/), tested on version `1.2.0-rc0`\n\n## Input data format\n\nThis implementation assumes that a dataset is represented by two input files:\n+ A text file describing the different molecules in the dataset. It is assumed\nto contain one SMILES string, i.e. sample, per line.\n+ A text file describing the corresponding target vector for each molecule in\nthe dataset. It is assumed to contain a comma-separated list of k \u003e= 1 scalars \nper line, i.e. a k-dimensional target vector for each SMILES string.\n\n#### Example datasets\n\nFour example datasets (`cep`, `delaney`, `malaria` and `toxin`) , can be \ndownloaded using the scripts provided in `code/scripts/data_download`:\n\n```\nexport NF_HOMEDIR=\u003clocal_path/to/repo_folder\u003e\nbash code/scripts/data_download/download_\u003cdataset_name\u003e.sh\n```\n\nThe scripts will store the two aforementioned text files, `smiles.dat` and \n`targets.dat`, in folder `data/smiles/\u003cdataset_name\u003e`. Datasets `cep`, `delaney` \nand `malaria` are 1-D regression problems while `toxin` is a binary \nclassification problem.\n\nAll these four datasets are kindly provided by the authors of the algorithm in \nthe [original repo](https://github.com/HIPS/neural-fingerprint/tree/master/data).\nFor `cep` and `malaria`, the authors used only a subset of the corresponding\ndatasets for their experiments. The download scripts refer to these subsets by\nadding the prefix `reduced_` to `\u003cdataset_name\u003e`. Moreover, versions of `cep`\nand `reduced_cep` without outliers (defined as samples with target value 0.0) \nare also provided.\n\n## Data preprocessing\n\n#### Parsing\n\nThis implementation relies on an internal TFRecord representation of the input \nmolecular graphs and their corresponding targets.\n\nThe script`code/data_preprocessing/smiles/smiles_to_tfrecord.py` takes care of:\n+ Parsing the two input text files, generating a list of Python dicts \nrepresenting each graph in the dataset.\n+ Converting each Python dict to the internal TFRecord format and writing all \nrecords to disk.\n\nThe SMILES parser can be configured by providing a JSON file describing the \ndesired settings. Example configurations can be found in the directory `code/data_preprocessing/smiles/smiles_parser_config`. In particular, this \nallows the user to control which features are used to represent atoms and bonds and how they are encoded into node and edge feature vectors.\n\nExample scripts to parse the four provided datasets can be found in `code/scripts/data_preprocessing`:\n\n```\nexport NF_HOMEDIR=\u003clocal_path/to/repo_folder\u003e\nbash code/scripts/data_preprocessing/parse_\u003cdataset_name\u003e.sh\n```\n\nBy default, these scripts will write the TFRecords to file `data/tfrecords/\u003cdataset_name\u003e/all.tfrecords`.\n\n#### Batching\n\nThe next step in the preprocessing pipeline is to generate a training/validation/test split of the input dataset and precomputing mini-batches for each split of the\ndata. The current implementation essentially treats a mini-batch of graphs as a\nsingle graph with multiple connected components. To avoid repeating the graph\nconcatenation operation for each mini-batch each epoch, mini-batches are to be pre-computed beforehand.\n\nThe script `code/data_preprocessing/batch_tfrecords.py` takes care of:\n+ Generating a random training/validation/test split of the input dataset with\nspecified proportions or, alternatively, reading split indices from an input file.\n+ Generating mini-batches of the specified size for each of the splits and writing\nthem to disk in the internal TFRecord format.\n\nExample scripts to batch the four provided datasets can be found in `code/scripts/data_batching`:\n\n```\nexport NF_HOMEDIR=\u003clocal_path/to/repo_folder\u003e\nbash code/scripts/data_batching/batch_\u003cdataset_name\u003e.sh\n```\n\nBy default, these scripts will write the TFRecords to file `data/batched_tfrecords/\u003cdataset_name\u003e/batches_\u003csplit\u003e.tfrecords`, where `split`\ncan be `tr` (train), `val` (validation) or `tst` (test).\n\n## Building and training the model\n\nFile `code/models/neural_fingerprints.py` contains the Python class responsible \nfor building the computational graph. Its constructor takes as input:\n+ The path to a JSON file specifying the model hyperparameters. Please see \nthe example configuration files included in folders `model_configs/\u003cdataset_name\u003e` \nfor a reference.\n+ The path to a file containing the pre-computed mini-batches of a dataset \nsplit, in the internal TFRecord format (i.e. the output file generated by script `code/data_preprocessing/batch_tfrecords.py`).\n+ A boolean indicating whether the model is to be used for training (train split)\nor evaluation (validation and test splits).\n\nIn the current implementation, the training model needs to be built first. The \nvalidation and test models are expected to be built afterwards, as they employ \nvariable reuse to tie their model weights and biases to those of the training \nmodel.\n\nAdditionally, `code/train_tools/trainer.py` contains a Python class that handles\nthe training and evaluation loops. Its constructor takes as input the already\nconstructed training model and, optionally, already constructed validation and \ntest models. It also allows restoring a previously trained model saved in disk.\n\nFinally, the script `run_neural_fingerprints.py` offers a wrapper that handles\nboth model construction and training using the two aforementioned Python classes.\n\nExample scrips to a train the model on the four provided datasets can be found in `code/scripts/experiments`:\n\n```\nexport NF_HOMEDIR=\u003clocal_path/to/repo_folder\u003e\nbash code/scripts/experiments/launch_\u003cdataset_name\u003e.sh\n```\n\nBy default, these scripts will store the output files in folder `output/\u003cdataset_name\u003e`. \nThis folder will contain:\n+ A subdirectory `backup`, with the five most recent trained models (the model is saved after each epoch).\n+ A subdirectory `best`, with the five best performing models according to validation loss (to be used for early-stopping).\n+ A file `config.json`, identical to the provided input configuration file (to help keep track of hyperparameters).\n+ Subdirectories `train`, `val` and `tst` with the corresponding TensorFlow summaries.\n\n## Authors\nThis implementation was written by [Felipe Llinares-Lopez](https://scholar.google.ch/citations?user=zzjTWUUAAAAJ\u0026hl=en). It is based on the software written by David Duvenaud, Dougal Maclaurin and Ryan P. Adams. If you happen to use this TensorFlow implementation, please don't forget to cite their article.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffllinares%2Fneural_fingerprints_tf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffllinares%2Fneural_fingerprints_tf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffllinares%2Fneural_fingerprints_tf/lists"}