-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
aggregation.py
39 lines (29 loc) · 1.03 KB
/
aggregation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This module contains functions to perform aggregation on a list of values obtained from the confirmation measure."""
import logging
import numpy as np
logger = logging.getLogger(__name__)
def arithmetic_mean(confirmed_measures):
"""
Perform the arithmetic mean aggregation on the output obtained from
the confirmation measure module.
Parameters
----------
confirmed_measures : list of float
List of calculated confirmation measure on each set in the segmented topics.
Returns
-------
`numpy.float`
Arithmetic mean of all the values contained in confirmation measures.
Examples
--------
.. sourcecode:: pycon
>>> from gensim.topic_coherence.aggregation import arithmetic_mean
>>> arithmetic_mean([1.1, 2.2, 3.3, 4.4])
2.75
"""
return np.mean(confirmed_measures)