docstr: Initialize MultitaskIRVClassifier
  
  Parameters
  ----------
  n_tasks: int
      Number of tasks
  K: int
      Number of nearest neighbours used in classification
  penalty: float
      Amount of penalty (l2 or l1 applied)
docstr_tok: ["Initialize","MultitaskIRVClassifier","Parameters","--","--","--","--","--","n_tasks",":","int","Number","of","tasks","K",":","int","Number","of","nearest","neighbours","used","in","classification","penalty",":","float","Amount","of","penalty","(","l2","or","l1","applied",")"]
code: def __init__(
      self, n_tasks, K=10, penalty=0.0, mode="classification", **kwargs
  ):
      """Initialize MultitaskIRVClassifier
  
      Parameters
      ----------
      n_tasks: int
          Number of tasks
      K: int
          Number of nearest neighbours used in classification
      penalty: float
          Amount of penalty (l2 or l1 applied)
  
      """
      self.n_tasks = n_tasks
      self.K = K
      self.n_features = 2 * self.K * self.n_tasks
      self.penalty = penalty
      mol_features = Input(shape=(self.n_features,))
      predictions = IRVLayer(self.n_tasks, self.K, self.penalty)(
          mol_features
      )
      logits = []
      outputs = []
      for task in range(self.n_tasks):
          task_output = Slice(task, 1)(predictions)
          sigmoid = Activation(tf.sigmoid)(task_output)
          logits.append(task_output)
          outputs.append(sigmoid)
      outputs = layers.Stack(axis=1)(outputs)
      outputs2 = Lambda(lambda x: 1 - x)(outputs)
      outputs = [
          Concatenate(axis=2)([outputs2, outputs]),
          logits[0]
          if len(logits) == 1
          else Concatenate(axis=1)(logits),
      ]
      model = tf.keras.Model(inputs=[mol_features], outputs=outputs)
      super(MultitaskIRVClassifier, self).__init__(
          model,
          SigmoidCrossEntropy(),
          output_types=["prediction", "loss"],
          **kwargs,
      )
  
imports: import numpy
  import tensorflow
  from deepchem.models import KerasModel, layers
  from deepchem.models.losses import SigmoidCrossEntropy
  from tensorflow.keras.layers import Input, Layer, Activation, Concatenate, Lambda
  import warnings
label_desc: Use image node_id 1 to create a new MultitaskIRVClassifier object from inherited base classes: KerasModel with example: obj = MultitaskIRVClassifier(n_tasks, K, penalty, mode)