code: def fit(self, X, y, cost_mat):
          
  
          #TODO: Check input
  
          n_features = X.shape[1]
          if self.fit_intercept:
              w0 = np.zeros(n_features + 1)
          else:
              w0 = np.zeros(n_features)
  
          if self.solver == 'ga':
              #TODO: add n_jobs
              res = GeneticAlgorithmOptimizer(_logistic_cost_loss,
                                              w0.shape[0],
                                              iters=self.max_iter,
                                              type_='cont',
                                              n_chromosomes=100,
                                              per_mutations=0.25,
                                              n_elite=10,
                                              fargs=(X, y, cost_mat, 1. / self.C),
                                              range_=(-5, 5),
                                              n_jobs=1,
                                              verbose=self.verbose)
              res.fit()
  
          elif self.solver == 'bfgs':
  
              if self.verbose > 0:
                  disp = True
              else:
                  disp = False
  
              res = minimize(_logistic_cost_loss,
                             w0,
                             method='BFGS',
                             args=(X, y, cost_mat, 1. / self.C),
                             tol=self.tol,
                             options={'maxiter': self.max_iter, 'disp': disp})
  
          if self.fit_intercept:
              self.coef_ = res.x[:-1]
              self.intercept_ = res.x[-1]
          else:
              self.coef_ = res.x
docs: Build a example-dependent cost-sensitive logistic regression from the training set (X, y, cost_mat)
  
          Parameters
          ----------
          X : array-like of shape = [n_samples, n_features]
              The input samples.
  
          y : array indicator matrix
              Ground truth (correct) labels.
  
          cost_mat : array-like of shape = [n_samples, 4]
              Cost matrix of the classification problem
              Where the columns represents the costs of: false positives, false negatives,
              true positives and true negatives, for each example.
  
          Returns
          -------
          self : object
              Returns self.