def test_Y_values(self): X, Y = self.X, self.Y Y[0, 0] = -1 with npt.assert_raises(ValueError): CCA(Y, X) Y[0] = 0 with npt.assert_raises(ValueError): CCA(Y, X)
def setup(self): """Data from table 11.3 in Legendre & Legendre 1998 (p. 590). Loaded results as computed with vegan 2.0-8 and compared with table 11.5 if also there.""" Y = np.loadtxt(get_data_path('example3_Y')) X = np.loadtxt(get_data_path('example3_X')) self.ordination = CCA(Y, X[:, :-1])
def test_shape(self): X, Y = self.X, self.Y with npt.assert_raises(ValueError): CCA(Y, X[:-1])
import os import numpy as np from skbio.maths.stats.ordination import CA, RDA, CCA path = os.path.dirname(os.path.abspath(__file__)) def get_path(fn): return os.path.join(path, os.pardir, 'maths', 'stats', 'ordination', 'test', 'data', fn) X = np.loadtxt(get_path('L&L_CA_data')) ordint = CA(X) ordint.biplot(1) ordint.biplot(2) Y = np.loadtxt(get_path('example2_Y')) X = np.loadtxt(get_path('example2_X')).reshape(-1, 4, order='F') ordint = RDA(Y, X) ordint.biplot() Y = np.loadtxt(get_path('example3_Y')) X = np.loadtxt(get_path('example3_X')).reshape(-1, 4, order='F') ordint = CCA(Y, X) ordint.biplot()