Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Os df . head ( 3 ) table [ [ , User ID , Gender,Age,EstimatedSalary,Purchased ] , [ 0 , 1 5 6 2
Os
dfhead
tableUser IDGender,Age,EstimatedSalary,PurchasedMale,Male,Female,
Next steps:
Generate code with
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
s
from sklearn.modelselection import traintestsplit # Implement here
Split the data into train samples and test samples, with random state
Split the train into real train and validation with random state
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 LogisticRegressionviaGDPyIr:
Input: an np array of rows and columns, a label vector of entries and learning rate parameter Ir
Output: The function computes the output vector and which minimzes the logistic regression cost function on and
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 gradL which is the true empirical loss' gradient
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started