Skip to content

Commit 4ef5e44

Browse files
committed
DOC: Updated readme file.
1 parent 133a276 commit 4ef5e44

File tree

2 files changed

+87
-2
lines changed

2 files changed

+87
-2
lines changed

OnPLS/estimators.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ class OnPLS(BaseEstimator):
748748
... numReps=1, verbose=1)
749749
>>> _ = onpls.fit([X1, X2, X3])
750750
"""
751-
def __init__(self, predComp, orthComp, model,
751+
def __init__(self, predComp, orthComp, model=None,
752752
precomputedW=None, numReps=1, verbose=2,
753753
eps=consts.TOLERANCE, max_iter=consts.MAX_ITER):
754754

README.md

+86-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,87 @@
1-
# OnPLS
1+
OnPLS
2+
=====
3+
24
OnPLS: Orthogonal Projections to Latent Structures in Multiblock and Path Model Data Analysis
5+
6+
OnPLS is a Python package for multiblock data analysis with prefiltering of unique and locally joint variation.
7+
8+
9+
Installation
10+
------------
11+
12+
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.
13+
14+
Unless you already have Numpy installed, you need to install it:
15+
```
16+
$ sudo apt-get install python-numpy
17+
```
18+
or
19+
```
20+
$ sudo apt-get install python3-numpy
21+
```
22+
23+
In order to run the tests, you may also need to install Nose:
24+
```
25+
$ sudo apt-get install python-nose
26+
```
27+
or
28+
```
29+
$ sudo apt-get install python3-nose
30+
```
31+
32+
**Downloading the latest development version**
33+
34+
Clone the Github repository
35+
36+
```
37+
$ git clone https://github.com/tomlof/OnPLS.git
38+
```
39+
Preferably, you would fork it first and clone your own repository.
40+
41+
Add OnPLS to your Python path:
42+
```
43+
$ export $PYTHONPATH=$PYTHONPATH:/directory/to/OnPLS
44+
```
45+
46+
Stable reseases with setup scripts will be included in future versions.
47+
48+
You are now ready to use your fresh installation of OnPLS!
49+
50+
51+
Quick start
52+
-----------
53+
54+
A simple example of the usage:
55+
56+
```python
57+
import numpy as np
58+
import OnPLS
59+
60+
np.random.seed(42)
61+
62+
n, p_1, p_2, p_3 = 4, 3, 4, 5
63+
t = np.sort(np.random.randn(n, 1), axis=0)
64+
p1 = np.sort(np.random.randn(p_1, 1), axis=0)
65+
p2 = np.sort(np.random.randn(p_2, 1), axis=0)
66+
p3 = np.sort(np.random.randn(p_3, 1), axis=0)
67+
X1 = np.dot(t, p1.T) + 0.1 * np.random.randn(n, p_1)
68+
X2 = np.dot(t, p2.T) + 0.1 * np.random.randn(n, p_2)
69+
X3 = np.dot(t, p3.T) + 0.1 * np.random.randn(n, p_3)
70+
71+
# Define the connections between blocks
72+
predComp = [[0, 1, 1], [1, 0, 1], [1, 1, 0]]
73+
# Define the numbers of non-global components
74+
orthComp = [1, 1, 1]
75+
76+
# Create the estimator
77+
onpls = OnPLS.estimators.OnPLS(predComp, orthComp)
78+
79+
# Fit a model
80+
onpls.fit([X1, X2, X3])
81+
82+
# Perform prediction of all matrices from all connected matrices
83+
Xhat = onpls.predict([X1, X2, X3])
84+
85+
# Compute prediction score
86+
score = onpls.score([X1, X2, X3])
87+
```

0 commit comments

Comments
 (0)