nodes: 0, module; 1, function_definition; 2, function_name:predict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:X; 7, default_parameter; 8, expression_statement; 9, comment:# Check data; 10, comment:# X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])  # Dont in version 0.15; 11, if_statement; 12, comment:#TODO: check if combination in possible combinations; 13, if_statement; 14, identifier:cost_mat; 15, None; 16, comment:"""Predict class for X.
  
          The predicted class of an input sample is computed as the class with
          the highest mean predicted probability. If base estimators do not
          implement a ``predict_proba`` method, then it resorts to voting.
  
          Parameters
          ----------
          X : {array-like, sparse matrix} of shape = [n_samples, n_features]
              The training input samples. Sparse matrices are accepted only if
              they are supported by the base estimator.
  
          cost_mat : optional array-like of shape = [n_samples, 4], (default=None)
              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
          -------
          pred : array of shape = [n_samples]
              The predicted classes.
          """; 17, comparison_operator:self.n_features_ != X.shape[1]; 18, block; 19, comparison_operator:self.combination in ['stacking', 'stacking_proba']; 20, block; 21, elif_clause; 22, elif_clause; 23, attribute; 24, subscript; 25, raise_statement; 26, attribute; 27, list; 28, expression_statement; 29, return_statement; 30, comparison_operator:self.combination in ['majority_voting', 'weighted_voting']; 31, comment:# Parallel loop; 32, block; 33, comparison_operator:self.combination in ['majority_bmr', 'weighted_bmr', 'stacking_bmr', 'stacking_proba_bmr']; 34, comment:#TODO: Add check if cost_mat == None; 35, block; 36, identifier:self; 37, identifier:n_features_; 38, attribute; 39, integer:1; 40, call; 41, identifier:self; 42, identifier:combination; 43, string; 44, string; 45, assignment; 46, call; 47, attribute; 48, list; 49, expression_statement; 50, expression_statement; 51, comment:# Reduce; 52, expression_statement; 53, return_statement; 54, attribute; 55, list; 56, expression_statement; 57, return_statement; 58, identifier:X; 59, identifier:shape; 60, identifier:ValueError; 61, argument_list; 62, string_content:stacking; 63, string_content:stacking_proba; 64, identifier:X_stacking; 65, call; 66, attribute; 67, argument_list; 68, identifier:self; 69, identifier:combination; 70, string; 71, string; 72, assignment; 73, assignment; 74, assignment; 75, call; 76, identifier:self; 77, identifier:combination; 78, string; 79, string; 80, string; 81, string; 82, assignment; 83, call; 84, call; 85, identifier:_create_stacking_set; 86, argument_list; 87, attribute; 88, identifier:predict; 89, identifier:X_stacking; 90, string_content:majority_voting; 91, string_content:weighted_voting; 92, pattern_list; 93, call; 94, identifier:all_pred; 95, call; 96, identifier:pred; 97, binary_operator:sum(all_pred) / self.n_estimators; 98, attribute; 99, argument_list; 100, string_content:majority_bmr; 101, string_content:weighted_bmr; 102, string_content:stacking_bmr; 103, string_content:stacking_proba_bmr; 104, identifier:X_bmr; 105, call; 106, attribute; 107, argument_list; 108, attribute; 109, argument_list; 110, attribute; 111, attribute; 112, attribute; 113, identifier:X; 114, attribute; 115, identifier:self; 116, identifier:f_staking; 117, identifier:n_jobs; 118, identifier:n_estimators; 119, identifier:starts; 120, identifier:_partition_estimators; 121, argument_list; 122, call; 123, generator_expression; 124, call; 125, attribute; 126, attribute; 127, identifier:take; 128, call; 129, keyword_argument; 130, attribute; 131, argument_list; 132, attribute; 133, identifier:predict; 134, identifier:X_bmr; 135, identifier:cost_mat; 136, concatenated_string; 137, identifier:format; 138, attribute; 139, subscript; 140, identifier:self; 141, identifier:estimators_; 142, identifier:self; 143, identifier:estimators_features_; 144, identifier:self; 145, identifier:estimators_weight_; 146, identifier:self; 147, identifier:combination; 148, attribute; 149, attribute; 150, identifier:Parallel; 151, argument_list; 152, call; 153, for_in_clause; 154, identifier:sum; 155, argument_list; 156, identifier:self; 157, identifier:n_estimators; 158, identifier:self; 159, identifier:classes_; 160, attribute; 161, argument_list; 162, identifier:axis; 163, integer:0; 164, identifier:self; 165, identifier:predict_proba; 166, identifier:X; 167, identifier:self; 168, identifier:f_bmr; 169, string:"Number of features of the model must "; 170, string:"match the input. Model n_features is {0} and "; 171, string:"input n_features is {1}."; 172, string:""; 173, identifier:self; 174, identifier:n_features_; 175, attribute; 176, integer:1; 177, identifier:self; 178, identifier:n_estimators; 179, identifier:self; 180, identifier:n_jobs; 181, keyword_argument; 182, keyword_argument; 183, call; 184, argument_list; 185, identifier:i; 186, call; 187, identifier:all_pred; 188, identifier:np; 189, identifier:argmax; 190, identifier:pred; 191, keyword_argument; 192, identifier:X; 193, identifier:shape; 194, identifier:n_jobs; 195, identifier:n_jobs; 196, identifier:verbose; 197, attribute; 198, identifier:delayed; 199, argument_list; 200, subscript; 201, subscript; 202, identifier:X; 203, attribute; 204, attribute; 205, subscript; 206, identifier:range; 207, argument_list; 208, identifier:axis; 209, integer:1; 210, identifier:self; 211, identifier:verbose; 212, identifier:_parallel_predict; 213, attribute; 214, slice; 215, attribute; 216, slice; 217, identifier:self; 218, identifier:n_classes_; 219, identifier:self; 220, identifier:combination; 221, attribute; 222, slice; 223, identifier:n_jobs; 224, identifier:self; 225, identifier:estimators_; 226, subscript; 227, subscript; 228, identifier:self; 229, identifier:estimators_features_; 230, subscript; 231, subscript; 232, identifier:self; 233, identifier:estimators_weight_; 234, subscript; 235, subscript; 236, identifier:starts; 237, identifier:i; 238, identifier:starts; 239, binary_operator:i + 1; 240, identifier:starts; 241, identifier:i; 242, identifier:starts; 243, binary_operator:i + 1; 244, identifier:starts; 245, identifier:i; 246, identifier:starts; 247, binary_operator:i + 1; 248, identifier:i; 249, integer:1; 250, identifier:i; 251, integer:1; 252, identifier:i; 253, integer:1
code: def predict(self, X, cost_mat=None):
          """Predict class for X.
  
          The predicted class of an input sample is computed as the class with
          the highest mean predicted probability. If base estimators do not
          implement a ``predict_proba`` method, then it resorts to voting.
  
          Parameters
          ----------
          X : {array-like, sparse matrix} of shape = [n_samples, n_features]
              The training input samples. Sparse matrices are accepted only if
              they are supported by the base estimator.
  
          cost_mat : optional array-like of shape = [n_samples, 4], (default=None)
              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
          -------
          pred : array of shape = [n_samples]
              The predicted classes.
          """
          # Check data
          # X = check_array(X, accept_sparse=['csr', 'csc', 'coo'])  # Dont in version 0.15
  
          if self.n_features_ != X.shape[1]:
              raise ValueError("Number of features of the model must "
                               "match the input. Model n_features is {0} and "
                               "input n_features is {1}."
                               "".format(self.n_features_, X.shape[1]))
  
          #TODO: check if combination in possible combinations
  
          if self.combination in ['stacking', 'stacking_proba']:
  
              X_stacking = _create_stacking_set(self.estimators_, self.estimators_features_,
                                                self.estimators_weight_, X, self.combination)
              return self.f_staking.predict(X_stacking)
  
          elif self.combination in ['majority_voting', 'weighted_voting']:
              # Parallel loop
              n_jobs, n_estimators, starts = _partition_estimators(self.n_estimators,
                                                                   self.n_jobs)
  
              all_pred = Parallel(n_jobs=n_jobs, verbose=self.verbose)(
                  delayed(_parallel_predict)(
                      self.estimators_[starts[i]:starts[i + 1]],
                      self.estimators_features_[starts[i]:starts[i + 1]],
                      X,
                      self.n_classes_,
                      self.combination,
                      self.estimators_weight_[starts[i]:starts[i + 1]])
                  for i in range(n_jobs))
  
              # Reduce
              pred = sum(all_pred) / self.n_estimators
  
              return self.classes_.take(np.argmax(pred, axis=1), axis=0)
  
          elif self.combination in ['majority_bmr', 'weighted_bmr', 'stacking_bmr', 'stacking_proba_bmr']:
              #TODO: Add check if cost_mat == None
              X_bmr = self.predict_proba(X)
              return self.f_bmr.predict(X_bmr, cost_mat)