#NEWLINE# def fit_binary( est , i , X , y , alpha , C , learning_rate , n_iter , pos_weight , neg_weight , sample_weight ) : #NEWLINE# #INDENT# 'Fit a single binary classifier.\n\n    The i\'th class is considered the "positive" class.\n    ' #NEWLINE# ( y_i , coef , intercept , average_coef , average_intercept ) = _prepare_fit_binary ( est , y , i ) #NEWLINE# assert ( y_i . shape [ 0 ] == y . shape [ 0 ] == sample_weight . shape [ 0 ] ) #NEWLINE# ( dataset , intercept_decay ) = make_dataset ( X , y_i , sample_weight ) #NEWLINE# penalty_type = est . _get_penalty_type ( est . penalty ) #NEWLINE# learning_rate_type = est . _get_learning_rate_type ( learning_rate ) #NEWLINE# random_state = check_random_state ( est . random_state ) #NEWLINE# seed = random_state . randint ( 0 , np . iinfo ( np . int32 ) . max ) #NEWLINE# if ( not est . average ) : #NEWLINE# #INDENT# return plain_sgd ( learning_rate_type , intercept , est . loss_function , penalty_type , alpha , C , est . l1_ratio , dataset , n_iter , int ( est . fit_intercept ) , int ( est . verbose ) , int ( est . shuffle ) , seed , pos_weight , neg_weight , learning_rate_type , est . eta0 , est . power_t , est . t_ , intercept_decay ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( standard_coef , standard_intercept , average_coef , average_intercept ) = average_sgd ( coef , intercept , average_coef , average_intercept , est . loss_function , penalty_type , alpha , C , est . l1_ratio , dataset , n_iter , int ( est . fit_intercept ) , int ( est . verbose ) , int ( est . shuffle ) , seed , pos_weight , neg_weight , learning_rate_type , est . eta0 , est . power_t , est . t_ , intercept_decay , est . average ) #NEWLINE# if ( len ( est . classes_ ) == 2 ) : #NEWLINE# #INDENT# est . average_intercept_ [ 0 ] = average_intercept #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# est . average_intercept_ [ i ] = average_intercept #NEWLINE# #UNINDENT# return ( standard_coef , standard_intercept )