class_docstr: Fitting Method Mixin
      
class_docstr_tok: ["Fitting","Method","Mixin"]
docstr: set initial weight
  
  initialization methods are specified by `itype`
  
  * 0: cleared by 0
  * 1: follows standard normal distribution
  * 2: learned by standard logistic regression
  * 3: learned by standard logistic regression separately according to
    the value of sensitve feature
  
  Parameters
  ----------
  itype : int
      type of initialization method
  X : array, shape=(n_samples, n_features)
      feature vectors of samples
  y : array, shape=(n_samples)
      target class of samples
  s : array, shape=(n_samples)
      values of sensitive features
docstr_tok: ["set","initial","weight","initialization","methods","are","specified","by","`","itype","`","*","0",":","cleared","by","0","*","1",":","follows","standard","normal","distribution","*","2",":","learned","by","standard","logistic","regression","*","3",":","learned","by","standard","logistic","regression","separately","according","to","the","value","of","sensitve","feature","Parameters","--","--","--","--","--","itype",":","int","type","of","initialization","method","X",":","array",",","shape=","(","n_samples",",","n_features",")","feature","vectors","of","samples","y",":","array",",","shape=","(","n_samples",")","target","class","of","samples","s",":","array",",","shape=","(","n_samples",")","values","of","sensitive","features"]
code: def init_coef(self, itype, X, y, s):
      """set initial weight
  
      initialization methods are specified by `itype`
  
      * 0: cleared by 0
      * 1: follows standard normal distribution
      * 2: learned by standard logistic regression
      * 3: learned by standard logistic regression separately according to
        the value of sensitve feature
  
      Parameters
      ----------
      itype : int
          type of initialization method
      X : array, shape=(n_samples, n_features)
          feature vectors of samples
      y : array, shape=(n_samples)
          target class of samples
      s : array, shape=(n_samples)
          values of sensitive features
      """
  
      if itype == 0:
          # clear by zeros
          self.coef_ = np.zeros(
              self.n_sfv_ * self.n_features_, dtype=np.float
          )
      elif itype == 1:
          # at random
          self.coef_ = np.random.randn(self.n_sfv_ * self.n_features_)
  
      elif itype == 2:
          # learned by standard LR
          self.coef_ = np.empty(
              self.n_sfv_ * self.n_features_, dtype=np.float
          )
          coef = self.coef_.reshape(self.n_sfv_, self.n_features_)
  
          clr = LogisticRegression(
              C=self.C, penalty="l2", fit_intercept=False
          )
          clr.fit(X, y)
  
          coef[:, :] = clr.coef_
      elif itype == 3:
          # learned by standard LR
          self.coef_ = np.empty(
              self.n_sfv_ * self.n_features_, dtype=np.float
          )
          coef = self.coef_.reshape(self.n_sfv_, self.n_features_)
  
          for i in range(self.n_sfv_):
              clr = LogisticRegression(
                  C=self.C,
                  penalty="l2",
                  max_iter=1000,
                  fit_intercept=False,
              )
              clr.fit(X[s == i, :], y[s == i])
              coef[i, :] = clr.coef_
      else:
          raise TypeError
  
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 1 for calling the LRwPRFittingType1Mixin obj's underlying member method code with example usage: obj.init_coef(itype, X, y, s) without return types