Code Monkey home page Code Monkey logo

adapt's Introduction

ADAPT

PyPI version Build Status Python Version Codecov Status

Awesome Domain Adaptation Python Toolbox

ADAPT is a python library which provides several domain adaptation methods implemented with Tensorflow and Scikit-learn.

Documentation Website

Find the details of all implemented methods as well as illustrative examples here: ADAPT Documentation Website

Installation

This package is available on Pypi and can be installed with the following command line:

pip install adapt

The following dependencies are required and will be installed with the library:

  • numpy
  • scipy
  • tensorflow (>= 2.0)
  • scikit-learn
  • cvxopt

If for some reason, these packages failed to install, you can do it manually with:

pip install numpy scipy tensorflow scikit-learn cvxopt

Finally import the module in your python scripts with:

import adapt

Reference

If you use this library in your research, please cite ADAPT using the following reference: https://arxiv.org/pdf/2107.03049.pdf

@article{de2021adapt,
	  title={ADAPT: Awesome Domain Adaptation Python Toolbox},
	  author={de Mathelin, Antoine and Deheeger, Fran{\c{c}}ois and Richard, Guillaume and Mougeot, Mathilde and Vayatis, Nicolas},
	  journal={arXiv preprint arXiv:2107.03049},
	  year={2021}
	}

Quick Start

import numpy as np
from adapt.feature_based import DANN
np.random.seed(0)

# Xs and Xt are shifted along the second feature.
Xs = np.concatenate((np.random.random((100, 1)),
                     np.zeros((100, 1))), 1)
Xt = np.concatenate((np.random.random((100, 1)),
                     np.ones((100, 1))), 1)
ys = 0.2 * Xs[:, 0]
yt = 0.2 * Xt[:, 0]

# With lambda set to zero, no adaptation is performed.
model = DANN(lambda_=0., random_state=0)
model.fit(Xs, ys, Xt=Xt, epochs=100, verbose=0)
print(model.evaluate(Xt, yt)) # This gives the target score at the last training epoch.
>>> 0.0231

# With lambda set to 0.1, the shift is corrected, the target score is then improved.
model = DANN(lambda_=0.1, random_state=0)
model.fit(Xs, ys, Xt=Xt, epochs=100, verbose=0)
model.evaluate(Xt, yt)
>>> 0.0011

Examples

Two Moons Classification Regression
Open In Colab Open In Colab Open In Colab
Sample Bias Multi-Fidelity Rotation
Open In Colab Open In Colab Open In Colab

Content

ADAPT package is divided in three sub-modules containing the following domain adaptation methods:

Feature-based methods

Instance-based methods

Parameter-based methods

Acknowledgement

This work has been funded by Michelin and the Industrial Data Analytics and Machine Learning chair from ENS Paris-Saclay, Borelli center.

Michelin IDAML Centre Borelli

adapt's People

Contributors

antoinedemathelin avatar github-actions[bot] avatar anonymousaccount0 avatar adapt-python avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.