class_docstr: OneR (One Rule) Classifier.
  
  Parameters
  ----------
  resolve_ties : str (default: 'first')
      Option for how to resolve ties if two or more features
      have the same error. Options are
      - 'first' (default): chooses first feature in the list, i.e.,
        feature with the lower column index.
      - 'chi-squared': performs a chi-squared test for each feature
        against the target and selects the feature with the lowest p-value.
  
  Attributes
  ----------
  self.classes_labels_ : array-like, shape = [n_labels]
      Array containing the unique class labels found in the
      training set.
  
  self.feature_idx_ : int
      The index of the rules' feature based on the column in
      the training set.
  
  self.p_value_ : float
      The p value for a given feature. Only available after calling `fit`
      when the OneR attribute `resolve_ties = 'chi-squared'` is set.
  
  self.prediction_dict_ : dict
      Dictionary containing information about the
      feature's (self.feature_idx_)
      rules and total error. E.g.,
      `{'total error': 37, 'rules (value: class)': {0: 0, 1: 2}}`
      means the total error is 37, and the rules are
      "if feature value == 0 classify as 0"
      and "if feature value == 1 classify as 2".
      (And classify as class 1 otherwise.)
  
  For usage examples, please see
  https://rasbt.github.io/mlxtend/user_guide/classifier/OneRClassifier/
docstr: Predict class labels for X.
  
  Parameters
  ----------
  X : {array-like, sparse matrix}, shape = [n_samples, n_features]
      Training vectors, where n_samples is the number of samples and
      n_features is the number of features.
  
  Returns
  ----------
  maj : array-like, shape = [n_samples]
      Predicted class labels.
docstr_tok: ["Predict","class","labels","for","X.","Parameters","--","--","--","--","--","X",":","{","array-like",",","sparse","matrix","}",",","shape","=","[","n_samples",",","n_features","]","Training","vectors",",","where","n_samples","is","the","number","of","samples","and","n_features","is","the","number","of","features",".","Returns","--","--","--","--","--","maj",":","array-like",",","shape","=","[","n_samples","]","Predicted","class","labels","."]
code: def predict(self, X):
      """Predict class labels for X.
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, shape = [n_samples, n_features]
          Training vectors, where n_samples is the number of samples and
          n_features is the number of features.
  
      Returns
      ----------
      maj : array-like, shape = [n_samples]
          Predicted class labels.
  
      """
      if not hasattr(self, "prediction_dict_"):
          raise NotFittedError(
              "Estimator not fitted, "
              "call `fit` before using the model."
          )
  
      rules = self.prediction_dict_["rules (value: class)"]
  
      y_pred = np.zeros(X.shape[0], dtype=np.int_)
  
      # Set up labels for those class labels in the
      # dataset for which no rule exists. We use the
      # first non-specified class label as the default class label.
      rule_labels = set()
      for feature_value in rules:
          class_label = rules[feature_value]
          rule_labels.add(class_label)
      other_label = set(self.class_labels_) - rule_labels
      if len(other_label):
          y_pred[:] = list(other_label)[0]
      # else just use "np.zeros"; we could also change this to
      #  self.class_labels_[-1]+1 in future
  
      # classify all class labels for which rules exist
      for feature_value in rules:
          mask = X[:, self.feature_idx_] == feature_value
          y_pred[mask] = rules[feature_value]
  
      return y_pred
  
file_path: mlxtend/mlxtend/classifier/oner.py
imports: import warnings
  import numpy
  from scipy.stats import chi2_contingency
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.exceptions import NotFittedError
label_desc: Use image node_id 3 for calling the OneRClassifier obj's underlying member method code with example usage: obj.predict(X) and returns: y_pred