nextwe will define sigmoid functionloss function and gradient descend as followsclass logisticregressiondef __init__(selflr= num_iter= fit_intercept=trueverbose=false)self lr lr self num_iter num_iter self fit_intercept fit_intercept self verbose verbose def __add_intercept(selfx)intercept np ones(( shape[ ] )return np concatenate((interceptx)axis= def __sigmoid(selfz)return ( np exp(- )def __loss(selfhy)return (- np log( ( ynp log( )mean(def fit(selfxy)if self fit_interceptx self __add_intercept(