A question about ConvnetBuilder

What does is_reg(bool) parameter signify for image classification problem?

This is something that the ConvLearner infers from the data it is passed and hands this information over to ConvnetBuilder. This information is useful because it tells the builder whether we want it to build us a model to handle regression or classification. The ConvLearner also uses this to infer which loss (criterion in PyTorch parlance) it should use - whether to use the nll_loss or l1_loss.

Btw if you go to the link you shared and fit ctrl+f in your browser and type in is_reg you will see where in the code this is referenced :slight_smile: Sorry if you already know this but thought I’d share anyhow as it was a useful trick for me to quickly remind myself how this information is used before typing out the answer to your question :slight_smile:

3 Likes

Thanks for the reply. Sorry if I’m missing something obvious, but what does regression over images mean? a multiclass image classification?

The image is just a 3-dimensional array of numbers (for RGB images). We then feed it to the NN and given the NN is a universal function approximator, we can try to teach it any transformations of the input.

Meaning, the NN can apply a set of functions to the input and on the other end we can get, among other things that we might request, a vector of probabilities for the image belonging to each of the classes. Or it could output an image. Say we have a tiny image as input and we want to blow it up but for it to not be pixelated (super resolution). Or we could have it output a prediction if the image was taken during the day or at night.

Here the regression just relates to whether we want the NN to output a probability for each of the classes in the model data object we pass to the constructor (classification problem) or whether we would like it to output floats representing something. Maybe we would like it to tell us what it thinks the height of a tree in an image is? Or the age of a patient whose leg appears on an x-ray.

I am not sure we ever want a CNN to output floats in part 1 of the course, but in the first lesson of part 2 we use this to output coordinates of a bounding box around an item of interest in the picture.

3 Likes

To summarize:

  • Regression: dependent variable is continuous
  • Classification: dependent variable is categorical or binary

The words are not related to the independent variables, or to the type of model (although often people use the word ‘regression’ as a synonym for ‘linear regression’, or even for ‘general linear model’, which is more than a little confusing!)

1 Like

Thank you! makes total sense now.

Thank you so much. I got it confused with something else.
Just to confirm my understanding, let’s say hypothetically, I have images of houses and the prices they were sold (as my NN output), is_reg=True would make total sense.

1 Like

Yes :slight_smile:

1 Like