Code Monkey home page Code Monkey logo

pca2dim's Introduction

pca2dim

This is a port of a matlab program that does PCA on 2 dimension data (age/height data for young males). It is intended only to show how matlab code might be ported to Python using matplotlib and numpy packages.

How to run the example

If necessary, install required libraries using pip:

pip3 install matplotlib
pip3 install numpy

You can figure out if you actually need to do the above by trying to load them in the Python REPL:

$ python3
Python 3.8.5 (default, Jan 27 2021, 15:41:15) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> import numpy
>>> 

Next, git clone this repo:

$ git clone https://github.com/slogan621/pca2dim.git
Cloning into 'pca2dim'...
$

Then run:

$ cd pca2dim
$ python3 pca_2dim.py 
Matrix of Covariance
[[2.92453364 0.18682262]
 [0.18682262 0.01390859]]
Major Principal Component
[-0.99796309 -0.06379393]
End of the program

Several figures should display.

Bugs

Create an issue if you run into any problems. If you have improvements, I'll gladly respond to pull requests.

pca2dim's People

Contributors

slogan621 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.