Skip to content

Latest commit

 

History

History
53 lines (39 loc) · 2.11 KB

README.md

File metadata and controls

53 lines (39 loc) · 2.11 KB
  • Principal Component Analysis (PCA)

Implementation of PCA with python from scratch, An Example by Principal Component Analysis

#en

Implementation of Principal Component Analysis

Requirements:

Install the numpy, matplotlib and itemgetter

List of data [(1, 2, 11), (3, 0, 5), (6, 1, 9), (4, 2, 1), (10, 3, 6)]

  1. Set Data
  2. Centering the data
  3. Subtract the mean of each variable
  4. Calculate the Covariance Matrix
  5. Compute the Eigenvalues and Eigenvectors
  6. Sort Eigenvalues in descending order
  7. Select a subset from the rearranged Eigenvalue matrix
  8. Transform the data
  9. View The Results
  10. Plot the points

#fa

پیاده سازی pca با استفاده از کتابخانه numpy در پایتون

نیازمندی ها برای پیاده سازی:

نصب کتابخانه های numpy، matplotlib و itemgetter

لیست داده ها شامل [(1, 2, 11), (3, 0, 5), (6, 1, 9), (4, 2, 1), (10, 3, 6)] است و باید به بعد 2 کاهش داده شود.

  1. ست کردن داده ها
  2. بدست آوردن مراکز داده ها
  3. بدست آوردن میانه و کم کردن مقادیر از میانه
  4. بدست آوردن ماترین کواریانس
  5. بدست آوردن مقادیر ویژه و بردارهای ویژه
  6. مرتب سازی مقادیر ویژه و بردارهای ویژه
  7. انتخاب یک زیرمجموعه از ماتریس مقادیر ویژه
  8. ترانهاده (تبدیل) کردن داده ها
  9. مشاهده نتیجه ی کد اجرا شده
  10. رسم نقاط در محور x, y

Reference:

  1. https://www.askpython.com/python/examples/principal-component-analysis
  2. https://www.geeksforgeeks.org/principal-component-analysis-with-python/
  3. https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.PCA.html
  4. https://towardsdatascience.com/pca-using-python-scikit-learn-e653f8989e60
  5. https://scikit-learn.org/stable/auto_examples/decomposition/plot_pca_iris.html
  6. https://chistio.ir/%D8%A2%D9%86%D8%A7%D9%84%DB%8C%D8%B2-%D9%85%D9%88%D9%84%D9%81%D9%87-%D8%A7%D8%B5%D9%84%DB%8C-principal-component-analysis-pca-%DA%86%DB%8C%D8%B3%D8%AA%D8%9F/