Exemple #1
0
	def test_merge(self):
		isa1 = ISA(5, ssize=2)
		isa2 = ISA(5)

		isa1.initialize()
		isa1.orthogonalize()

		isa2.initialize()
		isa2.A = isa1.A

		params = isa2.default_parameters()
		params['train_basis'] = False
		params['merge_subspaces'] = True
		params['merge']['verbosity'] = 0

		isa2.train(isa1.sample(10000), params)

		ssizes1 = [gsm.dim for gsm in isa1.subspaces()]
		ssizes2 = [gsm.dim for gsm in isa2.subspaces()]

		# algorithm should be able to recover subspace sizes
		self.assertTrue(all(sort(ssizes1) == sort(ssizes2)))
Exemple #2
0
    def test_merge(self):
        isa1 = ISA(5, ssize=2)
        isa2 = ISA(5)

        isa1.initialize()
        isa1.orthogonalize()

        isa2.initialize()
        isa2.A = isa1.A

        params = isa2.default_parameters()
        params['train_basis'] = False
        params['merge_subspaces'] = True
        params['merge']['verbosity'] = 0

        isa2.train(isa1.sample(10000), params)

        ssizes1 = [gsm.dim for gsm in isa1.subspaces()]
        ssizes2 = [gsm.dim for gsm in isa2.subspaces()]

        # algorithm should be able to recover subspace sizes
        self.assertTrue(all(sort(ssizes1) == sort(ssizes2)))
Exemple #3
0
	def test_orthogonalize(self):
		isa = ISA(4, 8)
		isa.orthogonalize()

		self.assertLess(sum(square(dot(isa.A, isa.A.T) - eye(4)).flatten()), 1e-3)
Exemple #4
0
    def test_orthogonalize(self):
        isa = ISA(4, 8)
        isa.orthogonalize()

        self.assertLess(sum(square(dot(isa.A, isa.A.T) - eye(4)).flatten()),
                        1e-3)