skada


Nameskada JSON
Version 0.3.0 PyPI version JSON
download
home_pageNone
SummaryA Python package for domain adaptation compatible with scikit-learn and Pytorch.
upload_time2024-07-05 12:40:27
maintainerNone
docs_urlNone
authorSKADA Team
requires_pythonNone
licenseBSD 3-Clause License Copyright (c) 2023 The SKADA developers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords domain-adaptation scikit-learn pytorch machine learning deep learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SKADA - Domain Adaptation with scikit-learn and PyTorch

[![PyPI version](https://badge.fury.io/py/skada.svg)](https://badge.fury.io/py/skada)
[![Build Status](https://github.com/scikit-adaptation/skada/actions/workflows/testing.yml/badge.svg)](https://github.com/scikit-adaptation/skada/actions)
[![Codecov Status](https://codecov.io/gh/scikit-adaptation/skada/branch/main/graph/badge.svg)](https://codecov.io/gh/scikit-adaptation/skada)
[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)

> [!WARNING]
> This library is currently in a phase of active development. All features are subject to change without prior notice. If you are interested in collaborating, please feel free to reach out by opening an issue or starting a discussion.

SKADA is a library for domain adaptation (DA) with a scikit-learn and PyTorch/skorch
compatible API with the following features:

- DA estimators and transformers with a scikit-learn compatible API (fit, transform, predict).
- PyTorch/skorch API for deep learning DA algorithms.
- Classifier/Regressor and data Adapter DA algorithms compatible with scikit-learn pipelines.
- Compatible with scikit-learn validation loops (cross_val_score, GridSearchCV, etc).

**Citation**: If you use this library in your research, please cite the following reference:

```
Gnassounou T., Kachaiev O., Flamary R., Collas A., Lalou Y., de Mathelin A., Gramfort A., Bueno R., Michel F., Mellot A.,  Loison V., Odonnat A., Moreau T. (2024). SKADA : Scikit Adaptation (version 0.3.0). URL: https://scikit-adaptation.github.io/
```

or in Bibtex format :

```bibtex
@misc{gnassounou2024skada,
author = {Gnassounou, Théo and Kachaiev, Oleksii and Flamary, Rémi and Collas, Antoine and Lalou, Yanis and de Mathelin, Antoine and Gramfort, Alexandre and Bueno, Ruben and Michel, Florent and Mellot, Apolline and  Loison, Virginie and Odonnat, Ambroise and Moreau, Thomas},
month = {7},
title = {SKADA : Scikit Adaptation},
url = {https://scikit-adaptation.github.io/},
year = {2024}
}
```


## Implemented algorithms

The following algorithms are currently implemented.

### Domain adaptation algorithms

- Sample reweighting methods (Gaussian [1], Discriminant [2], KLIEPReweight [3],
  DensityRatio [4], TarS [21], KMMReweight [23])
- Sample mapping methods (CORAL [5], Optimal Transport DA OTDA [6], LinearMonge [7], LS-ConS [21])
- Subspace methods (SubspaceAlignment [8], TCA [9], Transfer Subspace Learning [27])
- Other methods (JDOT [10], DASVM [11], OT Label Propagation [28])

Any methods that can be cast as an adaptation of the input data can be used in one of two ways:
- a scikit-learn transformer (Adapter) which provides both a full Classifier/Regressor estimator
 - or an `Adapter` that can be used in a DA pipeline with `make_da_pipeline`. 
 Refer to the examples below and visit [the gallery](https://scikit-adaptation.github.io/auto_examples/index.html)for more details.

### Deep learning domain adaptation algorithms

- Deep Correlation alignment (DeepCORAL [12])
- Deep joint distribution optimal (DeepJDOT [13])
- Divergence minimization (MMD/DAN [14])
- Adversarial/discriminator based DA (DANN [15], CDAN [16])

### DA metrics

- Importance Weighted [17]
- Prediction entropy [18]
- Soft neighborhood density [19]
- Deep Embedded Validation (DEV) [20]
- Circular Validation [11]


## Installation

The library is not yet available on PyPI. You can install it from the source code.
```python
pip install git+https://github.com/scikit-adaptation/skada
```

## Short examples

We provide here a few examples to illustrate the use of the library. For more
details, please refer to this [example](https://scikit-adaptation.github.io/auto_examples/plot_how_to_use_skada.html), the [quick start guide](https://scikit-adaptation.github.io/quickstart.html) and the [gallery](https://scikit-adaptation.github.io/auto_examples/index.html).

First, the DA data in the SKADA API is stored in the following format:

```python
X, y, sample_domain 
```

Where `X` is the input data, `y` is the target labels and `sample_domain` is the
domain labels (positive for source and negative for target domains). We provide
below an example ho how to fit a DA estimator:

```python
from skada import CORAL

da = CORAL()
da.fit(X, y, sample_domain=sample_domain) # sample_domain passed by name

ypred = da.predict(Xt) # predict on test data
```

One can also use `Adapter` classes to create a full pipeline with DA:

```python
from skada import CORALAdapter, make_da_pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

pipe = make_da_pipeline(StandardScaler(), CORALAdapter(), LogisticRegression())

pipe.fit(X, y, sample_domain=sample_domain) # sample_domain passed by name
```

Please note that for `Adapter` classes that implement sample reweighting, the 
subsequent classifier/regressor must require sample_weights as input. This is
done with the `set_fit_requires` method. For instance, with `LogisticRegression`, you
would use `LogisticRegression().set_fit_requires('sample_weight')`:

```python
from skada import GaussianReweightAdapter, make_da_pipeline
pipe = make_da_pipeline(GaussianReweightAdapter(),
                        LogisticRegression().set_fit_request(sample_weight=True))
```

Finally SKADA can be used for cross validation scores estimation and hyperparameter
selection :

```python
from sklearn.model_selection import cross_val_score, GridSearchCV
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression

from skada import CORALAdapter, make_da_pipeline
from skada.model_selection import SourceTargetShuffleSplit
from skada.metrics import PredictionEntropyScorer

# make pipeline
pipe = make_da_pipeline(StandardScaler(), CORALAdapter(), LogisticRegression())

# split and score
cv = SourceTargetShuffleSplit()
scorer = PredictionEntropyScorer()

# cross val score
scores = cross_val_score(pipe, X, y, params={'sample_domain': sample_domain}, 
                         cv=cv, scoring=scorer)

# grid search
param_grid = {'coraladapter__reg': [0.1, 0.5, 0.9]}
grid_search = GridSearchCV(estimator=pipe,
                           param_grid=param_grid,
                           cv=cv, scoring=scorer)

grid_search.fit(X, y, sample_domain=sample_domain)
```

## Acknowledgements

This toolbox has been created and is maintained by the SKADA team that includes the following members:

* [Théo Gnassounou](https://tgnassou.github.io/)
* [Oleksii Kachaiev](https://kachayev.github.io/talks/)
* [Rémi Flamary](https://remi.flamary.com/)
* [Antoine Collas](https://www.antoinecollas.fr/)
* [Yanis Lalou](https://github.com/YanisLalou)
* [Antoine de Mathelin](https://scholar.google.com/citations?user=h79bffAAAAAJ&hl=fr)
* [Ruben Bueno]()

## License

The library is distributed under the 3-Clause BSD license.

## References

[1] Shimodaira Hidetoshi. ["Improving predictive inference under covariate shift by weighting the log-likelihood function."](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=235723a15c86c369c99a42e7b666dfe156ad2cba) Journal of statistical planning and inference 90, no. 2 (2000): 227-244.

[2] Sugiyama Masashi, Taiji Suzuki, and Takafumi Kanamori. ["Density-ratio matching under the Bregman divergence: a unified framework of density-ratio estimation."](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=f1467208a75def8b2e52a447ab83644db66445ea) Annals of the Institute of Statistical Mathematics 64 (2012): 1009-1044.

[3] Sugiyama Masashi, Taiji Suzuki, Shinichi Nakajima, Hisashi Kashima, Paul Von Bünau, and Motoaki Kawanabe. ["Direct importance estimation for covariate shift adaptation."](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=af14e09a9f829b9f0952eac244b0ac0c8bda2ca8) Annals of the Institute of Statistical Mathematics 60 (2008): 699-746.

[4] Sugiyama Masashi, and Klaus-Robert Müller. ["Input-dependent estimation of generalization error under covariate shift."](https://web.archive.org/web/20070221112234id_/http://sugiyama-www.cs.titech.ac.jp:80/~sugi/2005/IWSIC.pdf) (2005): 249-279.

[5] Sun Baochen, Jiashi Feng, and Kate Saenko. ["Correlation alignment for unsupervised domain adaptation."](https://arxiv.org/pdf/1612.01939.pdf) Domain adaptation in computer vision applications (2017): 153-171.

[6] Courty Nicolas, Flamary Rémi, Tuia Devis, and Alain Rakotomamonjy. ["Optimal transport for domain adaptation."](https://arxiv.org/pdf/1507.00504.pdf) IEEE Trans. Pattern Anal. Mach. Intell 1, no. 1-40 (2016): 2.

[7] Flamary, R., Lounici, K., & Ferrari, A. (2019). [Concentration bounds for linear monge mapping estimation and optimal transport domain adaptation](https://arxiv.org/pdf/1905.10155.pdf). arXiv preprint arXiv:1905.10155.

[8] Fernando, B., Habrard, A., Sebban, M., & Tuytelaars, T. (2013). [Unsupervised visual domain adaptation using subspace alignment](https://openaccess.thecvf.com/content_iccv_2013/papers/Fernando_Unsupervised_Visual_Domain_2013_ICCV_paper.pdf). In Proceedings of the IEEE international conference on computer vision (pp. 2960-2967).

[9] Pan, S. J., Tsang, I. W., Kwok, J. T., & Yang, Q. (2010). [Domain adaptation via transfer component analysis](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=4823e52161ec339d4d3526099a5477321f6a9a0f). IEEE transactions on neural networks, 22(2), 199-210.

[10] Courty, N., Flamary, R., Habrard, A., & Rakotomamonjy, A. (2017). [Joint distribution optimal transportation for domain adaptation](https://proceedings.neurips.cc/paper_files/paper/2017/file/0070d23b06b1486a538c0eaa45dd167a-Paper.pdf). Advances in neural information processing systems, 30.

[11] Bruzzone, L., & Marconcini, M. (2009). [Domain adaptation problems: A DASVM classification technique and a circular validation strategy.](https://rslab.disi.unitn.it/papers/R82-PAMI.pdf) IEEE transactions on pattern analysis and machine intelligence, 32(5), 770-787.

[12] Sun, B., & Saenko, K. (2016). [Deep coral: Correlation alignment for deep domain adaptation](https://arxiv.org/pdf/1607.01719.pdf). In Computer Vision–ECCV 2016 Workshops: Amsterdam, The Netherlands, October 8-10 and 15-16, 2016, Proceedings, Part III 14 (pp. 443-450). Springer International Publishing.

[13] Damodaran, B. B., Kellenberger, B., Flamary, R., Tuia, D., & Courty, N. (2018). [Deepjdot: Deep joint distribution optimal transport for unsupervised domain adaptation](https://openaccess.thecvf.com/content_ECCV_2018/papers/Bharath_Bhushan_Damodaran_DeepJDOT_Deep_Joint_ECCV_2018_paper.pdf). In Proceedings of the European conference on computer vision (ECCV) (pp. 447-463).

[14] Long, M., Cao, Y., Wang, J., & Jordan, M. (2015, June). [Learning transferable features with deep adaptation networks](https://proceedings.mlr.press/v37/long15.pdf). In International conference on machine learning (pp. 97-105). PMLR.

[15] Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Laviolette, F., ... & Lempitsky, V. (2016). [Domain-adversarial training of neural networks](https://www.jmlr.org/papers/volume17/15-239/15-239.pdf). Journal of machine learning research, 17(59), 1-35.

[16] Long, M., Cao, Z., Wang, J., & Jordan, M. I. (2018). [Conditional adversarial domain adaptation](https://proceedings.neurips.cc/paper_files/paper/2018/file/ab88b15733f543179858600245108dd8-Paper.pdf). Advances in neural information processing systems, 31.

[17] Sugiyama, M., Krauledat, M., & Müller, K. R. (2007). [Covariate shift adaptation by importance weighted cross validation](https://www.jmlr.org/papers/volume8/sugiyama07a/sugiyama07a.pdf). Journal of Machine Learning Research, 8(5).

[18] Morerio, P., Cavazza, J., & Murino, V. (2017).[ Minimal-entropy correlation alignment for unsupervised deep domain adaptation](https://arxiv.org/pdf/1711.10288.pdf). arXiv preprint arXiv:1711.10288.

[19] Saito, K., Kim, D., Teterwak, P., Sclaroff, S., Darrell, T., & Saenko, K. (2021). [Tune it the right way: Unsupervised validation of domain adaptation via soft neighborhood density](https://openaccess.thecvf.com/content/ICCV2021/papers/Saito_Tune_It_the_Right_Way_Unsupervised_Validation_of_Domain_Adaptation_ICCV_2021_paper.pdf). In Proceedings of the IEEE/CVF International Conference on Computer Vision (pp. 9184-9193).

[20] You, K., Wang, X., Long, M., & Jordan, M. (2019, May). [Towards accurate model selection in deep unsupervised domain adaptation](https://proceedings.mlr.press/v97/you19a/you19a.pdf). In International Conference on Machine Learning (pp. 7124-7133). PMLR.

[21] Zhang, K., Schölkopf, B., Muandet, K., Wang, Z. (2013). [Domain Adaptation under Target and Conditional Shift](http://proceedings.mlr.press/v28/zhang13d.pdf). In International Conference on Machine Learning (pp. 819-827). PMLR.

[22] Loog, M. (2012). Nearest neighbor-based importance weighting. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pages 1–6. IEEE (https://arxiv.org/pdf/2102.02291.pdf)

[23] Domain Adaptation Problems: A DASVM ClassificationTechnique and a Circular Validation StrategyLorenzo Bruzzone, Fellow, IEEE, and Mattia Marconcini, Member, IEEE (https://rslab.disi.unitn.it/papers/R82-PAMI.pdf)

[24] Loog, M. (2012). Nearest neighbor-based importance weighting. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pages 1–6. IEEE (https://arxiv.org/pdf/2102.02291.pdf)

[25] J. Huang, A. Gretton, K. Borgwardt, B. Schölkopf and A. J. Smola. Correcting sample selection bias by unlabeled data. In NIPS, 2007. (https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=07117994f0971b2fc2df95adb373c31c3d313442)

[26] Long, M., Wang, J., Ding, G., Sun, J., and Yu, P. (2014). [Transfer joint matching for unsupervised domain adaptation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1410–1417](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=a279f53f386ac78345b67e13c1808880c718efdf)

[27] S. Si, D. Tao and B. Geng. In IEEE Transactions on Knowledge and Data Engineering, (2010) [Bregman Divergence-Based Regularization for Transfer Subspace Learning](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=4118b4fc7d61068b9b448fd499876d139baeec81)

[28] Solomon, J., Rustamov, R., Guibas, L., & Butscher, A. (2014, January). [Wasserstein propagation for semi-supervised learning](https://proceedings.mlr.press/v32/solomon14.pdf). In International Conference on Machine Learning (pp. 306-314). PMLR.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "skada",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "domain-adaptation, scikit-learn, pytorch, machine learning, deep learning",
    "author": "SKADA Team",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7d/9c/3ecff1914b34714c6630591606f89a46da4374240af16766f1d43cf1d6d8/skada-0.3.0.tar.gz",
    "platform": null,
    "description": "# SKADA - Domain Adaptation with scikit-learn and PyTorch\n\n[![PyPI version](https://badge.fury.io/py/skada.svg)](https://badge.fury.io/py/skada)\n[![Build Status](https://github.com/scikit-adaptation/skada/actions/workflows/testing.yml/badge.svg)](https://github.com/scikit-adaptation/skada/actions)\n[![Codecov Status](https://codecov.io/gh/scikit-adaptation/skada/branch/main/graph/badge.svg)](https://codecov.io/gh/scikit-adaptation/skada)\n[![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause)\n\n> [!WARNING]\n> This library is currently in a phase of active development. All features are subject to change without prior notice. If you are interested in collaborating, please feel free to reach out by opening an issue or starting a discussion.\n\nSKADA is a library for domain adaptation (DA) with a scikit-learn and PyTorch/skorch\ncompatible API with the following features:\n\n- DA estimators and transformers with a scikit-learn compatible API (fit, transform, predict).\n- PyTorch/skorch API for deep learning DA algorithms.\n- Classifier/Regressor and data Adapter DA algorithms compatible with scikit-learn pipelines.\n- Compatible with scikit-learn validation loops (cross_val_score, GridSearchCV, etc).\n\n**Citation**: If you use this library in your research, please cite the following reference:\n\n```\nGnassounou T., Kachaiev O., Flamary R., Collas A., Lalou Y., de Mathelin A., Gramfort A., Bueno R., Michel F., Mellot A.,  Loison V., Odonnat A., Moreau T. (2024). SKADA : Scikit Adaptation (version 0.3.0). URL: https://scikit-adaptation.github.io/\n```\n\nor in Bibtex format :\n\n```bibtex\n@misc{gnassounou2024skada,\nauthor = {Gnassounou, Th\u00e9o and Kachaiev, Oleksii and Flamary, R\u00e9mi and Collas, Antoine and Lalou, Yanis and de Mathelin, Antoine and Gramfort, Alexandre and Bueno, Ruben and Michel, Florent and Mellot, Apolline and  Loison, Virginie and Odonnat, Ambroise and Moreau, Thomas},\nmonth = {7},\ntitle = {SKADA : Scikit Adaptation},\nurl = {https://scikit-adaptation.github.io/},\nyear = {2024}\n}\n```\n\n\n## Implemented algorithms\n\nThe following algorithms are currently implemented.\n\n### Domain adaptation algorithms\n\n- Sample reweighting methods (Gaussian [1], Discriminant [2], KLIEPReweight [3],\n  DensityRatio [4], TarS [21], KMMReweight [23])\n- Sample mapping methods (CORAL [5], Optimal Transport DA OTDA [6], LinearMonge [7], LS-ConS [21])\n- Subspace methods (SubspaceAlignment [8], TCA [9], Transfer Subspace Learning [27])\n- Other methods (JDOT [10], DASVM [11], OT Label Propagation [28])\n\nAny methods that can be cast as an adaptation of the input data can be used in one of two ways:\n- a scikit-learn transformer (Adapter) which provides both a full Classifier/Regressor estimator\n - or an `Adapter` that can be used in a DA pipeline with `make_da_pipeline`. \n Refer to the examples below and visit [the gallery](https://scikit-adaptation.github.io/auto_examples/index.html)for more details.\n\n### Deep learning domain adaptation algorithms\n\n- Deep Correlation alignment (DeepCORAL [12])\n- Deep joint distribution optimal (DeepJDOT [13])\n- Divergence minimization (MMD/DAN [14])\n- Adversarial/discriminator based DA (DANN [15], CDAN [16])\n\n### DA metrics\n\n- Importance Weighted [17]\n- Prediction entropy [18]\n- Soft neighborhood density [19]\n- Deep Embedded Validation (DEV) [20]\n- Circular Validation [11]\n\n\n## Installation\n\nThe library is not yet available on PyPI. You can install it from the source code.\n```python\npip install git+https://github.com/scikit-adaptation/skada\n```\n\n## Short examples\n\nWe provide here a few examples to illustrate the use of the library. For more\ndetails, please refer to this [example](https://scikit-adaptation.github.io/auto_examples/plot_how_to_use_skada.html), the [quick start guide](https://scikit-adaptation.github.io/quickstart.html) and the [gallery](https://scikit-adaptation.github.io/auto_examples/index.html).\n\nFirst, the DA data in the SKADA API is stored in the following format:\n\n```python\nX, y, sample_domain \n```\n\nWhere `X` is the input data, `y` is the target labels and `sample_domain` is the\ndomain labels (positive for source and negative for target domains). We provide\nbelow an example ho how to fit a DA estimator:\n\n```python\nfrom skada import CORAL\n\nda = CORAL()\nda.fit(X, y, sample_domain=sample_domain) # sample_domain passed by name\n\nypred = da.predict(Xt) # predict on test data\n```\n\nOne can also use `Adapter` classes to create a full pipeline with DA:\n\n```python\nfrom skada import CORALAdapter, make_da_pipeline\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LogisticRegression\n\npipe = make_da_pipeline(StandardScaler(), CORALAdapter(), LogisticRegression())\n\npipe.fit(X, y, sample_domain=sample_domain) # sample_domain passed by name\n```\n\nPlease note that for `Adapter` classes that implement sample reweighting, the \nsubsequent classifier/regressor must require sample_weights as input. This is\ndone with the `set_fit_requires` method. For instance, with `LogisticRegression`, you\nwould use `LogisticRegression().set_fit_requires('sample_weight')`:\n\n```python\nfrom skada import GaussianReweightAdapter, make_da_pipeline\npipe = make_da_pipeline(GaussianReweightAdapter(),\n                        LogisticRegression().set_fit_request(sample_weight=True))\n```\n\nFinally SKADA can be used for cross validation scores estimation and hyperparameter\nselection :\n\n```python\nfrom sklearn.model_selection import cross_val_score, GridSearchCV\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LogisticRegression\n\nfrom skada import CORALAdapter, make_da_pipeline\nfrom skada.model_selection import SourceTargetShuffleSplit\nfrom skada.metrics import PredictionEntropyScorer\n\n# make pipeline\npipe = make_da_pipeline(StandardScaler(), CORALAdapter(), LogisticRegression())\n\n# split and score\ncv = SourceTargetShuffleSplit()\nscorer = PredictionEntropyScorer()\n\n# cross val score\nscores = cross_val_score(pipe, X, y, params={'sample_domain': sample_domain}, \n                         cv=cv, scoring=scorer)\n\n# grid search\nparam_grid = {'coraladapter__reg': [0.1, 0.5, 0.9]}\ngrid_search = GridSearchCV(estimator=pipe,\n                           param_grid=param_grid,\n                           cv=cv, scoring=scorer)\n\ngrid_search.fit(X, y, sample_domain=sample_domain)\n```\n\n## Acknowledgements\n\nThis toolbox has been created and is maintained by the SKADA team that includes the following members:\n\n* [Th\u00e9o Gnassounou](https://tgnassou.github.io/)\n* [Oleksii Kachaiev](https://kachayev.github.io/talks/)\n* [R\u00e9mi Flamary](https://remi.flamary.com/)\n* [Antoine Collas](https://www.antoinecollas.fr/)\n* [Yanis Lalou](https://github.com/YanisLalou)\n* [Antoine de Mathelin](https://scholar.google.com/citations?user=h79bffAAAAAJ&hl=fr)\n* [Ruben Bueno]()\n\n## License\n\nThe library is distributed under the 3-Clause BSD license.\n\n## References\n\n[1] Shimodaira Hidetoshi. [\"Improving predictive inference under covariate shift by weighting the log-likelihood function.\"](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=235723a15c86c369c99a42e7b666dfe156ad2cba) Journal of statistical planning and inference 90, no. 2 (2000): 227-244.\n\n[2] Sugiyama Masashi, Taiji Suzuki, and Takafumi Kanamori. [\"Density-ratio matching under the Bregman divergence: a unified framework of density-ratio estimation.\"](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=f1467208a75def8b2e52a447ab83644db66445ea) Annals of the Institute of Statistical Mathematics 64 (2012): 1009-1044.\n\n[3] Sugiyama Masashi, Taiji Suzuki, Shinichi Nakajima, Hisashi Kashima, Paul Von B\u00fcnau, and Motoaki Kawanabe. [\"Direct importance estimation for covariate shift adaptation.\"](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=af14e09a9f829b9f0952eac244b0ac0c8bda2ca8) Annals of the Institute of Statistical Mathematics 60 (2008): 699-746.\n\n[4] Sugiyama Masashi, and Klaus-Robert M\u00fcller. [\"Input-dependent estimation of generalization error under covariate shift.\"](https://web.archive.org/web/20070221112234id_/http://sugiyama-www.cs.titech.ac.jp:80/~sugi/2005/IWSIC.pdf) (2005): 249-279.\n\n[5] Sun Baochen, Jiashi Feng, and Kate Saenko. [\"Correlation alignment for unsupervised domain adaptation.\"](https://arxiv.org/pdf/1612.01939.pdf) Domain adaptation in computer vision applications (2017): 153-171.\n\n[6] Courty Nicolas, Flamary R\u00e9mi, Tuia Devis, and Alain Rakotomamonjy. [\"Optimal transport for domain adaptation.\"](https://arxiv.org/pdf/1507.00504.pdf) IEEE Trans. Pattern Anal. Mach. Intell 1, no. 1-40 (2016): 2.\n\n[7] Flamary, R., Lounici, K., & Ferrari, A. (2019). [Concentration bounds for linear monge mapping estimation and optimal transport domain adaptation](https://arxiv.org/pdf/1905.10155.pdf). arXiv preprint arXiv:1905.10155.\n\n[8] Fernando, B., Habrard, A., Sebban, M., & Tuytelaars, T. (2013). [Unsupervised visual domain adaptation using subspace alignment](https://openaccess.thecvf.com/content_iccv_2013/papers/Fernando_Unsupervised_Visual_Domain_2013_ICCV_paper.pdf). In Proceedings of the IEEE international conference on computer vision (pp. 2960-2967).\n\n[9] Pan, S. J., Tsang, I. W., Kwok, J. T., & Yang, Q. (2010). [Domain adaptation via transfer component analysis](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=4823e52161ec339d4d3526099a5477321f6a9a0f). IEEE transactions on neural networks, 22(2), 199-210.\n\n[10] Courty, N., Flamary, R., Habrard, A., & Rakotomamonjy, A. (2017). [Joint distribution optimal transportation for domain adaptation](https://proceedings.neurips.cc/paper_files/paper/2017/file/0070d23b06b1486a538c0eaa45dd167a-Paper.pdf). Advances in neural information processing systems, 30.\n\n[11] Bruzzone, L., & Marconcini, M. (2009). [Domain adaptation problems: A DASVM classification technique and a circular validation strategy.](https://rslab.disi.unitn.it/papers/R82-PAMI.pdf) IEEE transactions on pattern analysis and machine intelligence, 32(5), 770-787.\n\n[12] Sun, B., & Saenko, K. (2016). [Deep coral: Correlation alignment for deep domain adaptation](https://arxiv.org/pdf/1607.01719.pdf). In Computer Vision\u2013ECCV 2016 Workshops: Amsterdam, The Netherlands, October 8-10 and 15-16, 2016, Proceedings, Part III 14 (pp. 443-450). Springer International Publishing.\n\n[13] Damodaran, B. B., Kellenberger, B., Flamary, R., Tuia, D., & Courty, N. (2018). [Deepjdot: Deep joint distribution optimal transport for unsupervised domain adaptation](https://openaccess.thecvf.com/content_ECCV_2018/papers/Bharath_Bhushan_Damodaran_DeepJDOT_Deep_Joint_ECCV_2018_paper.pdf). In Proceedings of the European conference on computer vision (ECCV) (pp. 447-463).\n\n[14] Long, M., Cao, Y., Wang, J., & Jordan, M. (2015, June). [Learning transferable features with deep adaptation networks](https://proceedings.mlr.press/v37/long15.pdf). In International conference on machine learning (pp. 97-105). PMLR.\n\n[15] Ganin, Y., Ustinova, E., Ajakan, H., Germain, P., Larochelle, H., Laviolette, F., ... & Lempitsky, V. (2016). [Domain-adversarial training of neural networks](https://www.jmlr.org/papers/volume17/15-239/15-239.pdf). Journal of machine learning research, 17(59), 1-35.\n\n[16] Long, M., Cao, Z., Wang, J., & Jordan, M. I. (2018). [Conditional adversarial domain adaptation](https://proceedings.neurips.cc/paper_files/paper/2018/file/ab88b15733f543179858600245108dd8-Paper.pdf). Advances in neural information processing systems, 31.\n\n[17] Sugiyama, M., Krauledat, M., & M\u00fcller, K. R. (2007). [Covariate shift adaptation by importance weighted cross validation](https://www.jmlr.org/papers/volume8/sugiyama07a/sugiyama07a.pdf). Journal of Machine Learning Research, 8(5).\n\n[18] Morerio, P., Cavazza, J., & Murino, V. (2017).[ Minimal-entropy correlation alignment for unsupervised deep domain adaptation](https://arxiv.org/pdf/1711.10288.pdf). arXiv preprint arXiv:1711.10288.\n\n[19] Saito, K., Kim, D., Teterwak, P., Sclaroff, S., Darrell, T., & Saenko, K. (2021). [Tune it the right way: Unsupervised validation of domain adaptation via soft neighborhood density](https://openaccess.thecvf.com/content/ICCV2021/papers/Saito_Tune_It_the_Right_Way_Unsupervised_Validation_of_Domain_Adaptation_ICCV_2021_paper.pdf). In Proceedings of the IEEE/CVF International Conference on Computer Vision (pp. 9184-9193).\n\n[20] You, K., Wang, X., Long, M., & Jordan, M. (2019, May). [Towards accurate model selection in deep unsupervised domain adaptation](https://proceedings.mlr.press/v97/you19a/you19a.pdf). In International Conference on Machine Learning (pp. 7124-7133). PMLR.\n\n[21] Zhang, K., Sch\u00f6lkopf, B., Muandet, K., Wang, Z. (2013). [Domain Adaptation under Target and Conditional Shift](http://proceedings.mlr.press/v28/zhang13d.pdf). In International Conference on Machine Learning (pp. 819-827). PMLR.\n\n[22] Loog, M. (2012). Nearest neighbor-based importance weighting. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pages 1\u20136. IEEE (https://arxiv.org/pdf/2102.02291.pdf)\n\n[23] Domain Adaptation Problems: A DASVM ClassificationTechnique and a Circular Validation StrategyLorenzo Bruzzone, Fellow, IEEE, and Mattia Marconcini, Member, IEEE (https://rslab.disi.unitn.it/papers/R82-PAMI.pdf)\n\n[24] Loog, M. (2012). Nearest neighbor-based importance weighting. In 2012 IEEE International Workshop on Machine Learning for Signal Processing, pages 1\u20136. IEEE (https://arxiv.org/pdf/2102.02291.pdf)\n\n[25] J. Huang, A. Gretton, K. Borgwardt, B. Sch\u00f6lkopf and A. J. Smola. Correcting sample selection bias by unlabeled data. In NIPS, 2007. (https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=07117994f0971b2fc2df95adb373c31c3d313442)\n\n[26] Long, M., Wang, J., Ding, G., Sun, J., and Yu, P. (2014). [Transfer joint matching for unsupervised domain adaptation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1410\u20131417](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=a279f53f386ac78345b67e13c1808880c718efdf)\n\n[27] S. Si, D. Tao and B. Geng. In IEEE Transactions on Knowledge and Data Engineering, (2010) [Bregman Divergence-Based Regularization for Transfer Subspace Learning](https://citeseerx.ist.psu.edu/document?repid=rep1&type=pdf&doi=4118b4fc7d61068b9b448fd499876d139baeec81)\n\n[28] Solomon, J., Rustamov, R., Guibas, L., & Butscher, A. (2014, January). [Wasserstein propagation for semi-supervised learning](https://proceedings.mlr.press/v32/solomon14.pdf). In International Conference on Machine Learning (pp. 306-314). PMLR.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2023 The SKADA developers. All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "A Python package for domain adaptation compatible with scikit-learn and Pytorch.",
    "version": "0.3.0",
    "project_urls": {
        "documentation": "https://scikit-adaptation.github.io/",
        "homepage": "https://scikit-adaptation.github.io/",
        "repository": "https://github.com/scikit-adaptation/skada/"
    },
    "split_keywords": [
        "domain-adaptation",
        " scikit-learn",
        " pytorch",
        " machine learning",
        " deep learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6979750aa18a9be09daad1597580418725d714c51b65122ab6457c97589eb526",
                "md5": "6059ead15747a0be4d73a248a5901ff6",
                "sha256": "1dfa82066cc886a2bbbed3a2069b824712707a22e7f385bb823a893ddb69f4aa"
            },
            "downloads": -1,
            "filename": "skada-0.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6059ead15747a0be4d73a248a5901ff6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 138922,
            "upload_time": "2024-07-05T12:40:24",
            "upload_time_iso_8601": "2024-07-05T12:40:24.946173Z",
            "url": "https://files.pythonhosted.org/packages/69/79/750aa18a9be09daad1597580418725d714c51b65122ab6457c97589eb526/skada-0.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7d9c3ecff1914b34714c6630591606f89a46da4374240af16766f1d43cf1d6d8",
                "md5": "07b594d85ca72a7bc1e41d7770efc7c5",
                "sha256": "de5b5750ccde46ca052562dd54cc86c022c51ecb30256387baa86fa8ba018b41"
            },
            "downloads": -1,
            "filename": "skada-0.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "07b594d85ca72a7bc1e41d7770efc7c5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 607040,
            "upload_time": "2024-07-05T12:40:27",
            "upload_time_iso_8601": "2024-07-05T12:40:27.279562Z",
            "url": "https://files.pythonhosted.org/packages/7d/9c/3ecff1914b34714c6630591606f89a46da4374240af16766f1d43cf1d6d8/skada-0.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 12:40:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scikit-adaptation",
    "github_project": "skada",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "requirements": [],
    "lcname": "skada"
}
        
Elapsed time: 0.53639s