Share Your Work Here - Assignment 2

Here is the link to assignment-2 : 02-insurance-linear

I was able to get my loss down to 3584.2397.

Hyperparameters :

  • loss : smooth_l1_loss
  • optimizer : Adam
  • learning rate: 2.5
  • epochs: 2000

Hi Team,
My work :
Please review and provide feedback.

In the Kaggle editor you have a ‘+ add data’ button on top right. Here is the menu to add dataset. You can either upload your own or use one of the kaggle’s online datasets.

Hey, everyone! Please look at my work and share ant of your thoughts about it. :smile:
Will be doing another data set and practice more.

Thanks for the reply.
I know on adding the dataset in kaggle.

But I am interested in like this. (see insurance.csv is given throug link). I hope you understand on what I want to achieve.

DATA_FILENAME = “insurance.csv”
download_url(DATASET_URL, ‘.’)

I’ve looked over your LOL predictor notebook and here is my opinion (which you don’t have to agree ofc :stuck_out_tongue:):

You are considering examples to be correctly classified whenever the absolute difference between output and label is less than 0.6 (your threshold). In my opinion it favors examples which have an output of anything above 0.4, to be correctly classified.

Example: output is 0.41, label is 1. Your absolute value is 0.59 which is accepted as correctly classified because it’s smaller than 0.6. The model is 41% sure that this match would be won.
Which means you accept any error that is less than 0.6.

Shouldn’t the error be as minimal as possible? In theory you could set the threshold to 0.9, and any example that has the difference less than this value would be accepted. Since the range for values is from 0 to 1, you would pretty much accept everything.

Below is my version of the notebook. I’ve decided to use crossentropy. The model decides whether it is 100% sure that this match would be lost or won (since why there are 2 outputs).

I’m pretty happy to discuss about it because it’s very interesting dataset.


Hi Everyone,

Amazing series of assignments and lecture! I was able to complete my assignment Here

1 Like

Hi, here is my second assignment

Hey everyone! Here is my submission. Whew that took me all day to complete.


It works but it doesnt work well. It depends on your learning rates but you can get it to work. Someone else mentioned looking at other loss functions : Share Your Work Here - Assignment 2 . I also read medium post referred to in this forum post. It’s good.

Resubmitting. After reading some medium posts / seeing suggestions for f1_loss and smooth_f1_loss, was able to get loss down to ~8k

Hello Everyone!

Please find my submission for the second assignment here.

Would love to hear from you all!


Hey @rohan-engmech you’re doing a mistake that I did too. In your input columns you’ve included ‘charges’ which is supposed to be the column that has to be predicted.

Try using dataframe.hist() to plot the distribution, if you want. :slightly_smiling_face:

Hello Everyone !

here’s my Assignment-2 link feel free to comment and share the feedback.

Here is my version of assignment-2… my val loss doesn’t go below 6000… maybe something is off…

Hey, I’m getting this error when converting categorical columns to numbers.

" AttributeError: ‘DataFrame’ object has no attribute ‘cat’ "

`def dataframe_to_arrays(dataframe):
    # Make a copy of the original dataframe
    dataframe1 = dataframe.copy(deep=True)
    # Convert non-numeric categorical columns to numbers
    for col in categorical_cols:
        dataframe1[col] = dataframe1[col].astype('category')
    # Extract input & outupts as numpy arrays
    inputs_array = dataframe1[input_cols].to_numpy()
    targets_array = dataframe1[output_cols].to_numpy()
    return inputs_array, targets_array`

Please help me ?

Hello everyone! Here’s my assignment:

Validation loss: 5956.6406

1 Like

Hi everyone,
Here is my second assignment.

1 Like

Hello to everyone, hope to all are good!!
this is my work on assignment 2 and i make a blog named: Car costs prediction using PyTorch. with other dataset of car costs, wish to like to anyone :smiley: good day, afternoon or night to all!