Giter Club home page Giter Club logo

Comments (12)

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024 1

Hello @gmartinonQM, I have some good news! I have implemented the split conformal variant in my fork here: https://github.com/RudrakshTuwani/MAPIE?organization=RudrakshTuwani&organization=RudrakshTuwani

Changes in files:

  1. mapie/regression.py - Added class MapieCovShiftRegressor.
  2. mapie/dre.py - Added classes DensityRatioEstimator and ProbClassificationDRE.
  3. mapie/utils.py - Added a function empirical_quantile for calculating weighted empirical quantile.

The replication of paper results is at examples/regression/4-covariate-shift/paper_replication.ipynb. There are a couple of differences but they are mostly due to different model defaults between Python and R. In general, we see that MapieCovShiftRegressor is able to adapt to covariate shift with oracle as well as estimated density ratios.

There's still work to be done. Right now I have just limited the functionality of MapieCovShiftRegressor to cv="prefit" and method="base". I can try working on adapting the class to other scenarios. It will likely be non-trivial due to density ratio estimation and I think I would need to spend some time thinking about how to do it in a way that doesn't violate exchangeability. If you feel the current limitations are not significant, I can also spend time on writing tests and documentation.

Let me know what you think! Thank you :)

from mapie.

gmartinonQM avatar gmartinonQM commented on May 20, 2024 1

Hi @RudrakshTuwani , thanks for your contribution ! Could you create a pull request of your fork toward master ?

from mapie.

vtaquet avatar vtaquet commented on May 20, 2024 1

Hi @RudrakshTuwani ! Yes, you can clone my branch, double-check it and add the unit tests to keep the 100% test coverage. Please let me know if you have some questions about it. Thanks again !

from mapie.

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024

Hi, I recently implemented this paper as part of a project and would love to discuss how it could be added to MAPIE.

from mapie.

gmartinonQM avatar gmartinonQM commented on May 20, 2024

Hi @RudrakshTuwani , thanks for your interest in MAPIE ! Maybe the cleanest way to do this would be to

  1. share a github repo with your implementation so that we can give you feedbacks
  2. init a pull request on MAPIE, making a separate class of your own in a dedicated module, following the template provided by the regression module
  3. Don't forget to write unit tests so as to maintain 100% coverage and to write a pedagogical example

from mapie.

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024

Awesome, thanks for the guidance. I will keep you posted!

from mapie.

gmartinonQM avatar gmartinonQM commented on May 20, 2024

Any news about this @RudrakshTuwani ?

from mapie.

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024

Hey @gmartinonQM, I had implemented the density ratio estimation class and a basic API for weighted conformal before life got in the way. Is it possible for us to meet virtually next week? I have some high-level questions and I feel like we can progress faster that way.

from mapie.

nilslacroix avatar nilslacroix commented on May 20, 2024

Tested this out of curiosity. Does not work anymore unfortunately, I think some fitting parameters have to be added to the model since it checks for residuals_

from mapie.

vtaquet avatar vtaquet commented on May 20, 2024

Hi @RudrakshTuwani, thanks again for your great work and sorry about our silence over the past few weeks.

You may have noticed that we implemented a new type of class ConformityScore that allows the user to define "custom" conformity scores (instead of residuals). Following this update, I adapted your implementation of the covariate shift method so the method can directly be used in MapieRegressor through a CovariateShiftConformityScore class. I pushed a branch here : https://github.com/scikit-learn-contrib/MAPIE/tree/add-covshift-in-conformityscore. The branch includes the modified files and your notebook adapted to my suggested modifications (I obtain the same results).

Please let me know what you'd like us to do. If you have time in the following weeks, I would be happy to help you finishing the pull request you started by considering the suggested modifications (and adding some unit tests to make sure everything is tested and controlled). If you don't have time, I can also keep working on your PR and add you as a reviewer.

Thank you once again !

from mapie.

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024

Hey @vtaquet , thanks for getting back to me and no worries! Yes, I would love to finish the pull request and make a contribution to MAPIE. :)

I can take a look at finishing up the tasks this weekend. Thanks!

from mapie.

RudrakshTuwani avatar RudrakshTuwani commented on May 20, 2024

Hey, I apologize for the radio silence on this!
What's the cleanest way to do this? Should I just clone @vtaquet's branch and add a few tests? Thanks!

from mapie.

Related Issues (20)

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.