def mean_error(gen_hmm, obs_seq, actual_states): predicted_states = gen_hmm.define_labels_seq(obs_seq) error_array=errors( predicted = numpy.array(predicted_states), actual = numpy.array(actual_states) ) print(error_array.eval()) return error_array.eval().mean()
def get_error_on_patient(model, visible_set, hidden_set, algo, all_labels=True, pat=""): predicted_states = model.predict(numpy.asarray(visible_set).reshape((-1, 1))) if all_labels: error_array = errors(predicted=predicted_states, actual=hidden_set) return error_array.eval().mean() else: error_array = confusion_matrix(predicted_states=predicted_states, actual_states=hidden_set, pat=pat) return error_array
def errors(self, y): return errors( predicted = self.y_pred, actual = y, not_shared = False )
def errors(self, y): return errors(predicted=self.y_pred, actual=y, not_shared=False)