GithubHelp home page GithubHelp logo

birg / pyopls Goto Github PK

View Code? Open in Web Editor NEW
56.0 4.0 16.0 1.73 MB

A Python 3 implementation of orthogonal projection to latent structures

License: MIT License

Python 100.00%
chemometrics metabolomics feature-selection orthogonal-signal-correction partial-least-squares-regression

pyopls's People

Contributors

dpfoose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pyopls's Issues

Question regarding Number of components to select

Hi I have a quick question;I will appreciate if you could explain that;
I see that in OPLS 39 components are used and in pls one component is passed in the code below;
#opls = OPLS(39)
#Z = opls.fit_transform(spectra, target)
#pls = PLSRegression(1)

Q1: What is the reason for using one component in "PLSRegression(1)" and how do you decide the number of OPLS components OPLS(39);

Q2: In Permutation test; what is this argument k=-1 referring to? and where can we access the information about what numbers of components were best for this model after doing permutation test?
#validator = OPLSValidator(k=-1).fit(X, target)

I appreciate you time and response;
Thanks
Amnah

Bug in OPLSValidator

The validator scripts are not working on any datasets, seems to be an issue with the fit method and the subsequent LabelBinarizer call. This is the error when running the example code:

TypeError                                 Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_19292/3997691689.py in <module>
     10 X = df[[c for c in df.columns if c!='classification']]
     11 
---> 12 validator = OPLSValidator(k=-1).fit(X, target)
     13 
     14 Z = validator.opls_.transform(X)

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in fit(self, X, y, n_components, cv, pos_label, random_state, n_jobs, verbose, pre_dispatch)
    452 
    453         X = check_array(X, dtype=float, copy=True)
--> 454         y = self._check_target(y, pos_label)
    455 
    456         if not n_components:

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in _check_target(self, y, pos_label)
    223                              'Try binarizing with sklearn.preprocessing.LabelBinarizer.')
    224         if self.is_discrimination(y):
--> 225             y = self._process_binary_target(y, pos_label)
    226         else:
    227             self.binarizer_ = None

C:\devel\anaconda3\lib\site-packages\pyopls\validation.py in _process_binary_target(self, y, pos_label)
    211 
    212     def _process_binary_target(self, y, pos_label=None):
--> 213         self.binarizer_ = LabelBinarizer(-1, 1)
    214         self.binarizer_.fit(y)
    215         if pos_label is not None and self.binarizer_.transform([pos_label])[0] == -1:

TypeError: __init__() takes 1 positional argument but 3 were give
```n

Mislabels in x and y axes

Hi,

The x and y axes were mislabeled in the score plot, which should be:

plt.ylabel('t_ortho')
plt.xlabel('t')

Dong

Issues in multiprocessing

Setting n_jobs in OPLSValidator.fit() does not change the number of CPUs used. I suspect this is an issue with the joblib commands but if i find a solution i will do a pull request

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.