class_docstr: Histogram- based outlier detection (HBOS) is an efficient unsupervised
  method. It assumes the feature independence and calculates the degree
  of outlyingness by building histograms. See :cite:`goldstein2012histogram`
  for details.    
  
  Two versions of HBOS are supported:        
  - Static number of bins: uses a static number of bins for all features.
  - Automatic number of bins: every feature uses a number of bins deemed to 
    be optimal according to the Birge-Rozenblac method
    (:cite:`birge2006many`).
    
  Parameters
  ----------
  n_bins : int or string, optional (default=10)
      The number of bins. "auto" uses the birge-rozenblac method for
      automatic selection of the optimal number of bins for each feature.
  
  alpha : float in (0, 1), optional (default=0.1)
      The regularizer for preventing overflow.
  
  tol : float in (0, 1), optional (default=0.5)
      The parameter to decide the flexibility while dealing
      the samples falling outside the bins.
  
  contamination : float in (0., 0.5), optional (default=0.1)
      The amount of contamination of the data set,
      i.e. the proportion of outliers in the data set. Used when fitting to
      define the threshold on the decision function.
  
  Attributes
  ----------
  bin_edges_ : numpy array of shape (n_bins + 1, n_features )
      The edges of the bins.
  
  hist_ : numpy array of shape (n_bins, n_features)
      The density of each histogram.
  
  decision_scores_ : numpy array of shape (n_samples,)
      The outlier scores of the training data.
      The higher, the more abnormal. Outliers tend to have higher
      scores. This value is available once the detector is fitted.
  
  threshold_ : float
      The threshold is based on ``contamination``. It is the
      ``n_samples * contamination`` most abnormal samples in
      ``decision_scores_``. The threshold is calculated for generating
      binary outlier labels.
  
  labels_ : int, either 0 or 1
      The binary labels of the training data. 0 stands for inliers
      and 1 for outliers/anomalies. It is generated by applying
      ``threshold_`` on ``decision_scores_``.
class_docstr_tok: ["Histogram-","based","outlier","detection","(","HBOS",")","is","an","efficient","unsupervised","method",".","It","assumes","the","feature","independence","and","calculates","the","degree","of","outlyingness","by","building","histograms",".","See",":","cite",":","`","goldstein2012histogram","`","for","details",".","Two","versions","of","HBOS","are","supported",":","-","Static","number","of","bins",":","uses","a","static","number","of","bins","for","all","features",".","-","Automatic","number","of","bins",":","every","feature","uses","a","number","of","bins","deemed","to","be","optimal","according","to","the","Birge-Rozenblac","method","(",":","cite",":","`","birge2006many","`",")",".","Parameters","--","--","--","--","--","n_bins",":","int","or","string",",","optional","(","default=10",")","The","number","of","bins",".","``","auto","''","uses","the","birge-rozenblac","method","for","automatic","selection","of","the","optimal","number","of","bins","for","each","feature",".","alpha",":","float","in","(","0",",","1",")",",","optional","(","default=0.1",")","The","regularizer","for","preventing","overflow",".","tol",":","float","in","(","0",",","1",")",",","optional","(","default=0.5",")","The","parameter","to","decide","the","flexibility","while","dealing","the","samples","falling","outside","the","bins",".","contamination",":","float","in","(","0.",",","0.5",")",",","optional","(","default=0.1",")","The","amount","of","contamination","of","the","data","set",",","i.e",".","the","proportion","of","outliers","in","the","data","set",".","Used","when","fitting","to","define","the","threshold","on","the","decision","function",".","Attributes","--","--","--","--","--","bin_edges_",":","numpy","array","of","shape","(","n_bins","+","1",",","n_features",")","The","edges","of","the","bins",".","hist_",":","numpy","array","of","shape","(","n_bins",",","n_features",")","The","density","of","each","histogram",".","decision_scores_",":","numpy","array","of","shape","(","n_samples",",",")","The","outlier","scores","of","the","training","data",".","The","higher",",","the","more","abnormal",".","Outliers","tend","to","have","higher","scores",".","This","value","is","available","once","the","detector","is","fitted",".","threshold_",":","float","The","threshold","is","based","on","``","contamination","``",".","It","is","the","``","n_samples","*","contamination","``","most","abnormal","samples","in","``","decision_scores_","``",".","The","threshold","is","calculated","for","generating","binary","outlier","labels",".","labels_",":","int",",","either","0","or","1","The","binary","labels","of","the","training","data",".","0","stands","for","inliers","and","1","for","outliers\/anomalies",".","It","is","generated","by","applying","``","threshold_","``","on","``","decision_scores_","``","."]
code: def __init__(self, n_bins=10, alpha=0.1, tol=0.5, contamination=0.1):
      super(HBOS, self).__init__(contamination=contamination)
      self.n_bins = n_bins
      self.alpha = alpha
      self.tol = tol
  
      check_parameter(alpha, 0, 1, param_name="alpha")
      check_parameter(tol, 0, 1, param_name="tol")
  
file_path: pyod/pyod/models/hbos.py
imports: from __future__ import division
  from __future__ import print_function
  import numpy
  from numba import njit
  from sklearn.utils import check_array
  from sklearn.utils.validation import check_is_fitted
  from .base import BaseDetector
  from ..utils.utility import check_parameter
  from ..utils.utility import get_optimal_n_bins
  from ..utils.utility import invert_order
label_desc: Use image node_id 1 to create a new HBOS object from inherited base classes: BaseDetector with example: obj = HBOS(n_bins, alpha, tol, contamination)