A plugin to scikit-learn for quantum hybrid solving
Project description
D-Wave scikit-learn
Plugin
This package provides a scikit-learn transformer for feature selection using a quantum-classical hybrid solver.
For an introduction to hybrid methods for feature selection, see the Feature Selection example Jupyter Notebook.
The package's main class, SelectFromQuadraticModel
, can be used in any existing sklearn
pipeline.
Examples
A minimal example of using the plugin:
from dwave.plugins.sklearn.transformers import SelectFromQuadraticModel
import numpy as np
# generate uniformly random data, 10,000 observations and 300 features
data = np.random.uniform(-10, 10, size=(10_000, 300))
outcome = np.asarray(np.random.uniform(0, 1, size=10_000) > 0.5, dtype=int)
# instantiate the feature selection class
selector = SelectFromQuadraticModel()
# solve the feature-selection problem
data_transformed = selector.fit_transform(data, outcome)
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.
# instantiate the feature selection class with a longer time limit
selector = SelectFromQuadraticModel(time_limit=200)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dwave-scikit-learn-plugin-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c974f97c04dddc9f76ab4154e456a779d3f0d42031ca7ac41f294dc24bc816b6 |
|
MD5 | 1d58fb918e56c1ad900a28bdb44e2d0c |
|
BLAKE2b-256 | 6cfc5582aaa550f7148671b52a455783a35a27d081cb325329b230641bbfa9e5 |
Hashes for dwave_scikit_learn_plugin-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b1ec1e852bf1173e85e80baac1e2600c1e6d62d49c3507151de09b85d2fc242 |
|
MD5 | 7031603a7e852f14f1827e3f10983cac |
|
BLAKE2b-256 | b889d7f1bfb82ba8e3ffa2f5ce308de864e1a1a92be74cabad7685d2aa0d5498 |