This release is a pre-release and may not be stable for production use.
kalelinear is a Python library for learning harmonized or individualized models from multi-source/multi-view data in linear or reproducing kernel Hilbert spaces (RKHS). It provides NumPy-based methods for leveraging related data distributions and structural assumptions, including transfer learning, domain adaptation, manifold regularization, and group-aware learning, through a scikit-learn style API.
The package is part of the PyKale ecosystem and focuses on linear and kernel methods for data characterized by covariates (e.g., domain labels, group labels, side information), unlabeled target samples, or tensor structures.
What's included
- Transformer models for learning feature embeddings:
- Estimator models for classification:
- NumPy-compatible inputs and outputs.
- scikit-learn style
fit,transform,predict,fit_transform, andfit_predictworkflows where applicable. - Optional covariate encoding for categorical domain or group labels.
kalelinear requires Python 3.10 or later. Core dependencies include:
Getting started
Installation
Install the released package from PyPI:
pip install kalelinear
Install from a local checkout for development:
pip install -e ".[dev]"
Development
From the root of the repository, run the following commands in your terminal:
-
Install pre-commit hooks (only required once):
pre-commit install -
Run pre-commit checks for code style and formatting on all files:
pre-commit run --all-files
-
Run test cases to verify functionality:
pytest
-
Build the documentation:
pip install -r docs/requirements.txt sphinx-build -b html docs/source docs/build/html
See CONTRIBUTING.md for detailed contribution guidelines.
Public API
from kalelinear.transformer import BDA, JDA, MIDA, MPCA, TCA
from kalelinear.estimator import ARRLS, ARSVM, CoIRLS, CoIRSVM, GSDA, LapRLS, LapSVM
Worked examples for the main transformers and estimators are collected in Tutorials:
- Learn a domain-invariant embedding with TCA
- Use MIDA with categorical covariates
- Train a domain adaptation classifier (ARSVM, ARRLS)
- Train a manifold-regularized classifier (LapSVM, LapRLS)
References
[1] Lu, H., Plataniotis, K.N. and Venetsanopoulos, A.N., 2008. MPCA: Multilinear principal component analysis of tensor objects. IEEE Transactions on Neural Networks, 19(1), pp.18-39.
[2] Pan, S.J., Tsang, I.W., Kwok, J.T. and Yang, Q., 2011. Domain adaptation via transfer component analysis. IEEE Transactions on Neural Networks, 22(2), p.199-210.
[3] Long, M., Wang, J., Ding, G., Sun, J. and Yu, P.S., 2013. Transfer feature learning with joint distribution adaptation. In Proceedings of the IEEE International Conference on Computer Vision (pp. 2200-2207).
[4] Wang, J., Chen, Y., Hao, S., Feng, W. and Shen, Z., 2017, November. Balanced distribution adaptation for transfer learning. In 2017 IEEE International Conference on Data Mining (ICDM) (pp. 1129-1134). IEEE.
[5] Yan, K., Kou, L. and Zhang, D., 2017. Learning domain-invariant subspace using domain features and independence maximization. IEEE Transactions on Cybernetics, 48(1), pp.288-299.
[6] Belkin, M., Niyogi, P. and Sindhwani, V., 2006. Manifold regularization: A geometric framework for learning from labeled and unlabeled examples. Journal of Machine Learning Research, 7(11).
[7] Long, M., Wang, J., Ding, G., Pan, S.J. and Yu, P.S., 2013. Adaptation regularization: A general framework for transfer learning. IEEE Transactions on Knowledge and Data Engineering, 26(5), pp.1076-1089.
[8] Zhou, S., Li, W., Cox, C. and Lu, H., 2020, April. Side information dependence as a regularizer for analyzing human brain conditions across cognitive experiments. In Proceedings of the AAAI Conference on Artificial Intelligence (Vol. 34, No. 04, pp. 6957-6964).
[9] Zhou, S., 2022. Interpretable Domain-Aware Learning for Neuroimage Classification (Doctoral dissertation, University of Sheffield).
[10] Zhou, S., Luo, J., Jiang, Y., Wang, H., Lu, H. and Gong, G., 2025. Group-specific discriminant analysis enhances detection of sex differences in brain functional network lateralization. GigaScience, 14, p.giaf082.
Other open domain adaptation repositories
- POT: Python Optimal Transport
- Everything about Transfer Learning
- ADA: Another Domain Adaptation library
- Domain Adaptation and Transfer Learning Repositories
- Library of transfer learners and domain-adaptive classifiers
- domain-adaptation-toolbox
- Domain-Adaptations
License
kalelinear is released under the MIT License. See LICENSE for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalelinear-0.1.0b1.tar.gz.
File metadata
- Download URL: kalelinear-0.1.0b1.tar.gz
- Upload date:
- Size: 40.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
817f7460d3bb6bf2e490fa6c7608c0f2358d920a980a08847f3a396e9aa6ca47
|
|
| MD5 |
f633791f8df833b411267c35cc9f367a
|
|
| BLAKE2b-256 |
a1956d788772b24e2e3c9ac54aeb0a5b0854239034cd0410178dd6244c22e61e
|
File details
Details for the file kalelinear-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: kalelinear-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 45.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d8eadb3bf154e00c9d93bf4c89663a30dcc271e4efda23e27efa4fa5cc07cb9
|
|
| MD5 |
b619efbfb4f3f1e77518afa46e416aab
|
|
| BLAKE2b-256 |
b5bd31e79379de87cfd702c618e9cb79162a3406540268cb6036229d3aaa5882
|