當訓練好模型後,想要找到與訓練異常的資料,只要將資料餵進模型中,再將MSE依降序排列,並設定門檻值。 門檻值可以取top N或 訓練集MSE最大值等等方法,端看應用情境。 下面python keras程式碼一樣簡單示意。 import numpy as np from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt import mysql.connector import pandas as pd from keras.models import Model from keras.layers import Dense, Input from sklearn import preprocessing from sklearn.metrics import mean_squared_error from keras.models import load_model #抓取資料 cnx = mysql.connector.connect(user='xxx', password='xxx', host='xxx', database='xxx') cursor = cnx.cursor() query = ("SELECT id, q, p, t,angle FROM xxx ") cursor = cnx.cursor(buffered=True) cursor.execute(query) num_fields = len(cursor.description) field_names = [i[0] for i in cursor.d...