semvec/pypi-packages huggingface dataset:
rePLSs 1.0.0
Residiual learning xxx
Keywords: PLS,rePLS,PCR,LR


# rePLS





## Examples 



```python

import numpy as np

from sklearn import preprocessing

from sklearn.decomposition import PCA

from sklearn.linear_model import LinearRegression

from sklearn.cross_decomposition import PLSRegression

from sklearn.preprocessing import StandardScaler

from sklearn.metrics import mean_squared_error

from sklearn.datasets import load_diabetes

from sklearn.model_selection import train_test_split

from sklearn.pipeline import Pipeline,make_pipeline

from rePLS import Residual_regression



diabetes = load_diabetes()

feature_names = diabetes.feature_names #['age', 'sex', 'bmi', 'bp', 's1', 's2', 's3', 's4', 's5', 's6']

X = diabetes.data[:,2:] # remove age and sex feature

Z = diabetes.data[:,[0,1]] # age and sex feature

y = np.array([diabetes.target]).T



X_train, X_test, y_train, y_test,Z_train,Z_test = train_test_split(

    X, y,Z, test_size=0.3, random_state=13

)



x_scaler = True

y_scaler = True

z_scaler = True







if x_scaler:

    scalerx = preprocessing.StandardScaler().fit(X_train)

    X_train = scalerx.transform(X_train)

    X_test = scalerx.transform(X_test)



if y_scaler:

    scalery = preprocessing.StandardScaler().fit(y_train)

    y_train = scalery.transform(y_train)

    y_test = scalery.transform(y_test)



if z_scaler:

    scalerz = preprocessing.StandardScaler().fit(Z_train)

    Z_train = scalerz.transform(Z_train)

    Z_test = scalerz.transform(Z_test)





n_components = 6



LR = LinearRegression()

PCR = make_pipeline(PCA(n_components=n_components), LinearRegression())

PLS = PLSRegression(n_components=n_components)





rePLS = Residual_regression(Z=Z_train,name="rePLS",n_components=n_components)

rePCR = Residual_regression(Z=Z_train,name="rePCR",n_components=n_components)

reLR = Residual_regression(Z=Z_train,name="reMLR",n_components=n_components)



pipelines = [LR,PCR,PLS,reLR,rePCR,rePLS]

pipeline_names = ["LR","PCR","PLS","reMLR","rePCR","rePLS"]

for i,pipe in enumerate(pipelines):

    pipe.fit(X_train, y_train)

for i,model in enumerate(pipelines):

    if i<3:

        print("{} Test MSE: {:.3f}".format(pipeline_names[i],mean_squared_error(y_test,model.predict(X_test))))

    else:

        print("{} Test MSE: {:.3f}".format(pipeline_names[i],mean_squared_error(y_test,model.predict(X_test,Z=Z_test))))      

```



```

LR Test MSE: 0.494

PCR Test MSE: 0.499

PLS Test MSE: 0.497

reMLR Test MSE: 0.488

rePCR Test MSE: 0.495

rePLS Test MSE: 0.492

```
rePLS1 1.0.0
Residiual learning xxx
Keywords: PLS,rePLS,PCR,LR


# rePLS





## Examples 



```python

import numpy as np

from sklearn import preprocessing

from sklearn.decomposition import PCA

from sklearn.linear_model import LinearRegression

from sklearn.cross_decomposition import PLSRegression

from sklearn.preprocessing import StandardScaler

from sklearn.metrics import mean_squared_error

from sklearn.datasets import load_diabetes

from sklearn.model_selection import train_test_split

from sklearn.pipeline import Pipeline,make_pipeline

from rePLS import Residual_regression



diabetes = load_diabetes()

feature_names = diabetes.feature_names #['age', 'sex', 'bmi', 'bp', 's1', 's2', 's3', 's4', 's5', 's6']

X = diabetes.data[:,2:] # remove age and sex feature

Z = diabetes.data[:,[0,1]] # age and sex feature

y = np.array([diabetes.target]).T



X_train, X_test, y_train, y_test,Z_train,Z_test = train_test_split(

    X, y,Z, test_size=0.3, random_state=13

)



x_scaler = True

y_scaler = True

z_scaler = True







if x_scaler:

    scalerx = preprocessing.StandardScaler().fit(X_train)

    X_train = scalerx.transform(X_train)

    X_test = scalerx.transform(X_test)



if y_scaler:

    scalery = preprocessing.StandardScaler().fit(y_train)

    y_train = scalery.transform(y_train)

    y_test = scalery.transform(y_test)



if z_scaler:

    scalerz = preprocessing.StandardScaler().fit(Z_train)

    Z_train = scalerz.transform(Z_train)

    Z_test = scalerz.transform(Z_test)





n_components = 6



LR = LinearRegression()

PCR = make_pipeline(PCA(n_components=n_components), LinearRegression())

PLS = PLSRegression(n_components=n_components)





rePLS = Residual_regression(Z=Z_train,name="rePLS",n_components=n_components)

rePCR = Residual_regression(Z=Z_train,name="rePCR",n_components=n_components)

reLR = Residual_regression(Z=Z_train,name="reMLR",n_components=n_components)



pipelines = [LR,PCR,PLS,reLR,rePCR,rePLS]

pipeline_names = ["LR","PCR","PLS","reMLR","rePCR","rePLS"]

for i,pipe in enumerate(pipelines):

    pipe.fit(X_train, y_train)

for i,model in enumerate(pipelines):

    if i<3:

        print("{} Test MSE: {:.3f}".format(pipeline_names[i],mean_squared_error(y_test,model.predict(X_test))))

    else:

        print("{} Test MSE: {:.3f}".format(pipeline_names[i],mean_squared_error(y_test,model.predict(X_test,Z=Z_test))))      

```



```

LR Test MSE: 0.494

PCR Test MSE: 0.499

PLS Test MSE: 0.497

reMLR Test MSE: 0.488

rePCR Test MSE: 0.495

rePLS Test MSE: 0.492

```
rolab-tb 0.0.6.4
Lightweight ROS-less API for Turtlebots, over a websocket bridge
Requires Python: >=3.6

<!--
SPDX-FileCopyrightText: 2022 Senne Van Baelen

SPDX-License-Identifier: Apache-2.0
-->

# Rolab Turtlebot API

## API docs

&rarr; 
[https://fet-edu-em.pages.gitlab.kuleuven.be/ecs/rolab-tb](https://fet-edu-em.pages.gitlab.kuleuven.be/ecs/rolab-tb)