コード例 #1
0
 def test_std_with_ddof(self):
     x = np.random.uniform(0, 10, (20, 100))
     for axis in [None, 0, 1]:
         np.testing.assert_almost_equal(
             np.std(x, axis=axis, ddof=10),
             std(csr_matrix(x), axis=axis, ddof=10),
         )
コード例 #2
0
ファイル: test_statistics.py プロジェクト: biolab/orange3
 def test_std_with_ddof(self):
     x = np.random.uniform(0, 10, (20, 100))
     for axis in [None, 0, 1]:
         np.testing.assert_almost_equal(
             np.std(x, axis=axis, ddof=10),
             std(csr_matrix(x), axis=axis, ddof=10),
         )
コード例 #3
0
ファイル: cca.py プロジェクト: robertcv/orange3-single-cell
def _standardize(X, tol=1e-8):
    """ Standardize matrix X avoiding NaNs and small values. """
    s = ut.std(X, axis=0)
    m = np.zeros(*s.shape)
    valid = s > tol
    m[np.logical_not(valid)] = 0
    m[valid] = 1.0 / s[valid]
    return (X - X.mean(axis=0)) * m
コード例 #4
0
ファイル: test_statistics.py プロジェクト: biolab/orange3
 def test_std(self):
     for data in self.data:
         for axis in chain((None,), range(len(data.shape))):
             # Can't use array_equal here due to differences on 1e-16 level
             np.testing.assert_array_almost_equal(
                 std(csr_matrix(data), axis=axis),
                 np.std(data, axis=axis)
             )
コード例 #5
0
ファイル: test_statistics.py プロジェクト: zhaoyin214/orange3
 def test_std(self):
     for data in self.data:
         for axis in chain((None,), range(len(data.shape))):
             # Can't use array_equal here due to differences on 1e-16 level
             np.testing.assert_array_almost_equal(
                 std(csr_matrix(data), axis=axis),
                 np.std(data, axis=axis)
             )