pca

论文阅读:Face Recognition: From Traditional to Deep Learning Methods 《人脸识别综述:从传统方法到深度学习》

让人想犯罪 __ 提交于 2019-11-26 19:17:50
论文阅读: Face Recognition: From Traditional to Deep Learning Methods 《人脸识别综述:从传统方法到深度学习》 一、引言 1.探索人脸关于姿势、年龄、遮挡、光照、表情的不变性,通过特征工程人工构造feature,结合PCA、LDA、支持向量机等机器学习算法。 2.流程 人脸检测,返回人脸的bounding box 人脸对齐,用2d或3d的参考点,去对标人脸 人脸表达,embed 人脸匹配,匹配分数 二、人脸识别发展综述 1.几何特征 最早:边缘提取算子和连通域算子提取特征器官 发展:梯度图像 普氏距离分析 基于几何理论的方法在3d识别中有一定应用 [20][21] 2.整体方法 PCA [22-24] PCA的概率版变体,利用贝叶斯分析 [25]。使用两组特征脸来描述相同人和不同人之间variation PAC其他变体 kernel PCA 独立成分分析 ICA 其他见文章 PCA方法总的来说是基于整体脸,而不是局部部件,来判断输入图像是否是人脸。 PCA方法的问题在于,其投影将训练集中所有图片的variance最大化了,也就是说,最大的特征向量并不利于人脸识别,这是因为,提取到的eigenvector很有可能同一个体的variation(光照,姿势,表情带来的) LDA,即Fisher discriminant

Recovering features names of explained_variance_ratio_ in PCA with sklearn

孤街醉人 提交于 2019-11-26 18:52:55
问题 I'm trying to recover from a PCA done with scikit-learn, which features are selected as relevant . A classic example with IRIS dataset. import pandas as pd import pylab as pl from sklearn import datasets from sklearn.decomposition import PCA # load dataset iris = datasets.load_iris() df = pd.DataFrame(iris.data, columns=iris.feature_names) # normalize data df_norm = (df - df.mean()) / df.std() # PCA pca = PCA(n_components=2) pca.fit_transform(df_norm.values) print pca.explained_variance_ratio

机器学习——PCA练习

隐身守侯 提交于 2019-11-26 17:17:00
数据集 这里用到的数据集是鸢尾花数据集 题目要求 1. 导入必要的库 2. 加载sklearn库自带的鸢尾花数据集 3. 将数据集划分为样本特征和样本类型 4. 构建PCA实例,其中n_components设置为2 5. 传入数据给模型 6. 打印输出所保留的n个成分各自的方差百分比 7. 对花的颜色进行特征分组,分为:[‘navy’, ‘turquoise’, ‘darkorange’] 8. 循环打印输出结 代码如下 import matplotlib . pyplot as plt from sklearn . datasets import load_iris from sklearn . decomposition import PCA # 读取数据 data = load_iris ( ) # 分为X Y X = data . data Y = data . target # 构建PCA类的实例 pca = PCA ( n_components = 2 ) # 训练模型 model = pca . fit_transform ( X ) # 打印输出所保留的n个成分各自的方差百分比 print ( pca . explained_variance_ratio_ ) # 画图 colors = [ 'navy' , 'turquoise' , 'darkorange' ]

Selecting multiple odd or even columns/rows for dataframe

喜夏-厌秋 提交于 2019-11-26 14:34:39
Is there a way in R to select many non-consecutive i.e. odd or even rows/columns? I'm plotting the loadings for my Principal Components Analysis. I have 84 rows of data ordered like this: x_1 y_1 x_2 ..... x_42 y_42 And at the moment I am creating the dataframes for the x and y loadings figures like this: data.pc = princomp(as.matrix(data)) x.loadings <- data.frame(x=data.pc$loadings[c(1, 3, 5, 7, 9, 11, 13 ,15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41), 1]) yloadings <- data.frame(y=data.pc$loadings[c(2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42), 1

Add legend to scatter plot (PCA)

半腔热情 提交于 2019-11-26 12:32:50
I am a newbie with python and found this excellent PCA biplot suggestion ( Plot PCA loadings and loading in biplot in sklearn (like R's autoplot) ). Now I tried to add a legend to the plot for the different targets. But the command plt.legend() doesn't work. Is there an easy way to do it? As an example, the iris data with the biplot code from the link above. import numpy as np import matplotlib.pyplot as plt from sklearn import datasets from sklearn.decomposition import PCA import pandas as pd from sklearn.preprocessing import StandardScaler iris = datasets.load_iris() X = iris.data y = iris

MATLAB is running out of memory but it should not be

孤街浪徒 提交于 2019-11-26 12:29:07
问题 I\'m trying to apply PCA on my data using princomp(x), that has been standardized. The data is <16 x 1036800 double> . This runs our of memory which is too be expected except for the fact that this is a new computer, the computer holds 24GB of RAM for data mining. MATLAB even lists the 24GB available on a memory check. Is MATLAB actually running out of memory while performing a PCA or is MATLAB not using the RAM to it\'s full potential? Any information or ideas would be helpful. (I may need

Principal component analysis in Python

五迷三道 提交于 2019-11-26 11:45:32
问题 I\'d like to use principal component analysis (PCA) for dimensionality reduction. Does numpy or scipy already have it, or do I have to roll my own using numpy.linalg.eigh? I don\'t just want to use singular value decomposition (SVD) because my input data are quite high-dimensional (~460 dimensions), so I think SVD will be slower than computing the eigenvectors of the covariance matrix. I was hoping to find a premade, debugged implementation that already makes the right decisions for when to

Plotting pca biplot with ggplot2

我们两清 提交于 2019-11-26 10:24:48
问题 I wonder if it is possible to plot pca biplot results with ggplot2. Suppose if I want to display the following biplot results with ggplot2 fit <- princomp(USArrests, cor=TRUE) summary(fit) biplot(fit) Any help will be highly appreciated. Thanks 回答1: Maybe this will help-- it's adapted from code I wrote some time back. It now draws arrows as well. PCbiplot <- function(PC, x="PC1", y="PC2") { # PC being a prcomp object data <- data.frame(obsnames=row.names(PC$x), PC$x) plot <- ggplot(data, aes

Principal Component Analysis (PCA) in Python

旧巷老猫 提交于 2019-11-26 10:07:52
问题 I have a (26424 x 144) array and I want to perform PCA over it using Python. However, there is no particular place on the web that explains about how to achieve this task (There are some sites which just do PCA according to their own - there is no generalized way of doing so that I can find). Anybody with any sort of help will do great. 回答1: You can find a PCA function in the matplotlib module: import numpy as np from matplotlib.mlab import PCA data = np.array(np.random.randint(10,size=(10,3)

python自己实现PCA降维

久未见 提交于 2019-11-26 10:01:01
# -*- coding:utf-8 -*- # /usr/bin/python import numpy as np x = np.array([[1,2,3],[2,3,4],[1,2,5],[1,5,6],[2,5,7],[1,7,2],[4,1,1]]) x_mean = np.mean(x,axis=0) #取均值 x_nor = x-x_mean #计算协方差 x_cov = np.cov(x-x_mean,rowvar=0) #计算特征值和特征向量 x_cov_value,x_cov_vec = np.linalg.eig(x_cov) #指定降维数量 k=2 #按特征值由小到大排列的对应索引 x_index = np.argsort(x_cov_value) #获取由大到小的前2个 x_index_k = x_index[:-(k+1):-1] #前两个特征值对应的特征向量 x_cov_vec_k = x_cov_vec[:,x_index_k] print(x_nor.dot(x_cov_vec_k)) #特征值 #print(x_cov_value) 来源: https://blog.csdn.net/weixin_41044499/article/details/98778862