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.

Can't reproduce logistic regression example.

See original GitHub issue

🐛 Bug

I am unable to run the logistic regression example . At training, I get error which ends in:

/usr/local/lib/python3.6/dist-packages/pl_bolts/models/regression/logistic_regression.py in validation_step(self, batch, batch_idx)
     81         x = x.view(x.size(0), -1)
     82         y_hat = self(x)
---> 83         acc = accuracy(y_hat, y)
     84         return {'val_loss': F.cross_entropy(y_hat, y), 'acc': acc}
     85 

TypeError: 'module' object is not callable

Notably, I modified the example to not use TPUs.

Example code I follow is:

https://pytorch-lightning-bolts.readthedocs.io/en/latest/classic_ml.html#logistic-regression

To Reproduce

I tried to reproduce this in both Colab and as a python script in a fresh virtual env.

Colab notebook gist with full error and requirements:

https://gist.github.com/pavopax/e9040f42725322dfd2b86975e6ba5bbc

Also ran on Linux Python 3.7.1 with requirements:

https://gist.github.com/pavopax/d631dc61eceebbfbf67d9b113504f114

Code sample

I replace code example to remove TPUs:

trainer = pl.Trainer() #(tpu_cores=8, precision=16)

I use example code from: https://pytorch-lightning-bolts.readthedocs.io/en/latest/classic_ml.html#logistic-regression

For code, see gist above

Expected behavior

Code runs without errors and produces result

Environment

Colab with requirements as above

Additional context

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
plpxskcommented, Oct 16, 2020

I confirm the issue is now resolved. Thanks for a fast and awesome issue resolution experience 💯 🙌

1reaction
akihironittacommented, Oct 14, 2020

@pavopax Thank you for reporting the issue in detail! Could you try updating bolts with pip install pytorch-lightning-bolts --upgrade? If you get an ImportError after updating, can you try pip install pytorch-lightning-bolts["extra"] --upgrade to install relevant modules?

Read more comments on GitHub >

github_iconTop Results From Across the Web

When logistic regression simply doesn't work | by Alon Lekhtman
When logistic regression simply doesn't work. A simple example for a case when logistic regression can't work properly.
Read more >
Logistic Regression
One of the assumptions of regression is that the variance of Y is constant across values of X (homoscedasticity). This cannot be the...
Read more >
Logistic Regression - CMU Statistics
This lecture will be about this approach. To sum up: we have a binary output variable Y, and we want to model the...
Read more >
Logistic Regression Example - YouTube
This video walks through an analysis using logistic regression. ... Your browser can't play this video. ... Logistic Regression Example.
Read more >
What is Logistic Regression? - Data Science Duniya
Why can't we use linear regression for classification problems? ... Below image describes this whole concept with an example. Linear ...
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