Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Os df . head ( 3 ) table [ [ , User ID , Gender,Age,EstimatedSalary,Purchased ] , [ 0 , 1 5 6 2

Os
df.head (3)
\table[[,User ID,Gender,Age,EstimatedSalary,Purchased],[0,15624510,Male,19,19000,0],[1,15810944,Male,35,20000,0],[2,15668575,Female,26,43000,0]]
Next steps:
Generate code with df
View recommended plots
After looking at the data, drop irrelevant features (such that have no learnability meaning) and make sure your remaining features are numeric.
# Implement here
Plot on the densities of the features, choose the scaler we will be using.
Write here your answer and explain it
1s
from sklearn.model_selection import train_test_split # Implement here
Split the data into 80% train samples and 20% test samples, with random state 42.
Split the train into real train (70%) and validation (30%) with random state 42.
Apply the scaler on the train, validation and test sets.
Remember: when scaling the test, it should use all the training data.
Tip: For minimizing the loss function, what labels did we look at? Are they the same here?
[] # Import scaling library
# Implement here
Implement the function Logistic_Regression_via_GD(P,y,Ir):
Input: an np array 'P' of 'n' rows and 'd' columns, a label vector 'y' of 'n' entries and learning rate parameter 'Ir'.
Output: The function computes the output vector 'w'(and 'b') which minimzes the logistic regression cost function on 'P' and 'y'.
The implementation should be fully yours. Don't use library implementation!
It should be done by implementing Gradient descent (with 'Ir' as the learning rate) to solve logistic regression.
Tip: The gradients may be large, you can use 1ngradL (which is the true empirical loss' gradient)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions