python-igraph API reference

List of all classes, functions and methods in python-igraph

class documentation

class RunningMean(object):

View In Hierarchy

Running mean calculator.

This class can be used to calculate the mean of elements from a list, tuple, iterable or any other data source. The mean is calculated on the fly without explicitly summing the values, so it can be used for data sets with arbitrary item count. Also capable of returning the standard deviation (also calculated on the fly)

Method __complex__ Undocumented
Method __float__ Undocumented
Method __init__ RunningMean(items=None, n=0.0, mean=0.0, sd=0.0)
Method __int__ Undocumented
Method __len__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method add RunningMean.add(value, repeat=1)
Method add_many RunningMean.add(values)
Method clear Resets the running mean calculator.
Property mean Returns the current mean
Property result Returns the current mean and standard deviation as a tuple
Property sd Returns the current standard deviation
Property var Returns the current variation
Instance Variable _mean Undocumented
Instance Variable _nitems Undocumented
Instance Variable _sd Undocumented
Instance Variable _sqdiff Undocumented
def __complex__(self):

Undocumented

def __float__(self):

Undocumented

def __init__(self, items=None, n=0.0, mean=0.0, sd=0.0):

RunningMean(items=None, n=0.0, mean=0.0, sd=0.0)

Initializes the running mean calculator.

There are two possible ways to initialize the calculator. First, one can provide an iterable of items; alternatively, one can specify the number of items, the mean and the standard deviation if we want to continue an interrupted calculation.

Parameters
itemsthe items that are used to initialize the running mean calcuator. If items is given, n, mean and sd must be zeros.
nthe initial number of elements already processed. If this is given, items must be None.
meanthe initial mean. If this is given, items must be None.
sdthe initial standard deviation. If this is given, items must be None.
def __int__(self):

Undocumented

def __len__(self):

Undocumented

def __repr__(self):

Undocumented

def __str__(self):

Undocumented

def add(self, value, repeat=1):

RunningMean.add(value, repeat=1)

Adds the given value to the elements from which we calculate the mean and the standard deviation.

Parameters
valuethe element to be added
repeatnumber of repeated additions
def add_many(self, values):

RunningMean.add(values)

Adds the values in the given iterable to the elements from which we calculate the mean. Can also accept a single number. The left shift (<<) operator is aliased to this function, so you can use it to add elements as well:

>>> rm=RunningMean()
>>> rm << [1,2,3,4]
>>> rm.result               # doctest:+ELLIPSIS
(2.5, 1.290994...)
Parameters
values:iterablethe element(s) to be added
def clear(self):

Resets the running mean calculator.

@property
mean =

Returns the current mean

@property
result =

Returns the current mean and standard deviation as a tuple

@property
sd =

Returns the current standard deviation

@property
var =

Returns the current variation

_mean =

Undocumented

_nitems =

Undocumented

_sd =

Undocumented

_sqdiff =

Undocumented