Skip to content

Commit 459c3eb

Browse files
Merge pull request #29 from antoinedemathelin/master
docs: Add flowchart
2 parents 47d41db + 06291e3 commit 459c3eb

File tree

11 files changed

+112
-33
lines changed

11 files changed

+112
-33
lines changed

adapt/feature_based/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Feature-Based Methods Module
33
"""
44

5-
from ._fe import FE
5+
from ._fa import FA
66
from ._coral import CORAL
77
from ._dann import DANN
88
from ._adda import ADDA
@@ -15,5 +15,5 @@
1515
from ._fmmd import fMMD
1616
from ._ccsa import CCSA
1717

18-
__all__ = ["FE", "CORAL", "DeepCORAL", "ADDA", "DANN",
18+
__all__ = ["FA", "CORAL", "DeepCORAL", "ADDA", "DANN",
1919
"MCD", "MDD", "WDGRL", "CDAN", "SA", "fMMD", "CCSA"]

adapt/feature_based/_fe.py renamed to adapt/feature_based/_fa.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313

1414
@make_insert_doc(supervised=True)
15-
class FE(BaseAdaptEstimator):
15+
class FA(BaseAdaptEstimator):
1616
"""
17-
FE: Frustratingly Easy Domain Adaptation.
17+
FA: Feature Augmentation.
1818
19-
FE consists in a feature augmentation method
19+
FA consists in a feature augmentation method
2020
where each input feature vector is augmented as follow:
2121
2222
- Source input feature vectors Xs are transformed into (Xs, **0**, Xs).
@@ -37,7 +37,7 @@ class FE(BaseAdaptEstimator):
3737
This feature-based method uses a few labeled target data and belongs to
3838
"supervised" domain adaptation methods.
3939
40-
As FE consists only in a preprocessing step, any kind of estimator
40+
As FA consists only in a preprocessing step, any kind of estimator
4141
can be used to learn the task. This method handles both regression
4242
and classification tasks.
4343
@@ -73,13 +73,13 @@ class FE(BaseAdaptEstimator):
7373
Examples
7474
--------
7575
>>> import numpy as np
76-
>>> from adapt.feature_based import FE
76+
>>> from adapt.feature_based import FA
7777
>>> np.random.seed(0)
7878
>>> Xs = 0.1 * np.random.randn(100, 1) + 1.
7979
>>> Xt = 0.1 * np.random.randn(100, 1) + 1.
8080
>>> ys = 0.1 * np.random.randn(100, 1) + 0.
8181
>>> yt = 0.1 * np.random.randn(100, 1) + 1.
82-
>>> model = FE()
82+
>>> model = FA()
8383
>>> model.fit(Xs, ys, Xt[:10], yt[:10]);
8484
Augmenting feature space...
8585
Previous shape: (100, 1)
@@ -97,7 +97,7 @@ class FE(BaseAdaptEstimator):
9797
9898
Notes
9999
-----
100-
FE can be used for multi-source DA by giving list of source data
100+
FA can be used for multi-source DA by giving list of source data
101101
for arguments Xs, ys of fit method : Xs = [Xs1, Xs2, ...],
102102
ys = [ys1, ys2, ...]
103103
"""
@@ -218,7 +218,7 @@ def transform(self, X, domain="tgt"):
218218
219219
Notes
220220
-----
221-
As FE is an anti-symetric feature-based method, one should indicates the
221+
As FA is an anti-symetric feature-based method, one should indicates the
222222
domain of ``X`` in order to apply the appropriate feature transformation.
223223
"""
224224
X = check_array(X, allow_nd=True)

src_docs/_static/css/custom.css

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ p {
33
}
44

55
.wy-nav-content {
6-
max-width: 1000px ;
6+
max-width: 1100px ;
77
}
88

99

@@ -238,3 +238,16 @@ dd {
238238
font-size: 87.5%;
239239
}
240240

241+
img.map-adapt {
242+
position: absolute;
243+
max-width: none;
244+
transform-origin: left top;
245+
-webkit-transform: scale(0.5);
246+
-ms-transform: scale(0.5);
247+
transform: scale(0.5);
248+
height: unset!important;
249+
}
250+
251+
#selecting-the-right-domain-adaptation-model {
252+
padding-bottom: 600px;
253+
}

src_docs/_static/images/carto4.png

427 KB
Loading

src_docs/_templates/layout.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
<li class="toctree-l1"><a class="reference internal" href="{{ pathto("install") }}">Installation</a></li>
1616
<li class="toctree-l1"><a class="reference internal" href="https://github.com/adapt-python/adapt">Github</a></li>
1717
</ul>
18+
<p class="caption" role="heading"><span class="caption-text">Tutorials</span></p>
19+
<ul>
20+
<li class="toctree-l1"><a class="reference internal" href="{{ pathto("map") }}">Choosing the right algorithm</a></li>
21+
</ul>
1822
<p class="caption" role="heading"><span class="caption-text">API Documentation</span></p>
1923
<ul>
2024
<li class="toctree-l1"><a class="reference internal" href="{{ pathto("contents") }}{{ contents }}{{ "adapt-feature-based" }}">Feature-based</a><ul>
21-
<li class="toctree-l2"><a class="reference internal" href="{{ pathto("generated/adapt.feature_based.FE") }}">FE</a></li>
25+
<li class="toctree-l2"><a class="reference internal" href="{{ pathto("generated/adapt.feature_based.FA") }}">FA</a></li>
2226
<li class="toctree-l2"><a class="reference internal" href="{{ pathto("generated/adapt.feature_based.CORAL") }}">CORAL</a></li>
2327
<li class="toctree-l2"><a class="reference internal" href="{{ pathto("generated/adapt.feature_based.SA") }}">SA</a></li>
2428
<li class="toctree-l2"><a class="reference internal" href="{{ pathto("generated/adapt.feature_based.fMMD") }}">fMMD</a></li>

src_docs/carto.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
2+
<img class="map-adapt" src="_static/images/carto4.png" usemap="#image-map">
3+
4+
<map name="image-map">
5+
<area target="" alt="Adapt" title="Adapt" href="https://adapt-python.github.io/adapt/" coords="534,101,151,72" shape="rect">
6+
<area target="" alt="RegularTransferLR" title="RegularTransferLR" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.RegularTransferLR.html" coords="1004,41,1174,67" shape="rect">
7+
<area target="" alt="RegularTransferLC" title="RegularTransferLC" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.RegularTransferLC.html" coords="1003,72,1169,90" shape="rect">
8+
<area target="" alt="RegularTransferNN" title="RegularTransferNN" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.RegularTransferNN.html" coords="1409,148,1582,171" shape="rect">
9+
<area target="" alt="TransferTreeRegressor" title="TransferTreeRegressor" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.TransferTreeRegressor.html" coords="1377,34,1573,58" shape="rect">
10+
<area target="" alt="TransferTreeClassifier" title="TransferTreeClassifier" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.TransferTreeClassifier.html" coords="1377,60,1568,78" shape="rect">
11+
<area target="" alt="TransferForestClassifier" title="TransferForestClassifier" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.TransferForest.html" coords="1379,88,1515,104" shape="rect">
12+
<area target="" alt="FineTuning" title="FineTuning" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.FineTuning.html" coords="1409,177,1508,194" shape="rect">
13+
<area target="" alt="PRED" title="PRED" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.PRED.html" coords="1397,270,1446,290" shape="rect">
14+
<area target="" alt="LinInt" title="LinInt" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.LinInt.html" coords="1395,293,1450,315" shape="rect">
15+
<area target="" alt="TrAdaBoostR2" title="TrAdaBoostR2" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.TrAdaBoostR2.html" coords="973,288,1105,307" shape="rect">
16+
<area target="" alt="TwoStageTrAdaBoostR2" title="TwoStageTrAdaBoostR2" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.TwoStageTrAdaBoostR2.html" coords="974,315,1186,330" shape="rect">
17+
<area target="" alt="TrAdaBoost" title="TrAdaBoost" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.TrAdaBoost.html" coords="948,419,1057,438" shape="rect">
18+
<area target="" alt="CCSA" title="CCSA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.CCSA.html" coords="950,445,1004,463" shape="rect">
19+
<area target="" alt="FADA" title="FADA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.FADA.html" coords="950,468,1013,488" shape="rect">
20+
<area target="" alt="BalancedWeighting" title="BalancedWeighting" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.BalancedWeighting.html" coords="1439,378,1609,399" shape="rect">
21+
<area target="" alt="FA" title="FA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.FA.html" coords="1437,405,1473,422" shape="rect">
22+
<area target="" alt="WANN" title="WANN" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.WANN.html" coords="1437,428,1513,451" shape="rect">
23+
<area target="" alt="GDM" title="GDM" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.GDM.html" coords="1598,532,1653,551" shape="rect">
24+
<area target="" alt="MME" title="MME" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.MME.html" coords="1609,677,1669,700" shape="rect">
25+
<area target="" alt="SSDANN" title="SSDANN" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.SSDANN.html" coords="1607,705,1704,723" shape="rect">
26+
<area target="" alt="LDM" title="LDM" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.LDM.html" coords="835,763,883,788" shape="rect">
27+
<area target="" alt="KMM" title="KMM" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.KMM.html" coords="757,877,814,894" shape="rect">
28+
<area target="" alt="KLIEP" title="KLIEP" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.KLIEP.html" coords="755,901,814,921" shape="rect">
29+
<area target="" alt="NearestNeighborsWeighting" title="NearestNeighborsWeighting" href="https://adapt-python.github.io/adapt/generated/adapt.instance_based.NearestNeighborsWeighting.html" coords="750,1014,997,1036" shape="rect">
30+
<area target="" alt="DANN" title="DANN" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.DANN.html" coords="1254,924,1321,944" shape="rect">
31+
<area target="" alt="ADDA" title="ADDA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.ADDA.html" coords="1254,947,1321,967" shape="rect">
32+
<area target="" alt="WDGRL" title="WDGRL" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.WDGRL.html" coords="1255,975,1331,993" shape="rect">
33+
<area target="" alt="DeepCORAL" title="DeepCORAL" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.DeepCORAL.html" coords="1255,997,1372,1018" shape="rect">
34+
<area target="" alt="MCD" title="MCD" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.MCD.html" coords="1255,1025,1307,1043" shape="rect">
35+
<area target="" alt="MDD" title="MDD" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.MDD.html" coords="1254,1050,1310,1067" shape="rect">
36+
<area target="" alt="CDAN" title="CDAN" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.CDAN.html" coords="1255,1074,1314,1092" shape="rect">
37+
<area target="" alt="fMMD" title="fMMD" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.fMMD.html" coords="1612,808,1678,827" shape="rect">
38+
<area target="" alt="FSDA" title="FSDA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.FSDA.html" coords="1610,834,1667,852" shape="rect">
39+
<area target="" alt="FSSP" title="FSSP" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.FSSP.html" coords="1610,859,1667,875" shape="rect">
40+
<area target="" alt="SA" title="SA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.SA.html" coords="1605,917,1639,938" shape="rect">
41+
<area target="" alt="TCA" title="TCA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.TCA.html" coords="1603,945,1649,961" shape="rect">
42+
<area target="" alt="JDA" title="JDA" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.JDA.html" coords="1603,968,1646,988" shape="rect">
43+
<area target="" alt="CORAL" title="CORAL" href="https://adapt-python.github.io/adapt/generated/adapt.feature_based.CORAL.html" coords="1603,993,1676,1014" shape="rect">
44+
<area target="" alt="SHOT" title="SHOT" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.SHOT.html" coords="649,49,702,71" shape="rect">
45+
<area target="" alt="NRC" title="NRC" href="https://adapt-python.github.io/adapt/generated/adapt.parameter_based.NRC.html" coords="648,76,695,97" shape="rect">
46+
<area target="" alt="POT" title="POT" href="https://github.com/PythonOT/POT" coords="1467,1007,1517,1030" shape="rect">
47+
</map>

src_docs/contents.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ and **target** distributions. The **task** is then learned in this **encoded fea
5555
:toctree: generated/
5656
:template: class.rst
5757

58-
feature_based.FE
58+
feature_based.FA
5959
feature_based.CORAL
6060
feature_based.SA
6161
feature_based.fMMD

src_docs/gallery/FA.rst

Whitespace-only changes.

src_docs/generated/adapt.feature_based.FE.rst renamed to src_docs/generated/adapt.feature_based.FA.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
:ref:`adapt.feature_based <adapt.feature_based>`.FE
1+
:ref:`adapt.feature_based <adapt.feature_based>`.FA
22
==========================================================
33

44
.. currentmodule:: adapt.feature_based
55

6-
.. autoclass:: FE
6+
.. autoclass:: FA
77
:no-members:
88
:no-inherited-members:
99
:no-special-members:
@@ -15,17 +15,17 @@
1515

1616
.. autosummary::
1717

18-
~FE.__init__
19-
~FE.fit
20-
~FE.fit_estimator
21-
~FE.fit_transform
22-
~FE.get_params
23-
~FE.predict
24-
~FE.predict_estimator
25-
~FE.score
26-
~FE.set_params
27-
~FE.transform
28-
~FE.unsupervised_score
18+
~FA.__init__
19+
~FA.fit
20+
~FA.fit_estimator
21+
~FA.fit_transform
22+
~FA.get_params
23+
~FA.predict
24+
~FA.predict_estimator
25+
~FA.score
26+
~FA.set_params
27+
~FA.transform
28+
~FA.unsupervised_score
2929

3030

3131
.. automethod:: __init__
@@ -47,5 +47,5 @@
4747

4848
<h2> Examples </h2>
4949

50-
.. include:: ../gallery/FE.rst
50+
.. include:: ../gallery/FA.rst
5151

src_docs/map.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Selecting the right domain adaptation model
2+
===========================================
3+
4+
When facing a new domain adaptation problem, it can be particularly difficult to choose the appropriate transfer learning algorithm.
5+
6+
The flowchart below has been designed to help the user to quickly identify which type of algorithm
7+
could be used in a specific case. The choice of transfer method is driven by practical characteristics
8+
derived from the available datasets.
9+
10+
Click on any algorithm in the diagram below to see its documentation.
11+
12+
13+
.. raw:: html
14+
:file: carto.html
15+

0 commit comments

Comments
 (0)