Exemple #1
0
    def test_rdf(self):
        from sklearn.datasets import load_iris
        iris = load_iris()
        data = iris.data
        target = convert_target(iris.target)

        normalise_data = normalise(data)
        rdf = RDFNetwork(normalise_data, target, 1)
        rdf.train()
        print rdf.score(normalise_data, target)
Exemple #2
0
 def a_test_iris(self):
     from sklearn.datasets import load_iris
     iris = load_iris()
     data = iris.data
     normalised_data = normalise(data)
     target = convert_target(iris.target)
     print '======================'
     mlp = MLP(normalised_data, target, hidden_node=17,
                 itercount=2005, theta=0.9, mode='softmax')
     mlp.train()
     self.assertEquals(100, mlp.score(normalised_data, target))
     self.assertEquals([[0, 0, 1]], mlp.predict(np.array([[5,5,5,2]])))