Categories: Excelling Homework

Extend/improve the code to do the following:!!(PyTorch)!!

Extend/improve the code to do the following: ————————————————————————— The Code: ————————————————————————— Changing from regression to classification: We are using “logistic regression” for classification tasks because the logistic function (aka, sigmoid) looks like a sideways “S” and ranges between 0 and 1. It essentially produces a “percent likelihood” that the data is in class A or B, etc. 32561 rows × 15 columns Need to turn some of these categorical columns into “one-hot” columns, such as workclass: Private = {0,0,0}, Self-emp-not-inc = {0,1,0}, etc. This way, the neural net does not see labels like Private = 1, Self-emp-not-inc = 2, etc. which may lead it to believe Private is “close to” Self-emp-not-inc, etc. workclass_ ? workclass_ Federal-gov workclass_ Local-gov workclass_ Never-worked workclass_ Private workclass_ Self-emp-inc workclass_ Self-emp-not-inc workclass_ State-gov workclass_ Without-pay 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0 0 2 0 0 0 0 1 0 0 0 0 3 0 0 0 0 1 0 0 0 0 4 0 0 0 0 1 0 0 0 0 … … … … … … … … … … 32556 0 0 0 0 1 0 0 0 0 32557 0 0 0 0 1 0 0 0 0 32558 0 0 0 0 1 0 0 0 0 32559 0 0 0 0 1 0 0 0 0 32560 0 0 0 0 0 1 0 0 0 32561 rows × 9 columns relationship_ Husband relationship_ Not-in-family relationship_ Other-relative relationship_ Own-child relationship_ Unmarried relationship_ Wife 0 0 1 0 0 0 0 1 1 0 0 0 0 0 2 0 1 0 0 0 0 3 1 0 0 0 0 0 4 0 0 0 0 0 1 … … … … … … … 32556 0 0 0 0 0 1 32557 1 0 0 0 0 0 32558 0 0 0 0 1 0 32559 0 0 0 1 0 0 32560 0 0 0 0 0 1 32561 rows × 6 columns Because we are doing classification, we will use CrossEntropyLoss for our criterion function. The documentation shows that the “input” (the last layer of the network) should have 2 neurons because we have two classes (50K) for our target. The docs also show we need to make our y target values a single number that is 0 or 1 (since we have two classes). We do not use “onehot” encoding on these y values. NOTE!!! There are only 24% of one class, so our model has to at least get less error than this! It can simply learn to always say “1” or whatever, ignoring the input data, and still be wrong only 24% of the time! Graph train/val loss and accuracy per epoch (two separate graphs). Use a legend to indicate which line is train and which is val. Make sure you do not cause overfitting (as indicated by your plots). Improve the accuracy so the error on the test dataset (as computed by sklearn, we’re not talking about loss here) is

Don't use plagiarized sources. Get Your Custom Essay on
Extend/improve the code to do the following:!!(PyTorch)!!
For $10/Page 0nly
Order Essay
admin

Recent Posts

Economic Debate #3- Progressive Income Tax – The Homework Helper

Economic Debate- Progressive Income Tax For this Economic Debate, we are going to discuss the…

2 years ago

MKT 6120 – Marketing Management – Davis Learning Engagement #7

TOPIC: Going Global Discussion Thread 1 (initial post due Wednesday for full credit) Please note:…

3 years ago

jvjvjhvjhvhjvj

Assignment Topic This week will culminate in the creation of a narrated PowerPoint to create…

3 years ago

Students are supposed to select a technological organization of their choice.

The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted…

3 years ago

Increases the risk of wildfires

you need to post your 2-page information flier to share with your Final Project Group.…

3 years ago

Statistics for Technology management

discussion: Discuss the methods used at your company to measure and ensure quality products and…

3 years ago