numpy.array.mean - python examples

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

145 Examples 7

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        random_seeds.set_random_seeds(1235)
        moran = Moran(FakeDataProvider(data))
        result = moran.global_stat('table', 'value',
                                   'knn', 5, 99, 'the_geom',
                                   'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{ 'id': d['id'], 'attr1': d['value'], 'neighbors': d['neighbors'] } for d in self.neighbors_data]
        plpy._define_result('select', data)
        random_seeds.set_random_seeds(1235)
        result = cc.moran('table', 'value', 'knn', 5, 99, 'the_geom', 'cartodb_id')
        print 'result == None?', result == None
        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        random_seeds.set_random_seeds(1235)
        moran = Moran(FakeDataProvider(data))
        result = moran.global_stat('table', 'value',
                                   'knn', 5, 99, 'the_geom',
                                   'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{ 'id': d['id'], 'attr1': d['value'], 'neighbors': d['neighbors'] } for d in self.neighbors_data]
        plpy._define_result('select', data)
        random_seeds.set_random_seeds(1235)
        result = cc.moran('table', 'value', 'knn', 5, 99, 'the_geom', 'cartodb_id')
        print 'result == None?', result == None
        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        random_seeds.set_random_seeds(1235)
        moran = Moran(FakeDataProvider(data))
        result = moran.global_stat('table', 'value',
                                   'knn', 5, 99, 'the_geom',
                                   'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{ 'id': d['id'], 'attr1': d['value'], 'neighbors': d['neighbors'] } for d in self.neighbors_data]
        plpy._define_result('select', data)
        random_seeds.set_random_seeds(1235)
        result = cc.moran('table', 'value', 'knn', 5, 99, 'the_geom', 'cartodb_id')
        print 'result == None?', result == None
        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        plpy._define_result('select', data)
        random_seeds.set_random_seeds(1235)
        result = cc.moran('table', 'value',
                          'knn', 5, 99, 'the_geom', 'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        random_seeds.set_random_seeds(1235)
        moran = Moran(FakeDataProvider(data))
        result = moran.global_stat('table', 'value',
                                   'knn', 5, 99, 'the_geom',
                                   'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{ 'id': d['id'], 'attr1': d['value'], 'neighbors': d['neighbors'] } for d in self.neighbors_data]
        plpy._define_result('select', data)
        random_seeds.set_random_seeds(1235)
        result = cc.moran('table', 'value', 'knn', 5, 99, 'the_geom', 'cartodb_id')
        print 'result == None?', result == None
        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)

3 View Complete Implementation : test_clustering_moran.py
Copyright BSD 3-Clause "New" or "Revised" License
Author : CartoDB
    def test_moran(self):
        """Test Moran's I global"""
        data = [{'id': d['id'],
                 'attr1': d['value'],
                 'neighbors': d['neighbors']} for d in self.neighbors_data]
        random_seeds.set_random_seeds(1235)
        moran = Moran(FakeDataProvider(data))
        result = moran.global_stat('table', 'value',
                                   'knn', 5, 99, 'the_geom',
                                   'cartodb_id')

        result_moran = result[0][0]
        expected_moran = np.array([row[0] for row in self.moran_data]).mean()
        self.astertAlmostEqual(expected_moran, result_moran, delta=10e-2)