数据特征选择与降维技术详解
1. 特征选择技术概述
在处理高维数据时,特征选择技术至关重要,它能帮助我们保留数据中的关键信息,同时减少冗余特征,降低计算复杂度。以下介绍几种常见的特征选择技术。
2. 高斯分布可视化与距离计算
首先是用于可视化高斯分布的函数 plotGaussian
和计算数据点间距离的函数 computeDistance
。
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
import itertools
def plotGaussian(points, idx):
# points[idx] is the datapoint itself, which is 0.
axis = np.sort(points)
std = np.std(points) # In the t-SNE implementation, this would also be controlled by PERPLEXITY
plt.plot(axis, norm.pdf(axis, points[idx] , std), color='tab:grey') # 0 refers to the center, which is the data point itself
plt.scatter(points[idx], 0, c='tab:orange')
plt.scatter(po