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

class documentation

`class RunningMean:`

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 | `__init__` |
RunningMean(items=None, n=0.0, mean=0.0, sd=0.0) |

Method | `add` |
RunningMean.add(value, repeat=1) |

Method | `add_many` |
RunningMean.add(values) |

Method | `clear` |
Resets the running mean calculator. |

Property | `result` |
Returns the current mean and standard deviation as a tuple |

Property | `mean` |
Returns the current mean |

Property | `sd` |
Returns the current standard deviation |

Property | `var` |
Returns the current variation |

Method | `__repr__` |
Undocumented |

Method | `__str__` |
Undocumented |

Method | `__float__` |
Undocumented |

Method | `__int__` |
Undocumented |

Method | `__complex__` |
Undocumented |

Method | `__len__` |
Undocumented |

Instance Variable | `_nitems` |
Undocumented |

Instance Variable | `_mean` |
Undocumented |

Instance Variable | `_sqdiff` |
Undocumented |

Instance Variable | `_sd` |
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 | items | the items that are used to initialize the running mean calcuator. If `items` is given, `n` , `mean` and `sd` must be zeros. |

n | the initial number of elements already processed. If this is given, `items` must be `None` . | |

mean | the initial mean. If this is given, `items` must be `None` . | |

sd | the initial standard deviation. If this is given, `items` must be `None` . |

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 | value | the element to be added |

repeat | number 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 | the element(s) to be added (type: iterable) |