Crosstrainer
CrossTrainer: Practical Domain Adaptation with Loss Reweighting
Install / Use
/learn @stanford-futuredata/CrosstrainerREADME
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:
from crosstrainer 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.
Related Skills
node-connect
353.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
