molzip


Namemolzip JSON
Version 0.9.1 PyPI version JSON
download
home_page
SummaryAn implementation of compression-based regression and classification for molecular SMILES.
upload_time2023-09-25 20:19:04
maintainer
docs_urlNone
author
requires_python
licenseThe MIT License (MIT) Copyright (c) 2023 Daniel Probst Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords chemistry cheminformatics smiles compression zip regression classification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![DOI](https://zenodo.org/badge/666335439.svg)](https://zenodo.org/badge/latestdoi/666335439)

# Parameter-Free Molecular Classification and Regression with Gzip
### Daniel Probst<sup>1</sup>, You?
<sup>1</sup>Institute of Electrical and Micro Engineering, LTS2, EPFL

## Abstract
TBD

## Introduction
The classification of a molecule on a wide variety of physicochemical and pharmakological properties, such as solubility, efficacy against specific diseases, or toxicity, has become a task of high interest in chemistry and biology. With the rise of deep learning during tha past decade, molecular classification has increasingly be carried out by ever-larger models, with mixed results. The newly published parameter-free text classification approach that makes use of Gzip compression has shown excellent performance compared to deep learning architectures, such as transformers, on benchmark data sets.[^1] As the SMILES string encoding of molecular graphs has been shown to be a well-performing molecular representation for applying NLP methods, such as transformers, to chemical tasks including molecular classification, a comparison with the Gzip-based classification method is also relevant in the context of molecular classification.

## Methods
The Gzip-based classifier introduced in this article has been adapted from the implementation presented by Jiang et al. and differs in three points: (1) as, as the authors have noted, the Gzip-based classification method has a relatively high time complexity, multiprocessing has been added; (2) multi-task classification has been added; and (3) a class weighing scheme has been implemented to account for unbalanced data. Furthermore, the capability to preprocess data, in this case the SMILES strings, has been added to the calling program.

## Results
The current results are presented in the table below. Data sets with random splits were ran a total of four times.

|     Data Set      | Split  | AUROC (Valid) |  F1 (Valid)   | AUROC (Test)  |   F1 (Test)   |
|-------------------|--------|---------------|---------------|---------------|---------------|
|bbbp               |scaffold|0.891 +/- 0.0  |0.902 +/- 0.0  |0.679 +/- 0.0  |0.686 +/- 0.0  |
|bace_classification|random  |0.793 +/- 0.038|0.793 +/- 0.038|0.789 +/- 0.038|0.789 +/- 0.038|
|clintox            |random  |0.805 +/- 0.038|0.965 +/- 0.038|0.77 +/- 0.038 |0.958 +/- 0.038|
|tox21              |random  |0.6 +/- 0.007  |0.308 +/- 0.007|0.599 +/- 0.007|0.303 +/- 0.007|
|sider              |random  |0.56 +/- 0.007 |0.788 +/- 0.007|0.563 +/- 0.007|0.778 +/- 0.007|

Implementing a weighted version of the kNN algorithm does not necessary lead to better classification performance on unbalanced data sets.
|     Data Set      | Split  |AUROC/RMSE (Valid)|F1/MAE (Valid) |AUROC/RMSE (Test)| F1/MAE (Test) |
|-------------------|--------|------------------|---------------|-----------------|---------------|
|sider              |scaffold|0.551 +/- 0.0     |0.707 +/- 0.0  |0.577 +/- 0.0    |0.666 +/- 0.0  |
|sider              |random  |0.454 +/- 0.262   |0.657 +/- 0.262|0.581 +/- 0.262  |0.647 +/- 0.262|
|bbbp               |scaffold|0.931 +/- 0.0     |0.931 +/- 0.0  |0.639 +/- 0.0    |0.627 +/- 0.0  |
|bace_classification|scaffold|0.694 +/- 0.0     |0.702 +/- 0.0  |0.701 +/- 0.0    |0.697 +/- 0.0  |
|bace_classification|random  |0.817 +/- 0.005   |0.815 +/- 0.005|0.774 +/- 0.005  |0.771 +/- 0.005|
|clintox            |scaffold|0.805 +/- 0.0     |0.854 +/- 0.0  |0.891 +/- 0.0    |0.891 +/- 0.0  |
|clintox            |random  |0.925 +/- 0.032   |0.924 +/- 0.032|0.913 +/- 0.032  |0.91 +/- 0.032 |
|tox21              |scaffold|0.635 +/- 0.0     |0.247 +/- 0.0  |0.618 +/- 0.0    |0.227 +/- 0.0  |
|tox21              |random  |0.705 +/- 0.006   |0.295 +/- 0.006|0.694 +/- 0.006  |0.29 +/- 0.006 |
|hiv                |scaffold|0.714 +/- 0.0     |0.901 +/- 0.0  |0.689 +/- 0.0    |0.887 +/- 0.0  |

Using SECFP (ECFP-style circular substructures as SMILES) doesn't increase the classification performance of the weighted kNN.

|     Data Set      | Split  | AUROC (Valid) |  F1 (Valid)   | AUROC (Test)  |   F1 (Test)   |
|-------------------|--------|---------------|---------------|---------------|---------------|
|bbbp               |scaffold|0.83 +/- 0.0   |0.819 +/- 0.0  |0.632 +/- 0.0  |0.627 +/- 0.0  |
|bace_classification|random  |0.833 +/- 0.015|0.829 +/- 0.015|0.826 +/- 0.015|0.821 +/- 0.015|
|clintox            |random  |0.74 +/- 0.076 |0.831 +/- 0.076|0.747 +/- 0.076|0.84 +/- 0.076 |
|tox21              |random  |0.712 +/- 0.011|0.305 +/- 0.011|0.718 +/- 0.011|0.31 +/- 0.011 |
|sider              |random  |0.604 +/- 0.022|0.62 +/- 0.022 |0.614 +/- 0.022|0.624 +/- 0.022|

Implementing a GZip-based regressor (weighted kNN, k=10) shows performance comparable to baseline performance of common ML implementations from MoleculeNet (https://moleculenet.org/full-results).
Interestingly there are improvements when the SMILES are tokenised.

|Data Set|Split |AUROC/RMSE (Valid)|F1/MAE (Valid) |AUROC/RMSE (Test)| F1/MAE (Test) |
|--------|------|------------------|---------------|-----------------|---------------|
|freesolv|random|0.641 +/- 0.144   |0.375 +/- 0.144|0.527 +/- 0.144  |0.321 +/- 0.144|
|delaney |random|1.443 +/- 0.088   |1.097 +/- 0.088|1.283 +/- 0.088  |0.966 +/- 0.088|
|lipo    |random|0.938 +/- 0.042   |0.765 +/- 0.042|0.911 +/- 0.042  |0.727 +/- 0.042|

The classifier is also able to classify raw reaction SMILES from the Schneider50k data set (no class weighting).

|Data Set |Split |AUROC/RMSE (Valid)|F1/MAE (Valid)|AUROC/RMSE (Test)|F1/MAE (Test)|
|---------|------|------------------|--------------|-----------------|-------------|
|schneider|random|0.0 +/- 0.0       |0.801 +/- 0.0 |0.0 +/- 0.0      |0.801 +/- 0.0|


## Discussion
TBD

## References
[^1] https://arxiv.org/abs/2212.09410

# What is this?
This is an experiment for a small open source manuscript/article that aims to validate and evaluate the performance of compression-based molecular classification using Gzip. If you want to join/help out, leave a message or a pull request that includes your name and, if available, your affiliation.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "molzip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "chemistry,cheminformatics,SMILES,compression,zip,regression,classification",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/a0/58/d238ff9ea818984c3314ee48cc86631a6e199527401a4526aedf16a25a61/molzip-0.9.1.tar.gz",
    "platform": null,
    "description": "[![DOI](https://zenodo.org/badge/666335439.svg)](https://zenodo.org/badge/latestdoi/666335439)\n\n# Parameter-Free Molecular Classification and Regression with Gzip\n### Daniel Probst<sup>1</sup>, You?\n<sup>1</sup>Institute of Electrical and Micro Engineering, LTS2, EPFL\n\n## Abstract\nTBD\n\n## Introduction\nThe classification of a molecule on a wide variety of physicochemical and pharmakological properties, such as solubility, efficacy against specific diseases, or toxicity, has become a task of high interest in chemistry and biology. With the rise of deep learning during tha past decade, molecular classification has increasingly be carried out by ever-larger models, with mixed results. The newly published parameter-free text classification approach that makes use of Gzip compression has shown excellent performance compared to deep learning architectures, such as transformers, on benchmark data sets.[^1] As the SMILES string encoding of molecular graphs has been shown to be a well-performing molecular representation for applying NLP methods, such as transformers, to chemical tasks including molecular classification, a comparison with the Gzip-based classification method is also relevant in the context of molecular classification.\n\n## Methods\nThe Gzip-based classifier introduced in this article has been adapted from the implementation presented by Jiang et al. and differs in three points: (1) as, as the authors have noted, the Gzip-based classification method has a relatively high time complexity, multiprocessing has been added; (2) multi-task classification has been added; and (3) a class weighing scheme has been implemented to account for unbalanced data. Furthermore, the capability to preprocess data, in this case the SMILES strings, has been added to the calling program.\n\n## Results\nThe current results are presented in the table below. Data sets with random splits were ran a total of four times.\n\n|     Data Set      | Split  | AUROC (Valid) |  F1 (Valid)   | AUROC (Test)  |   F1 (Test)   |\n|-------------------|--------|---------------|---------------|---------------|---------------|\n|bbbp               |scaffold|0.891 +/- 0.0  |0.902 +/- 0.0  |0.679 +/- 0.0  |0.686 +/- 0.0  |\n|bace_classification|random  |0.793 +/- 0.038|0.793 +/- 0.038|0.789 +/- 0.038|0.789 +/- 0.038|\n|clintox            |random  |0.805 +/- 0.038|0.965 +/- 0.038|0.77 +/- 0.038 |0.958 +/- 0.038|\n|tox21              |random  |0.6 +/- 0.007  |0.308 +/- 0.007|0.599 +/- 0.007|0.303 +/- 0.007|\n|sider              |random  |0.56 +/- 0.007 |0.788 +/- 0.007|0.563 +/- 0.007|0.778 +/- 0.007|\n\nImplementing a weighted version of the kNN algorithm does not necessary lead to better classification performance on unbalanced data sets.\n|     Data Set      | Split  |AUROC/RMSE (Valid)|F1/MAE (Valid) |AUROC/RMSE (Test)| F1/MAE (Test) |\n|-------------------|--------|------------------|---------------|-----------------|---------------|\n|sider              |scaffold|0.551 +/- 0.0     |0.707 +/- 0.0  |0.577 +/- 0.0    |0.666 +/- 0.0  |\n|sider              |random  |0.454 +/- 0.262   |0.657 +/- 0.262|0.581 +/- 0.262  |0.647 +/- 0.262|\n|bbbp               |scaffold|0.931 +/- 0.0     |0.931 +/- 0.0  |0.639 +/- 0.0    |0.627 +/- 0.0  |\n|bace_classification|scaffold|0.694 +/- 0.0     |0.702 +/- 0.0  |0.701 +/- 0.0    |0.697 +/- 0.0  |\n|bace_classification|random  |0.817 +/- 0.005   |0.815 +/- 0.005|0.774 +/- 0.005  |0.771 +/- 0.005|\n|clintox            |scaffold|0.805 +/- 0.0     |0.854 +/- 0.0  |0.891 +/- 0.0    |0.891 +/- 0.0  |\n|clintox            |random  |0.925 +/- 0.032   |0.924 +/- 0.032|0.913 +/- 0.032  |0.91 +/- 0.032 |\n|tox21              |scaffold|0.635 +/- 0.0     |0.247 +/- 0.0  |0.618 +/- 0.0    |0.227 +/- 0.0  |\n|tox21              |random  |0.705 +/- 0.006   |0.295 +/- 0.006|0.694 +/- 0.006  |0.29 +/- 0.006 |\n|hiv                |scaffold|0.714 +/- 0.0     |0.901 +/- 0.0  |0.689 +/- 0.0    |0.887 +/- 0.0  |\n\nUsing SECFP (ECFP-style circular substructures as SMILES) doesn't increase the classification performance of the weighted kNN.\n\n|     Data Set      | Split  | AUROC (Valid) |  F1 (Valid)   | AUROC (Test)  |   F1 (Test)   |\n|-------------------|--------|---------------|---------------|---------------|---------------|\n|bbbp               |scaffold|0.83 +/- 0.0   |0.819 +/- 0.0  |0.632 +/- 0.0  |0.627 +/- 0.0  |\n|bace_classification|random  |0.833 +/- 0.015|0.829 +/- 0.015|0.826 +/- 0.015|0.821 +/- 0.015|\n|clintox            |random  |0.74 +/- 0.076 |0.831 +/- 0.076|0.747 +/- 0.076|0.84 +/- 0.076 |\n|tox21              |random  |0.712 +/- 0.011|0.305 +/- 0.011|0.718 +/- 0.011|0.31 +/- 0.011 |\n|sider              |random  |0.604 +/- 0.022|0.62 +/- 0.022 |0.614 +/- 0.022|0.624 +/- 0.022|\n\nImplementing a GZip-based regressor (weighted kNN, k=10) shows performance comparable to baseline performance of common ML implementations from MoleculeNet (https://moleculenet.org/full-results).\nInterestingly there are improvements when the SMILES are tokenised.\n\n|Data Set|Split |AUROC/RMSE (Valid)|F1/MAE (Valid) |AUROC/RMSE (Test)| F1/MAE (Test) |\n|--------|------|------------------|---------------|-----------------|---------------|\n|freesolv|random|0.641 +/- 0.144   |0.375 +/- 0.144|0.527 +/- 0.144  |0.321 +/- 0.144|\n|delaney |random|1.443 +/- 0.088   |1.097 +/- 0.088|1.283 +/- 0.088  |0.966 +/- 0.088|\n|lipo    |random|0.938 +/- 0.042   |0.765 +/- 0.042|0.911 +/- 0.042  |0.727 +/- 0.042|\n\nThe classifier is also able to classify raw reaction SMILES from the Schneider50k data set (no class weighting).\n\n|Data Set |Split |AUROC/RMSE (Valid)|F1/MAE (Valid)|AUROC/RMSE (Test)|F1/MAE (Test)|\n|---------|------|------------------|--------------|-----------------|-------------|\n|schneider|random|0.0 +/- 0.0       |0.801 +/- 0.0 |0.0 +/- 0.0      |0.801 +/- 0.0|\n\n\n## Discussion\nTBD\n\n## References\n[^1] https://arxiv.org/abs/2212.09410\n\n# What is this?\nThis is an experiment for a small open source manuscript/article that aims to validate and evaluate the performance of compression-based molecular classification using Gzip. If you want to join/help out, leave a message or a pull request that includes your name and, if available, your affiliation.\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2023 Daniel Probst  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "An implementation of compression-based regression and classification for molecular SMILES.",
    "version": "0.9.1",
    "project_urls": {
        "Homepage": "https://github.com/daenuprobst/molzip"
    },
    "split_keywords": [
        "chemistry",
        "cheminformatics",
        "smiles",
        "compression",
        "zip",
        "regression",
        "classification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "92ae1eccbc2ba959b3e6a976733f13bc30fe2a070a750385b245d38f9719085c",
                "md5": "fc288ac9f21a00c5167a15aa88d8835b",
                "sha256": "c3b4d57040992c5f8f5368fd8c5d40043975f3ebb7da947834e462bddf7cae71"
            },
            "downloads": -1,
            "filename": "molzip-0.9.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fc288ac9f21a00c5167a15aa88d8835b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7995,
            "upload_time": "2023-09-25T20:19:01",
            "upload_time_iso_8601": "2023-09-25T20:19:01.673762Z",
            "url": "https://files.pythonhosted.org/packages/92/ae/1eccbc2ba959b3e6a976733f13bc30fe2a070a750385b245d38f9719085c/molzip-0.9.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a058d238ff9ea818984c3314ee48cc86631a6e199527401a4526aedf16a25a61",
                "md5": "44178b13332da667f0802d6405134193",
                "sha256": "3d16761f94971b20d4a033fded36481f4a5d0544fa0413dbd49d00a0e52e0e34"
            },
            "downloads": -1,
            "filename": "molzip-0.9.1.tar.gz",
            "has_sig": false,
            "md5_digest": "44178b13332da667f0802d6405134193",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7531,
            "upload_time": "2023-09-25T20:19:04",
            "upload_time_iso_8601": "2023-09-25T20:19:04.067514Z",
            "url": "https://files.pythonhosted.org/packages/a0/58/d238ff9ea818984c3314ee48cc86631a6e199527401a4526aedf16a25a61/molzip-0.9.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-25 20:19:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "daenuprobst",
    "github_project": "molzip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "molzip"
}
        
Elapsed time: 0.11875s