numpy.stdev

Here are the examples of the python api numpy.stdev taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: golismero Source File: texttiling.py
    def _identify_boundaries(self, depth_scores):
        """Identifies boundaries at the peaks of similarity score
        differences"""

        boundaries = [0 for x in depth_scores]

        avg = sum(depth_scores)/len(depth_scores)
        numpy.stdev = numpy.std(depth_scores)
        if self.cutoff_policy == LC:
            cutoff = avg-numpy.stdev/2.0
        else:
            cutoff = avg-numpy.stdev/2.0

        depth_tuples = zip(depth_scores, range(len(depth_scores)))
        depth_tuples.sort()
        depth_tuples.reverse()
        hp = filter(lambda x:x[0]>cutoff, depth_tuples)

        for dt in hp:
            boundaries[dt[1]] = 1
            for dt2 in hp: #undo if there is a boundary close already
                if dt[1] != dt2[1] and abs(dt2[1]-dt[1]) < 4 \
                       and boundaries[dt2[1]] == 1:
                    boundaries[dt[1]] = 0
        return boundaries