Ejemplo n.º 1
0
    def test_mapper_output(self):

        DS = datasetsIndex[1]

        data = DS(0)

        M = mappersIndex[1]

        m = M(data)

        Model = modelsIndex[3]

        X = m.X #pad_sequences(m.X, maxlen=100)

        print X.shape

        md = Model()

        # md.model.load_weights("weights")

        y = to_categorical(m.Y)

        loss = md.model.evaluate(X, y, batch_size=32, show_accuracy=True)
        print "Initial Loss and Accuracy: ", loss

        # md.model.fit(X, m.Y, batch_size=32, validation_split=0.5, nb_epoch=5, show_accuracy=True, verbose=1)
        # md.model.save_weights("weights", overwrite=True)
        #
        #
        yhat = md.model.predict_classes(X, batch_size=32)
        print "\n\nPredictions: ", np.min(yhat)
        print "\n\nPredictions: ", np.min(m.Y)
Ejemplo n.º 2
0
 def evaluate(self, X, Y):
     
     y = to_categorical(Y)
     
     # out = self.model.evaluate(
     #     X, y, 
     #     batch_size=32, 
     #     show_accuracy=True, 
     # )
     return BaseKeras.evaluate(self,X,y)
Ejemplo n.º 3
0
 def train(self, X, Y, nepochs, callbacks):
     
     y = to_categorical(Y)
     BaseKeras.train(self,X,y,nepochs, callbacks)