Coder Social home page Coder Social logo

feature-selection-cqm's Introduction

Open in GitHub Codespaces

Feature Selection for CQM

This demo showcases feature selection using the constrained quadratic model (CQM) solver via D-Wave's scikit-learn plug-in. The demo can be used with two different data sets:

  • titanic: This is a well-known data set based on passenger survival from the Titanic. It includes 14 features and illustrates how feature redundancy impacts the solution.
  • scene: This is a larger data set with 299 features. It is associated with recognizing scenes based on feature data contained in images. For additional information, see: OpenML. The features have generic labels such as "attr1" and are associated with image characteristics such as the mean or variance of different color channels within regions of the image. As with the Titanic data, this dataset also illustrates the impact of feature redundancy.

Note: This example solves a CQM on a Leap™ quantum-classical hybrid solver. The MIQUBO Method of Feature Selection example solves this same problem using a binary quadratic model (BQM) directly on a D-Wave quantum computer's quantum processing unit (QPU).


Usage

Run python app.py and open http://127.0.0.1:8050/ in your browser. A dropdown menu is provided to choose the dataset.

To visualize feature redundancy, first activate the "Show redundancy" check box. Then hover the mouse over any of the bars. The colors of all bars will be dynamically updated to show the similarity (redundancy) against the feature that is currently under the mouse.

Click on the Solve button to run the feature selection with the given settings (each data set is initialized with reasonable default settings for the number of features and redundancy penalty). Solutions typically take 1-3 seconds. Once complete, the bar chart will update to reflect the selected features, and the bar graph for accuracy scores will also be updated.

References

Milne, Andrew, Maxwell Rounds, and Phil Goddard. 2017. "Optimal Feature Selection in Credit Scoring and Classification Using a Quantum Annealer." 1QBit; White Paper. https://1qbit.com/whitepaper/optimal-feature-selection-in-credit-scoring-classification-using-quantum-annealer/

feature-selection-cqm's People

Contributors

arcondello avatar hbarovertwo avatar joelpasvolsky avatar mcfarljm avatar randomir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

feature-selection-cqm's Issues

Scene Dataset Loading issue

When trying to load the app, I receive an error point towards the 'Scene' dataset. (see below) If I comment out all references to that dataset, I am able to load the 'Titanic' dataset and the app operates as normal.

Traceback (most recent call last):
File "/workspace/feature-selection-cqm/app.py", line 45, in
datasets = {d['value']: DataSet(d['value']) for d in DATASET_NAMES}
File "/workspace/feature-selection-cqm/app.py", line 45, in
datasets = {d['value']: DataSet(d['value']) for d in DATASET_NAMES}
File "/workspace/feature-selection-cqm/data.py", line 167, in DataSet
return datasetsname
File "/workspace/feature-selection-cqm/data.py", line 141, in init
dataset = openml.datasets.get_dataset(data_id)
File "/workspace/.pip-modules/lib/python3.9/site-packages/openml/datasets/functions.py", line 432, in get_dataset
parquet_file = _get_dataset_parquet(description)
File "/workspace/.pip-modules/lib/python3.9/site-packages/openml/datasets/functions.py", line 1003, in _get_dataset_parquet
openml._api_calls._download_minio_file(
File "/workspace/.pip-modules/lib/python3.9/site-packages/openml/_api_calls.py", line 105, in _download_minio_file
client.fget_object(
File "/workspace/.pip-modules/lib/python3.9/site-packages/minio/api.py", line 1047, in fget_object
stat = self.stat_object(
File "/workspace/.pip-modules/lib/python3.9/site-packages/minio/api.py", line 1871, in stat_object
response = self._execute(
File "/workspace/.pip-modules/lib/python3.9/site-packages/minio/api.py", line 408, in _execute
return self._url_open(
File "/workspace/.pip-modules/lib/python3.9/site-packages/minio/api.py", line 373, in _url_open
raise ServerError(
minio.error.ServerError: server failed with HTTP status code 503

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.