def predict(self, sequence): if LBL: targetrepr = sequence[-1:] sequence = sequence[:-1] (predictrepr, score) = graph.predict(self.embed(sequence), self.embed(targetrepr)[0], self.parameters.score_biases[targetrepr], self.parameters) return score else: (score) = graph.predict(self.embed(sequence), self.parameters) return score
def validate_errors(self, correct_sequences, noise_sequences): """ Count the errors in this validation batch. """ # r = graph.train(self.embeds(correct_sequences), self.embeds(noise_sequences), learning_rate * weights[0]) correct_scores = graph.predict(self.embeds(correct_sequences)) noise_scores = graph.predict(self.embeds(noise_sequences)) # print correct_scores # print noise_scores return correct_scores > noise_scores