class_docstr: Bayesian or-of-and algorithm.
  Generates patterns that satisfy the minimum support and maximum length and then select the Nrules rules that have the highest entropy.
  In function SA_patternbased, each local maximum is stored in maps and the best BOA is returned.
  Remember here the BOA contains only the index of selected rules from Nrules self.rules_
class_docstr_tok: ["Bayesian","or-of-and","algorithm",".","Generates","patterns","that","satisfy","the","minimum","support","and","maximum","length","and","then","select","the","Nrules","rules","that","have","the","highest","entropy",".","In","function","SA_patternbased",",","each","local","maximum","is","stored","in","maps","and","the","best","BOA","is","returned",".","Remember","here","the","BOA","contains","only","the","index","of","selected","rules","from","Nrules","self.rules_"]
docstr: Params
  ------
  n_rules
      number of rules to be used in SA_patternbased and also the output of generate_rules
  supp
      The higher this supp, the 'larger' a pattern is. 5% is a generally good number
  maxlen
      maximum length of a pattern
  num_iterations
      number of iterations in each chain
  num_chains
      number of chains in the simulated annealing search algorithm
  q
  alpha_pos
      $
  ho = alpha/(alpha+beta)$. Make sure $
  ho$ is close to one when choosing alpha and beta
      The alpha and beta parameters alter the prior distributions for different rules
  beta_pos
  alpha_neg
  beta_neg
  alpha_l
  beta_l
  discretization_method
      discretization method
docstr_tok: ["Params","--","--","--","n_rules","number","of","rules","to","be","used","in","SA_patternbased","and","also","the","output","of","generate_rules","supp","The","higher","this","supp",",","the","'larger","'","a","pattern","is",".","5","%","is","a","generally","good","number","maxlen","maximum","length","of","a","pattern","num_iterations","number","of","iterations","in","each","chain","num_chains","number","of","chains","in","the","simulated","annealing","search","algorithm","q","alpha_pos","$","ho","=","alpha\/","(","alpha+beta",")","$",".","Make","sure","$","ho","$","is","close","to","one","when","choosing","alpha","and","beta","The","alpha","and","beta","parameters","alter","the","prior","distributions","for","different","rules","beta_pos","alpha_neg","beta_neg","alpha_l","beta_l","discretization_method","discretization","method"]
code: def __init__(
      self,
      n_rules: int = 2000,
      supp=5,
      maxlen: int = 10,
      num_iterations=5000,
      num_chains=3,
      q=0.1,
      alpha_pos=100,
      beta_pos=1,
      alpha_neg=100,
      beta_neg=1,
      alpha_l=None,
      beta_l=None,
      discretization_method="randomforest",
      random_state=0,
  ):
      """
      Params
      ------
      n_rules
          number of rules to be used in SA_patternbased and also the output of generate_rules
      supp
          The higher this supp, the 'larger' a pattern is. 5% is a generally good number
      maxlen
          maximum length of a pattern
      num_iterations
          number of iterations in each chain
      num_chains
          number of chains in the simulated annealing search algorithm
      q
      alpha_pos
          $\rho = alpha/(alpha+beta)$. Make sure $\rho$ is close to one when choosing alpha and beta
          The alpha and beta parameters alter the prior distributions for different rules
      beta_pos
      alpha_neg
      beta_neg
      alpha_l
      beta_l
      discretization_method
          discretization method
      """
      self.n_rules = n_rules
      self.supp = supp
      self.maxlen = maxlen
  
      self.num_iterations = num_iterations
      self.num_chains = num_chains
      self.q = q
  
      self.alpha_pos = alpha_pos
      self.beta_pos = beta_pos
      self.alpha_neg = alpha_neg
      self.beta_neg = beta_neg
      self.discretization_method = discretization_method
  
      self.alpha_l = alpha_l
      self.beta_l = beta_l
      self.random_state = 0
  
imports: import itertools
  import operator
  import os
  import warnings
  from os.path import join
  from bisect import bisect_left
  from collections import defaultdict
  from copy import deepcopy
  from itertools import combinations
  from random import sample
  import numpy
  import pandas
  from mlxtend.frequent_patterns import fpgrowth
  from numpy.random import random
  from pandas import read_csv
  from scipy.sparse import csc_matrix
  from sklearn.base import BaseEstimator, ClassifierMixin
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.utils.multiclass import check_classification_targets
  from sklearn.utils.validation import check_X_y, check_is_fitted
  from imodels.rule_set.rule_set import RuleSet
  from imodels.util.arguments import check_fit_arguments
label_desc: Use image node_id 1 to create a new BayesianRuleSetClassifier object from inherited base classes: RuleSet, BaseEstimator, ClassifierMixin with example: obj = BayesianRuleSetClassifier(n_rules, supp, maxlen, num_iterations, num_chains, q, alpha_pos, beta_pos, alpha_neg, beta_neg, alpha_l, beta_l, discretization_method, random_state)