import numpy as np import pandas as pd data=pd.read_csv("HW4data.csv") def getName(): #TODO: Add your full name instead
Posted: Sat May 14, 2022 8:24 pm
import pandas as pd
data=pd.read_csv("HW4data.csv")
def getName():
#TODO: Add your full name instead of Lionel Messi
return "Lionel Messi"
def getStudentID():
#TODO: Replace X's with your student ID. It should stay as a string
and should have exactly 9 digits in it.
return "012345678"
def standardize(X):
return (X - X.mean())/X.std(), X.mean(), X.std()
#Define your functions here if necessary
def gradient_descent(data,num_iter,alpha,random_seed):
X=np.array(data['X'])
y=np.array(data['y'])
X,muX,sdX = standardize(X)
#Do not standardize y!!!!!
np.random.seed(random_seed)
#beta values are initialized here. Don't reinitialize beta values
again!!
beta0 = np.random.rand()
beta1 = np.random.rand()
J_list = []
#write your own code here
return J_list,beta0,beta1
PLEASE WRİTE PYTHON CODE!!
Your task: In this assignment, you will be fitting a logistic function using inputs x and outputs y, 1 1+e-(30+812) 1
where 30 and By are coefficients of the model. The error function of the logistic regression model is not sum of squared errors. When fitting logistic regression model, we seek minimizing cross-entropy given in the following form: n 1 1 J=- S [y en 17-wthorn) + (1 – 3. m(1-17-25) (e
