GithubHelp home page GithubHelp logo

alpayariyak / bert-smiles-autocompletion-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 396 KB

Fine-Tuning and Deploying BERT to predict the next element in a SMILES (Simplified Molecular Input Line Entry System) string.

Python 100.00%

bert-smiles-autocompletion-api's Introduction

BERT SMILES Autocompletion + API

BERT SMILES Autocompletion + API is a project fine-tuning and deploying a BERT model to predict the next element and character in a SMILES (Simplified Molecular Input Line Entry System) string. The API allows users to autocomplete SMILES strings with high accuracy, making it easier to access molecules without using drawing software.

demo.png

Web App Demo of SMILES Autocompletion API

Table of Contents

Fine-Tuned BERT Model for SMILES Autocompletion

The BERT model was fine-tuned using a dataset of valid SMILES strings. Additional generated SMILES strings were also generated using the RDKit library. The dataset was preprocessed to create masked language model (MLM) training examples, where a portion of the SMILES strings was masked with a special [MASK] token. The objective of the MLM task is to predict the masked tokens based on the context provided by the surrounding unmasked tokens.

During the fine-tuning process, the model learned the syntactic and semantic patterns within the SMILES strings, enabling it to generate chemically valid suggestions for the masked positions.

Algorithm for SMILES Autocompletion with BERT

model_explained.png

Algorithm for SMILES Autocompletion.

Advantages of using Model over Database Search

  • Expanded Chemical Space: The model can generate exponentially more valid SMILES strings based on learned patterns, enabling exploration of novel and unexplored chemical structures.
  • Robustness and Flexibility: The model adapts to different input SMILES strings and generates contextually appropriate suggestions, leading to more accurate and diverse results.
  • Reduced Dependency on Database Size and Quality: By leveraging the model's learning capabilities, dependency on databases is minimized, making the autocompletion process more efficient and scalable.

BERT SMILES Autocompletion API

Installation

To set up and run the BERT SMILES Autocompletion API, follow these steps:

  1. Clone the repository:
    $ git clone https://github.com/alpayariyak/BERT-SMILES-Autocompletion-API.git 
    $ cd BERT-SMILES-Autocompletion-API
    
  2. Install the required packages:
    $ pip install -r requirements.txt
    
  3. Run the Flask app:
    $ python autocompletionAPI.py
    

The API will be accessible at http://localhost:5000.

Usage

Endpoints

/autocomplete: autocompletes a given SMILES string using the fine-tuned BERT model, the database search, or both.

Query Parameters

smiles: The SMILES string to autocomplete. (required)

n_max_suggestions: The maximum number of suggestions to return (default: 5).

use_model: Set to true to use the BERT model for autocompletion (default: true).

use_database: Set to true to use the database search for autocompletion (default: true).

max_search_length: The maximum depth to search when using the BERT model (default: 10).

bert-smiles-autocompletion-api's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.