mindsdb / lightwood

Lightwood is Legos for Machine Learning.
GNU General Public License v3.0
448 stars 94 forks source link

:wrench: Implement a quantum mixer :mage: #641

Closed paxcema closed 3 years ago

paxcema commented 3 years ago

:wrench: Implement a quantum mixer :mage:

Introduction

Lightwood is an AutoML library that aims at abstracting common procedures in the Machine Learning usual workflow (e.g. data preparation, feature engineering, model building, model analysis) with an approach that can be fully automated but easily customizable and extended thanks to its flexibility.

One of the key tenets of Lightwood's philosophy is to engineer features by using encoders that might transform columnar data into a useful descriptor. These are then fed into what is called a mixer: the actual ML model tasked with learning to predict the specified target.

This approach is very flexible. Recently, we've come across the great Qiskit SDK for working with quantum computers, and thought it could be very cool to experiment with hybrid quantum-classical neural networks as mixers!

Task

Implement a proof-of-concept QuantumMixer class that inherits from our BaseMixer class and uses a hybrid quantum neural network as the learning mechanism. We suggest closely following this Qiskit tutorial for an initial implementation.

A good way to measure success is to implement a unit test that uses the quantum mixer in a simple task. For example, you can use this integration test as reference and opt for the HDI toy dataset. Be sure to read the custom mixer tutorial so that you can force quantum mixer usage in the test.

Note: mixer accuracy is not relevant at this time, future work can tackle it. Additionally, you can opt for testing with synthetic data if that's easier for you.

The core Lightwood team would love to be of assistance to any contributors interested in tackling this challenge. If at any point you have questions and/or want to discuss relevant details, feel free to post them here or in the community slack.

Steps :male_detective: :female_detective:

Additional rewards :1st_place_medal:

This challenge encompasses mixer research. As such, an accepted PR brings :one::zero: points for entry into the draw for a :computer: Deep Learning Laptop powered by the NVIDIA RTX 3080 Max-Q GPU or other swag :shirt: :bear: . For more info check out https://mindsdb.com/hacktoberfest/

ongspxm commented 3 years ago

Hi saw that there alr is a pr, but hope to work on this qiskit implementation too, I a have slightly different implementation that kinda builds on default net, will it be considered duplicated effort?

mrandri19 commented 3 years ago

Hi saw that there alr is a pr, but hope to work on this qiskit implementation too, I a have slightly different implementation that kinda builds on default net, will it be considered duplicated effort?

Hey, I am curious about you implementation too so I suppose you could open a PR as well. We could even join our efforts and pick the best parts of both our solutions. I suppose splitting the points would not be a problem for them at all.

Do you also treat one quantum circuit as a ℝ ->ℝ function, using them as if it were just like any nonlinearity?

paxcema commented 3 years ago

Hi @ongspxm, yes I think they sound distinct enough that we can accept both with full points!

ongspxm commented 3 years ago

Do you also treat one quantum circuit as a ℝ ->ℝ function, using them as if it were just like any nonlinearity?

yeah i saw ur implementation and i think mine is somewhat simliar where there is only like one input to each cirucuit, so the output is basically just a quantum-modified value.

i am thinking of using n qbits, where n is log2o where o is the number of output then return the actual prediction probability and do a argmax from there but then we will have to deal with the extra values from the prediction which just removing is weird because it might not make any "quantum circuit" sense

or maybe just use o qbits, then measure the expectation for each qbits but that will be like mapping 5 values to 5 values, its much cleaner, but it assumes that all the features maps into "num-of-output" of subcategories which then are used to determine the final classificiation

not sure which is make more "quantum sense" or "nn network sense" but is something i might look more into

George3d6 commented 3 years ago

Note: since we already have 2x implementation and 2x people contributing to this please consider not taking up this issue and instead check some of the other hacktoberfest issues. If you are particularly interested in mixers check out #656