Skip to main content

CrossTrainer: Practical Domain Adaptation with Loss Reweighting

This is an implementation of the method described in "CrossTrainer: Practical Domain Adaptation with Loss Reweighting" by Justin Chen, Edward Gan, Kexin Rong, Sahaana Suri, and Peter Bailis.

Install

The crosstrainer package can be installed using pip.

pip install crosstrainer

Usage

CrossTrainer utilizes loss reweighting to train machine learning models using data from a target task with supplementary source data.

Inputs:

Base model, target data, source data.

Outputs:

Trained model with optimized weighting parameter alpha.

Example:
import crosstrainer
from sklearn import linear_model

lr = linear_model.LogisticRegression()
ct = CrossTrainer(lr, k=5, delta=0.01)
lr, alpha = ct.fit(X_target, y_target, X_source, y_source)
y_pred = lr.predict(X_test)

More examples can be found in the tests file: crosstrainer/tests/test_crosstrainer.py.

Release files for crosstrainer 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for crosstrainer 0.1.5
File Interpreter ABI Platform
crosstrainer-0.1.5-py3-none-any.whl Python 3 none any Details

Release files / crosstrainer-0.1.5-py3-none-any.whl

Download URL crosstrainer-0.1.5-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0754f4a5e47ada8721d9a4977e551383a4ed318f8cd22327fc5b78be7eef049
BLAKE2b-256 checksum
How to use checksums
aa13a3435c3873b048c31588a4ca3fc9edfe9aa7ccf1011491835031ae23e3a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.1.5 This release

1 release file

0.1.4

1 release file

0.1.3

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page