question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implementation of exponential extrapolator for the differentiable mitigate_with_zne functionality

See original GitHub issue

Feature details

The newly added differentiable zero noise extrapolation (mitigate_with_zne) function only supports a polynomial extrapolation. mitiq equivalent of this function allows many other functions (e.g. exponential, linear, poly-exponential, etc. (see)). I believe it would be a great addition to add these options.

Implementation

No response

How important would you say this feature is?

2: Somewhat important. Needed this quarter.

Additional information

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CatalinaAlbornozcommented, Oct 6, 2022

Hi @cnktysz, this issue has now been labelled as participating in Hacktoberfest! This is a very large open-source event that is taking place during the month of October. If you register for the event and contribute at least 4PRs in any of the participating projects you get the chance to win a Hacktoberfest t-shirt or plant a tree.

Let us know if you have any questions about this! Remember that for your contribution to count it needs to be accepted by October 31st.

1reaction
Qottmanncommented, Oct 4, 2022

Hi @cnktysz good idea! As long as you can trace it back to a polynomial fit it should be relatively straight-forward. I.e. if you mean by exponential fit $y=c_0\exp(c_1 x)$ then you can write a dummy function

def exp_extrapolate(x, y):
    logy = qml.math.log(y)
    coef = _polyfit(x, logy, 1)
    return qml.math.exp(coef[1])

since $\log(y) = \log(c_1) + c_0 x$ and the extrapolated result is $y(0)=c_1$.

For extrapolation that cannot be reduced to polynomial fitting it gets more complicated. To preserve differentiability you have to stick to pennylane.math functions. Currently, the backbone in the ZNE is the custom _polyfit function (see pennylane/transforms/mitigate.py#L247), and you would have to write a more elaborate non-linear fitting function. This is totally possible, e.g. using backprop and doing a least-squares fit, but just a little more involved.

Alternatively, you can use any numpy/scipy fitting function if you can live without automatic differentiability!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hardware Implementation of the Exponential Function Using ...
the exponential function is implemented using two different architectures that are using Taylor series and Linear Interpolation.
Read more >
Chapter 3 Gradient-based optimization
Here we review the general form of gradient descent (GD) for convex minimization problems; the LS application is simply a special case. Venn...
Read more >
Performing an exponential regression in JavaScript
First and foremost: My equation is differentiable, I just wasn't sure how to differentiate it. The error function is a sum so the...
Read more >
Loss Functions in Machine Learning and LTR - Yuan Du
The exponential loss is convex and grows exponentially for negative values which makes it more sensitive to outliers. The exponential loss is ...
Read more >
A Fast, Compact Approximation of the Exponential Function
This article describes how exponentiation can be approximated by manipulating the components of a standard (IEEE-754) floating-point representation. This models ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found