Coder Social home page Coder Social logo

jmodlis / onpls Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tomlof/onpls

0.0 1.0 0.0 27 KB

OnPLS: Orthogonal Projections to Latent Structures in Multiblock and Path Model Data Analysis

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

onpls's Introduction

OnPLS

OnPLS: Orthogonal Projections to Latent Structures in Multiblock and Path Model Data Analysis

OnPLS is a Python package for multiblock data analysis with prefiltering of unique and locally joint variation.

Installation

The reference environment for OnPLS is Ubuntu 14.04 LTS with Python 2.7.6 or Python 3.4.3 and Numpy 1.8.2.

Unless you already have Numpy installed, you need to install it:

$ sudo apt-get install python-numpy

or

$ sudo apt-get install python3-numpy

In order to run the tests, you may also need to install Nose:

$ sudo apt-get install python-nose

or

$ sudo apt-get install python3-nose

Downloading the latest development version

Clone the Github repository

$ git clone https://github.com/tomlof/OnPLS.git

Preferably, you would fork it first and clone your own repository.

Add OnPLS to your Python path:

$ export $PYTHONPATH=$PYTHONPATH:/directory/to/OnPLS

Stable reseases with setup scripts will be included in future versions.

You are now ready to use your fresh installation of OnPLS!

Quick start

A simple example of the usage:

import numpy as np
import OnPLS

np.random.seed(42)

n, p_1, p_2, p_3 = 4, 3, 4, 5
t = np.sort(np.random.randn(n, 1), axis=0)
p1 = np.sort(np.random.randn(p_1, 1), axis=0)
p2 = np.sort(np.random.randn(p_2, 1), axis=0)
p3 = np.sort(np.random.randn(p_3, 1), axis=0)
X1 = np.dot(t, p1.T) + 0.1 * np.random.randn(n, p_1)
X2 = np.dot(t, p2.T) + 0.1 * np.random.randn(n, p_2)
X3 = np.dot(t, p3.T) + 0.1 * np.random.randn(n, p_3)

# Define the connections between blocks
predComp = [[0, 1, 1], [1, 0, 1], [1, 1, 0]]
# Define the numbers of non-global components
orthComp = [1, 1, 1]

# Create the estimator
onpls = OnPLS.estimators.OnPLS(predComp, orthComp)

# Fit a model
onpls.fit([X1, X2, X3])

# Perform prediction of all matrices from all connected matrices
Xhat = onpls.predict([X1, X2, X3])

# Compute prediction score
score = onpls.score([X1, X2, X3])

cv_scores = OnPLS.resampling.cross_validation(onpls, [X1, X2, X3], cv_rounds=4)

onpls's People

Contributors

tomlof avatar

Watchers

 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.