Skip to main content

A plugin to scikit-learn for quantum hybrid solving

Project description

PyPI CircleCI

D-Wave scikit-learn Plugin

This package provides a scikit-learn transformer for feature selection using a quantum-classical hybrid solver.

This plugin makes use of a Leap™ quantum-classical hybrid solver. Developers can get started by signing up for the Leap quantum cloud service for free. Those seeking a more collaborative approach and assistance with building a production application can reach out to D-Wave directly and also explore the feature selection offering in AWS Marketplace.

The package's main class, SelectFromQuadraticModel, can be used in any existing sklearn pipeline. For an introduction to hybrid methods for feature selection, see the Feature Selection for CQM.

Examples

A minimal example of using the plugin to select 20 of 30 features of an sklearn dataset:

>>> from sklearn.datasets import load_breast_cancer
>>> from dwave.plugins.sklearn import SelectFromQuadraticModel
... 
>>> X, y = load_breast_cancer(return_X_y=True)
>>> X.shape
(569, 30)
>>> X_new = SelectFromQuadraticModel(num_features=20).fit_transform(X, y)
>>> X_new.shape
(569, 20)

For large problems, the default runtime may be insufficient. You can use the CQM solver's min_time_limit method to find the minimum accepted runtime for your problem; alternatively, simply submit as above and check the returned error message for the required runtime.

The feature selector can be re-instantiated with a longer time limit.

>>> X_new = SelectFromQuadraticModel(num_features=20, time_limit=200).fit_transform(X, y)

Installation

To install the core package:

pip install dwave-scikit-learn-plugin

License

Released under the Apache License 2.0

Contributing

Ocean's contributing guide has guidelines for contributing to Ocean packages.

Release Notes

dwave-scikit-learn-plugin makes use of reno to manage its release notes.

When making a contribution to dwave-scikit-learn-plugin that will affect users, create a new release note file by running

reno new your-short-descriptor-here

You can then edit the file created under releasenotes/notes/. Remove any sections not relevant to your changes. Commit the file along with your changes.

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

dwave-scikit-learn-plugin-0.1.0.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

dwave_scikit_learn_plugin-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file dwave-scikit-learn-plugin-0.1.0.tar.gz.

File metadata

File hashes

Hashes for dwave-scikit-learn-plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d2b56dfb313041a9e4ca0cb13e0a730d4f5108818a2c74d4201ec4380706a07
MD5 0f80a4600bebe81ae0c58c50ff347548
BLAKE2b-256 069338dc2525dd3ea7406439e5243d9b8b393e75cf7ddf3fa8431adf01a1a067

See more details on using hashes here.

File details

Details for the file dwave_scikit_learn_plugin-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dwave_scikit_learn_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d8bb6936aef8ca4a395044c417db8b6602a8b74d3a76e6e17672a1073781ecf
MD5 8b2adb7e403958efc3e0b57be6cdaeb5
BLAKE2b-256 3f76fb2dd6e9b43a1337af39e76c6d5d0eec0d74794e2c28b47dd357ec3887ba

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