#NEWLINE# def fit( self , X , y , sample_weight = None ) : #NEWLINE# #INDENT# 'Calibrate the fitted model\n\n        Parameters\n        ----------\n        X : array-like, shape (n_samples, n_features)\n            Training data.\n\n        y : array-like, shape (n_samples,)\n            Target values.\n\n        sample_weight : array-like, shape = [n_samples] or None\n            Sample weights. If None, then samples are equally weighted.\n\n        Returns\n        -------\n        self : object\n            Returns an instance of self.\n        ' #NEWLINE# lb = LabelBinarizer ( ) #NEWLINE# Y = lb . fit_transform ( y ) #NEWLINE# self . classes_ = lb . classes_ #NEWLINE# ( df , idx_pos_class ) = self . _preproc ( X ) #NEWLINE# self . calibrators_ = [ ] #NEWLINE# for ( k , this_df ) in zip ( idx_pos_class , idx_pos_class . T ) : #NEWLINE# #INDENT# if ( self . method == 'isotonic' ) : #NEWLINE# #INDENT# calibrator = IsotonicRegression ( out_of_bounds = 'clip' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . method == 'sigmoid' ) : #NEWLINE# #INDENT# calibrator = _SigmoidCalibration ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'method should be "sigmoid" or "isotonic". Got %s.' % self . method ) ) #NEWLINE# #UNINDENT# #UNINDENT# calibrator . fit ( this_df , Y [ : , k ] , sample_weight ) #NEWLINE# self . calibrators_ . append ( calibrator ) #NEWLINE# #UNINDENT# return self