コード例 #1
0
ファイル: model_test.py プロジェクト: gaoxuesong/xlearn
    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)
コード例 #2
0
ファイル: mlp_quant_1.py プロジェクト: gaoxuesong/xlearn
 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)
コード例 #3
0
ファイル: mlp_quant_1.py プロジェクト: gaoxuesong/xlearn
 def train(self, X, Y, nepochs, callbacks):
     
     y = to_categorical(Y)
     BaseKeras.train(self,X,y,nepochs, callbacks)