Metadata-Version: 2.1
Name: crosstrainer
Version: 0.1.5
Summary: CrossTrainer: Practical Domain Adaptation with Loss Reweighting
Home-page: https://github.com/stanford-futuredata/crosstrainer
Author: Justin Yu-wei Chen
Author-email: jyc8889@gmail.com
License: MIT
Platform: UNKNOWN
Description-Content-Type: text/markdown
Requires-Dist: scikit-learn
Requires-Dist: numpy
Requires-Dist: scipy

# 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:

```python
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```.

