Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* allow custom model #322

Closed
wants to merge 3 commits into from
Closed

* allow custom model #322

wants to merge 3 commits into from

Conversation

aaarrti
Copy link
Collaborator

@aaarrti aaarrti commented Dec 22, 2023

Description

  • Right now, user can only use TensorFlowModel or PyTorchModel from quantus
  • If user wants to evaluate, e.g, baseline (sklearn) model, there is no way

Implemented changes

  • Allow custom implementers of ModelInterface

@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (c32da2b) 91.20% compared to head (1a7d0fb) 91.18%.

Files Patch % Lines
quantus/helpers/utils.py 50.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #322      +/-   ##
==========================================
- Coverage   91.20%   91.18%   -0.03%     
==========================================
  Files          66       66              
  Lines        3887     3889       +2     
==========================================
+ Hits         3545     3546       +1     
- Misses        342      343       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@annahedstroem annahedstroem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be any functions calling this function where this statement needs to hold true, i.e., where we want to return the ModelInterface from this function? @aaarrti

@aaarrti
Copy link
Collaborator Author

aaarrti commented Jan 25, 2024

Could there be any functions calling this function where this statement needs to hold true, i.e., where we want to return the ModelInterface from this function? @aaarrti

Could there be any functions calling this function where this statement needs to hold true, i.e., where we want to return the ModelInterface from this function? @aaarrti

Hi,
the use case for this is custom implementations of ModelInterface provided by user, smth like:

import quantus

class MyOwnCustomModel(quantus.ModelInterface):

   """
   User-defined wrapper around model, 
   which is not supported out of the box by Quantus
   """

   def predict(x_batch, **kwargs):
       ...


model = MyOwnCustomModel()
scores = quantus.RandomLogit()(model, ...)       

@annahedstroem
Copy link
Member

hi @aaarrti great example! can you formulate that as a test case? that would be golden!

@aaarrti
Copy link
Collaborator Author

aaarrti commented Feb 5, 2024

Hi @annahedstroem,
this tiny PR was meant as a demonstration for @abarbosa94 on how we could enable custom user defined models. Unfortunately, I barely have any free time lately, so I will not be able to fully develop tests case and demo notebook showcasing custom models support. As this is a tiny change, I think it can easily be made when it is actually needed. So, I will close the PR 🙃

@aaarrti aaarrti closed this Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants