Giter Site home page Giter Site logo

factor_analysis's Introduction

Factor_analysis_pkg

This is the python package performing factor analysis with Expectation Maximization method.

This package is only tested in Linux environment and with Python 3.6.5

To download the package wheel, download Factor_analysis_pkg_0.0.1-py3-none-any.whl under dist directory in this git page (or click the link)

Assuming you have activated an isolated environment (like virtualenv), run:

pip install Factor_analysis_pkg_0.0.1-py3-none-any.whl

To use the factor analysis function, prompt python terminal (or ipython) and type,

from Factor_analysis_pkg import factor_analysis

factor_analysis function is described below:

factor_analysis

  • Input

    • x: A float numpy array. This is the observed variables for each data points
    • nFactors: Integer. Number of latent variables to be considered
  • Output

    • W: A float numpy array. A factor loading matrix
    • z: A float numpy array. A latent variable matrix
    • log_history: A list. A record of log likelihood over iterations

Note that the output z is mostly the main concern as the factor analysis is often used for feature dimensionality reduction

The package also includes an illustrative example of factor analysis using IRIS dataset for feature dimensionality reduction:

from Factor_analysis_pkg import example
example.run_demo()

It will print out the following statements on the terminal:

play with iris data
Assume 2 latent variables
Assume 3 latent variables

For 2 latent variable case, it will produce a 2D scatter plot and a log likelihood over iterations

For 3 latent variable case, it will produce a 3D scatter plot and a log likelihood over iterations

In total, you get 4 plots

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.