Iris資料集用主成分分析MATLAB
1、程式碼
filename = 'iris.csv';
data = csvread(filename);
rawdata = data(:,2:5)
a = data(data(:,1)==0,:);
a = a(:,2:5);
b = data(data(:,1)==1,:);
b = b(:,2:5);
c = data(data(:,1)==2,:);
c = c(:,2:5);
[coefs,scores,variances,t2] = princomp(rawdata);
a=a*coefs(:,1:2);
b=b*coefs(:,1:2);
c=c*coefs(:,1:2);
plot (a(:,1),a(:,2),'r.','markersize',20);
hold on
plot(b(:,1),b(:,2),'g.','markersize',20);
hold on
plot(c(:,1),c(:,2),'b.','markersize',20);
hold off
xlabel('1st Principal Component');
ylabel('2nd Principal Component');
2、結果
相關推薦
Iris資料集用主成分分析MATLAB
1、程式碼 filename = 'iris.csv'; data = csvread(filename); rawdata = data(:,2:5) a = data(data(:,1)==0,:); a = a(:,2:5); b = data(data(
用主成分分析(PCA)演算法做人臉識別
詳細資料可以參考https://www.cnblogs.com/xingshansi/p/6445625.html一、概念主成分分析(PCA)是一種統計方法。通過正交變換將一組可能存在相關性的變數轉化為一組線性不相關的變數,轉換後的這組變數叫主成分。二、思想PCA的思想是將n
資料探勘學習------------------1-資料準備-4-主成分分析(PCA)降維和相關係數降維
1.4資料降維 在分析多個變數時發現它們中有一定的相關性。有一種方法將多個變數綜合成少數幾個相互無關的代表性變數來代替原來的變數,這就是資料降維,可以考慮主成分分析法。 1)、主成分分析法(PCA) 1、基本思想 (1)如果將選取的第一個線性組合即第一個綜合變數記為F
【機器學習】資料降維—主成分分析(PCA)
本文程式碼推薦使用Jupyter notebook跑,這樣得到的結果更為直觀。 主成分分析(PCA) 特徵抽取通常用於提高計算效率,降低維度災難。 主成分分析(Principe component analysis,PCA): 是一種廣泛應用於不同領域的無監督
人臉識別中用主成分分析PCA來將資料降維--MATLAB程式碼
人臉識別的資料集,維度一般都比較高,在自己的電腦上跑這麼高維的資料集,很多個人計算機需要跑很長時間,因此一般都需要改變影象大小或者是降維。 常用的方式有以下幾種,最普通的是改變影象的大小,是用的MATLAB自帶的imresize函式來直接改變影象的大小,如何使用請自行查詢。其次就是降維,基本的降
主成分分析降維(MNIST資料集)
今天看了用主成分分析簡化資料,就順便用MNIST資料集做了下實驗,想直觀地看一下效果,並通過完成這個小demo深入理解下原理。 我發現“是什麼、能做什麼、怎麼用、效果是什麼、原理是什麼、優缺點是什麼”這樣的思路能讓我更好地接受一個新知識,之所以把原理放在效果後
PCA (主成分分析)詳解 (寫給初學者) 結合matlab(轉載)
整數 變量 行為 保持 sum osc 入參 函數 data 一、簡介 PCA(Principal Components Analysis)即主成分分析,是圖像處理中經常用到的降維方法,大家知道,我們在處理有關數字圖像處理方面的問題時,比如經常用的圖像的查詢
【原始碼】主成分分析(PCA)與獨立分量分析(ICA)MATLAB工具箱
本MATLAB工具箱包含PCA和ICA實現的多個函式,並且包括多個演示示例。 在主成分分析中,多維資料被投影到最大奇異值相對應的奇異向量上,該操作有效地將輸入訊號分解成在資料中最大方差方向上的正交分量。因此,PCA常用於維數降低的應用中,通過執行PCA產生資料的低維表示,同時,該低維表
Spark ML 基於Iris資料集進行資料建模及迴歸聚類綜合分析-Spark商業ML實戰
本套技術專欄是作者(秦凱新)平時工作的總結和昇華,通過從真實商業環境抽取案例進行總結和分享,並給出商業應用的調優建議和叢集環境容量規劃等內容,請持續關注本套部落格。版權宣告:禁止轉載,歡迎學習。QQ郵箱地址:[email protected],如有任何商業交流,可隨時聯絡。
用Iris資料集的屬性畫圖
1、Iris資料集 這個資料集很有名,很多實驗都用它來做,這裡我用的資料集,第一列為0、1、2代表label,後面四列是不同的資料,為了方便,將後面的屬性都擴大十倍,變為整數。 2、MATLAB程式碼 以下使用第二、三列屬性,畫了一個二維的影象 filename
Python資料分析--Iris資料集實戰
本次主要圍繞Iris資料集進行一個簡單的資料分析, 另外在資料的視覺化部分進行了重點介紹. 環境 win8, python3.7, jupyter notebook 正文 1. 專案背景 鳶尾屬(拉丁學名:Iris L.), 單子葉植物綱, 鳶尾科多年生草本植物, 開的花大而美麗, 觀賞價值很高. 鳶尾屬約3
Python資料分析學習筆記(6)資料規約實戰--以主成分分析PCA為例
一、相關理論: 1、資料規約:產生更小且保持資料完整性的新資料集。意義在於降低無效、錯誤資料;降低儲存成本;少量且具有代表性的資料大幅加快,主要分為以下兩類: ①屬性規約:屬性合併或刪除無關維,目標是尋找最小子集使子集概率分佈儘可能與原來相同。 常用方法: (
python資料探勘入門與實踐----------特徵值,主成分分析
#http://archive.ics.uci.edu/ml/machine-learning-databases/adult/ import os import pandas as pd adult_filename ="adult.data" adult = pd.read_csv(adu
PCA主成分分析之三維演示(Matlab)
PCA主成分分析之三維演示(Matlab) 寫這個的主要原因是實驗課上的要求,原本需要寫一個演示 PCA 原理的 demo ,按照實驗指導書上來說,在二維上演示就好了,但是為了折騰和無聊裝逼,我寫了這個程式,我覺得更能直觀的看出 PCA 的原理。可以完整的看到資料從三維降到二維
資料降維(三)PCA主成分分析
文章目錄 PCA主成分分析 目標函式1:最小化重建誤差 目標函式2:最大化方差 PCA目標函式計算 求解PCA(1) 表現 求解PCA(2) PCA總結 PCA主成分分析 目標
精通Excel資料統計與分析 - 摘要 (第11章:主成分分析和因子分析)
一、簡介 11.1主成分分析 主成分分析,是將多個變數通過線性變換以選出較少個數重要變數的一種多元統計分析方法,又稱主分量分析; 主成分分析是在減少分析變數個數的同時,保留較多的原始資訊; 可以理解為減少一個矩陣的行; 11.2因子分析
使用主成分分析(PCA)方法對資料進行降維
我們知道當資料維度太大時,進行分類任務時會花費大量時間,因此需要進行資料降維,其中一種非常流行的降維方法叫主成分分析。 Exploratory Data Analysis 鳶尾花資料集: import numpy as np from skle
Pandas之iris資料集簡單分析
匯出iris資料集 from sklearn import datasets import pandas as np iris_datas = datasets.load_iris() ir
資料探勘-Iris資料集分析-決策邊界_根據花瓣資料繪製(七)
# coding: utf-8 # 使用花瓣測量資料繪製 2D散點圖,並繪出決策邊界 import numpy as np import matplotlib.pyplot as plt from
資料分析學習體驗——特徵變數相關係數和主成分分析
如何處理資料集中高度相關的特徵變數 作者: 江俊 時間: “2018/03/25” 以下所有程式碼均使用R語言 資料集下載地址:https://download.csdn.net/download/smallernovice/10307411