10601-hws/HW 4/handout/python/LogReg.py
def check_conv(self,weight,new_weight,epsilon):
        '''
        Convergence Based on Tolerance Values
        Arguments:
            weight is a (d+1)-by-1 dimensional numpy matrix
            new_weights is a (d+1)-by-1 dimensional numpy matrix
            epsilon is the Tolerance value we check against
        Return : 
            True if the weights have converged (diff below given threshold epsilon), otherwise False

        '''
        def l2Norm(Theta):
            return np.sum(np.sqrt(Theta**2))

        if (l2Norm(new_weight-weight) <= epsilon):
            return True
        else:
            return False

        Convergence Based on Tolerance Values
        Arguments:
            weight is a (d+1)-by-1 dimensional numpy matrix
            new_weights is a (d+1)-by-1 dimensional numpy matrix
            epsilon is the Tolerance value we check against
        Return : 
            True if the weights have converged (diff below given threshold epsilon), otherwise False

        
Convergence Based on Tolerance Values
Arguments:
weight is a (d+1)-by-1 dimensional numpy matrix
new_weights is a (d+1)-by-1 dimensional numpy matrix
epsilon is the Tolerance value we check against
Return :
True if the weights have converged (diff below given threshold epsilon), otherwise False
Convergence Based on Tolerance Values Arguments : weight is a ( d + 1 ) - by - 1 dimensional numpy matrix new_weights is a ( d + 1 ) - by - 1 dimensional numpy matrix epsilon is the Tolerance value we check against Return : True if the weights have converged ( diff below given threshold epsilon ) otherwise False
def check_conv(self,weight,new_weight,epsilon):
        def l2Norm(Theta):
            return np.sum(np.sqrt(Theta**2))
        if (l2Norm(new_weight-weight) <= epsilon):
            return True
        else:
            return False
def check_conv ( self , weight , new_weight , epsilon ) : def l2Norm ( Theta ) : return np . sum ( np . sqrt ( Theta ** 2 ) ) if ( l2Norm ( new_weight - weight ) <= epsilon ) : return True else : return False
Convergence Based on Tolerance Values
Arguments:
weight is a (d+1)-by-1 dimensional numpy matrix
new_weights is a (d+1)-by-1 dimensional numpy matrix
epsilon is the Tolerance value we check against
Return :
True if the weights have converged (diff below given threshold epsilon), otherwise False
Convergence Based on Tolerance Values Arguments : weight is a ( d + 1 ) - by - 1 dimensional numpy matrix new_weights is a ( d + 1 ) - by - 1 dimensional numpy matrix epsilon is the Tolerance value we check against Return : True if the weights have converged ( diff below given threshold epsilon ) otherwise False
'''
        Convergence Based on Tolerance Values
        Arguments:
            weight is a (d+1)-by-1 dimensional numpy matrix
            new_weights is a (d+1)-by-1 dimensional numpy matrix
            epsilon is the Tolerance value we check against
        Return : 
            True if the weights have converged (diff below given threshold epsilon), otherwise False

        '''
self
weight
new_weight
epsilon