编程实现线性判别分析,并给出西瓜数据集3.0alpha上的结果。
"""
Author: Victoria
Created on: 2017.9.15 11:45
"""
import xlrd
import numpy as np
import matplotlib.pyplot as plt
def LDA(X0, X1):
"""
Get the optimal params of LDA model given training data.
Input:
X0: np.array with shape [N1, d]
X1: np.array with shape [N2, d]
Return:
omega: np.array with shape [1, d]. Optimal params of LDA.
"""
#shape [1, d]
mean0 = np.mean(X0, axis=