Code Monkey home page Code Monkey logo

feature-flags-with-ml-models-sample's Introduction

Using Feature Flags with Machine Learning Models

A companion repository for the blog post above. This repository contains a sample application that demonstrates how to use feature flags with machine learning models. It showcases the implementation of two text classification models using the popular machine learning library SpaCy. The models, namely the Base Model and the Pro Model, are designed to classify user-input text into specific intents based on their training data.

Key Features

  • Base Model: Designed for general text classification, covering intents such as goodbye, greeting, and business_hours.

  • Pro Model: Tailored for advanced scenarios, including additional intent classification such as payment_methods, making it ideal for scenarios where premium features are reserved for paid users.

Usage Scenario

These models are particularly useful in scenarios where you want to differentiate user access based on their subscription level. For instance, the Pro Model allows for more sophisticated intent classification, making it suitable for cases where users need information about payment methods, a capability not available in the Base Model.

Example

The Pro Model is able to classify the following user input:

"Can I pay you with my Google Pay wallet?"

resulting in classification to the payment_methods intent, a capability beyond the scope of the Base Model.

Build & Run

Prerequisites

Steps to run

  1. Clone the repository
git clone [email protected]:configcat-labs/feature-flags-with-ml-models-sample.git
  1. Create a and activate a virtual environment
python3 -m venv venv

source venv/bin/activate
  1. Install dependencies and run the app
pip3 install -r requirements.txt
python3 interact.py
  1. Train both base and pro models by entering the appropriate option in the command line. For this example, I'll train the base model first.
1 - Interact | 2 - Train | 3 - Exit: 2

Model to train: 1 - Base | 2 - Pro: 1

Training completed for base model

Train the pro model.

1 - Interact | 2 - Train | 3 - Exit: 2

Model to train: 1 - Base | 2 - Pro: 2

Training completed for pro model
  1. Now, copy your SDK key from the ConfigCat dashboard and paste it in the YOUR-CONFIGCAT-SDK-KEY placeholder in the interact.py file.

Learn more

Useful links to technical resources:

ConfigCat also supports many other frameworks and languages. Check out the full list of supported SDKs here.

You can also explore other code samples for various languages, frameworks, and topics here in the ConfigCat labs on GitHub.

Keep up with ConfigCat on Twitter, Facebook, LinkedIn, and GitHub.

Author

Chavez Harris

Contributions

Contributions are welcome!

feature-flags-with-ml-models-sample's People

Contributors

codedbychavez avatar

Watchers

 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.