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

Captum TCAV train.py sgd_train_linear_model() Where do the weights come from? #1308

Open
FilipUniBe opened this issue Jul 9, 2024 · 0 comments

Comments

@FilipUniBe
Copy link

I posted this originally on StackOverflow, but now I thought it may fit better here. After all it is related to this setup.

I am using the captum setup https://captum.ai/api/concept.html https://captum.ai/tutorials/TCAV_Image

In the Default Classifier the linear classification boils down to the function sgd_train_linear_model(). When I debug the code until sklearn_model.fit(x, y, sample_weight=w, **fit_kwargs) at line 327 the variabe "w" is empty.

But then at line 338:

Convert weights to pytorch

classes = (
    torch.IntTensor(sklearn_model.classes_)
    if hasattr(sklearn_model, "classes_")
    else None
)

It can suddendly derrive the weights from the model. How so? Help me understand.

Debug and read the docs.

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

No branches or pull requests

1 participant