Histogram

class visualife.calc.Histogram(**kwargs)

Bases: object

Creates a new Histogram instance :param kwargs: see below :return: new Histogram instance

Keyword Arguments:
 
  • n_bins (int) – number of bins of equal width; by default 100 bins will be created
  • range (tuple(value,value)) – histogram range: (from, to)
  • width (float) – bin width
  • bin_outliers (bool) – if True, outliers will be recorded by the first and last bin of the histogram

Attributes Summary

n_bins The number of bins (classes) of this histogram.
outliers Numbers of outliers that were left outside this histogram :return: number of outliers
width Width of each bins (class) of this histogram.

Methods Summary

bin_from_to(bin_index) Returns the range of data that is included in a given bin of this histogram :param bin_index: index of a bin from 0 to n_bins-1 both inclusive :return: bin range
clear() Removes all the data from this histogram
counts(*args) Returns the number of counts for a given bin of this histogram, or the total number of counts if no histogram bin was provided :param args: index of a histogram bin or none to check the total counts :return: counts in a bin or in this histogram
highest_bin() Returns the highest bin of this histogram :return: tuple of two: (max_bin_index, max_counts)
observe(*points) Adds observation(s) to this histogram :param points: float or list(float) - data to be inserted into this histogram :return: None

Attributes Documentation

n_bins

The number of bins (classes) of this histogram. Each bin has the same width :return: the number of bins

outliers

Numbers of outliers that were left outside this histogram :return: number of outliers

width

Width of each bins (class) of this histogram. Each bin has the same width :return: bin width

Methods Documentation

bin_from_to(bin_index)

Returns the range of data that is included in a given bin of this histogram :param bin_index: index of a bin from 0 to n_bins-1 both inclusive :return: bin range

clear()

Removes all the data from this histogram

counts(*args)

Returns the number of counts for a given bin of this histogram, or the total number of counts if no histogram bin was provided :param args: index of a histogram bin or none to check the total counts :return: counts in a bin or in this histogram

highest_bin()

Returns the highest bin of this histogram :return: tuple of two: (max_bin_index, max_counts)

observe(*points)

Adds observation(s) to this histogram :param points: float or list(float) - data to be inserted into this histogram :return: None