Skip to main content

A framework for building machine- and deel-learning predictors for molecular characteristics using Hydronaut and Chemfeat.

Project description


title: README author: Jan-Michael Rye

MolPred logo

Synopsis

MolPred is a Hydronaut-based framework for building machine- and deep-learning predictors for molecular characteristics using Chemfeat. It has the advantages of both along with several others:

  • All hyperparameters are managed via YAML configuration files, including selection of user-supplied models, molecular feature sets and metrics, with full support for command-line overrides.
  • Hyperparameters can be explored using systematic sweeps or optimizing algorithms. In particular, optimization can be tracked in real time with Optuna Dashboard when using Hydra's Optuna sweeper plugin.
  • All parameters, metrics, models and other artifacts are tracked with MLflow.
  • Tests and predictions can be performed by retrieving models and feature-set configurations from previous MLflow runs.
  • Models can be easily added by registering user-supplied subclasses of a provided class. Registered classes can be selected by name from the configuration file.
  • Custom metrics can also be define and registered for selection from the configuration file.
  • New chemical/molecular feature-set calculators can be added and registered via simple subclasses.
  • Feature calculations are cached in a local database to avoid redundant calculations.
  • Numeric and categoric features are automatically plotted and further optional plots are supported via the model subclasses. These plots are automatically logged as MLflow artifacts.

Links

Usage

The framework can train user-supplied models to predict features of molecules. To train a model, the user should provide a set of International Chemical Identifiers (InChIs) representing the molecules of the training set along with one or more features associated with these molecules. The user should then customize the example configuration file to select their model and chemical feature sets.

All results are logged with MLflow and any trained model can be re-used for testing or prediction by altering the configuration file to set the operation mode (train, test or predict) and a previous MLflow run ID for reloading the model and feature set.

Model

To create a model, the user must define a subclass of molpred.model.base.ModelBase. Some methods such as train and predict are required while others such as visualize_data and visualize_prediction_metrics are optional.

Once the model has been defined, it can be registered using the class's register method and then selected by name from the configuration file (experiment.params.model.name).

Examples

Scoring

molpred.model.scoring.register_scorer can be used to register custom scikit-learn scorers created with make_scorer. These scorers can then be used by name in the configuration file (experiment.params.model.scorers) to calculate and log metrics for the model during training and testing.

Visualization

All features calculated by Chemfeat are automatically plotted and logged for each run to provide insights into the correlation between the features and the target characteristics.

Numeric Features

All numeric features for a feature set are plotted together using a Seaborn stripplot after normalization.

Example of numeric feature plot

Categoric Features

Categoric features with common prefixes that only vary by a numeric suffix are grouped together and displayed as differential counts of each categoric value per target category. The data is displayed using a customized scatterplot that can visually separate data even for fingerprint features of up to 4096 bits. These plots attempt to highlight the indices of features that significantly vary per target category.

Example of categoric feature plot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molpred-2023.5.tar.gz (200.8 kB view details)

Uploaded Source

Built Distribution

molpred-2023.5-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file molpred-2023.5.tar.gz.

File metadata

  • Download URL: molpred-2023.5.tar.gz
  • Upload date:
  • Size: 200.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for molpred-2023.5.tar.gz
Algorithm Hash digest
SHA256 c1cbc63dfe8144014d54a3b5b9aeac4d42710d4d6239be5687613b78430a8f47
MD5 d7311b8472ba56bb10d989718b1930d7
BLAKE2b-256 f74f613e021f720d8e0aac7288bbd9f9c3349bb365de61251afb26b0b888ede4

See more details on using hashes here.

File details

Details for the file molpred-2023.5-py3-none-any.whl.

File metadata

  • Download URL: molpred-2023.5-py3-none-any.whl
  • Upload date:
  • Size: 24.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for molpred-2023.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c408cadf416702302f5c6bfaedbb6c123eae6f2658cfb5482fe2e8c5fb3f1ff2
MD5 e63239647cfa054d2fb4a102e94906c5
BLAKE2b-256 88b8335710209d9744325e24297e48066cf83cce4f3afb3ea690c75c1b8092bd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page