class_docstr: Fitting Method Mixin
      
class_docstr_tok: ["Fitting","Method","Mixin"]
docstr: train this model
  
  Parameters
  ----------
  X : array, shape = (n_samples, n_features)
      feature vectors of samples
  y : array, shape = (n_samples)
      target class of samples
  ns : int
      number of sensitive features. currently fixed to N_S
  itype : int
      type of initialization method
  kwargs : any
      arguments to optmizer
docstr_tok: ["train","this","model","Parameters","--","--","--","--","--","X",":","array",",","shape","=","(","n_samples",",","n_features",")","feature","vectors","of","samples","y",":","array",",","shape","=","(","n_samples",")","target","class","of","samples","ns",":","int","number","of","sensitive","features",".","currently","fixed","to","N_S","itype",":","int","type","of","initialization","method","kwargs",":","any","arguments","to","optmizer"]
code: def fit(self, X, y, ns=N_S, itype=0, **kwargs):
      """train this model
  
      Parameters
      ----------
      X : array, shape = (n_samples, n_features)
          feature vectors of samples
      y : array, shape = (n_samples)
          target class of samples
      ns : int
          number of sensitive features. currently fixed to N_S
      itype : int
          type of initialization method
      kwargs : any
          arguments to optmizer
      """
  
      # rearrange input arguments
      s = np.atleast_1d(np.squeeze(np.array(X)[:, -ns]).astype(int))
      if self.fit_intercept:
          X = np.c_[np.atleast_2d(X)[:, :-ns], np.ones(X.shape[0])]
      else:
          X = np.atleast_2d(X)[:, :-ns]
  
      # check optimization parameters
      if not "disp" in kwargs:
          kwargs["disp"] = False
      if not "maxiter" in kwargs:
          kwargs["maxiter"] = 100
  
      # set instance variables
      self.n_s_ = ns
      self.n_sfv_ = np.max(s) + 1
      self.c_s_ = np.array(
          [
              np.sum(s == si).astype(np.float)
              for si in range(self.n_sfv_)
          ]
      )
      self.n_features_ = X.shape[1]
      self.n_samples_ = X.shape[0]
  
      # optimization
      self.init_coef(itype, X, y, s)
      self.coef_ = fmin_cg(
          self.loss,
          self.coef_,
          fprime=self.grad_loss,
          args=(X, y, s),
          **kwargs,
      )
  
      # get final loss
      self.f_loss_ = self.loss(self.coef_, X, y, s)
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import unicode_literals
  import logging
  import numpy
  from scipy.optimize import fmin_cg
  from sklearn.linear_model import LogisticRegression
  from sklearn.base import BaseEstimator, ClassifierMixin
label_desc: Use image node_id 2 for calling the LRwPRFittingType1Mixin obj's underlying member method code with example usage: obj.fit(X, y, ns, itype) without return types