MATLAB implementation of Scatter Component Analysis for domain generalization proposed in paper
Ghifary, M., Balduzzi, D., Kleijn, W. B., & Zhang, M. (2017). Scatter component analysis: A unified framework for domain adaptation and domain generalization. IEEE transactions on pattern analysis and machine intelligence, 39(7), 1414-1430.
The code is tested using MATLAB R2017b on Windows 10. Any later version should work normally.
In MATLAB, change your current folder to "SCA" and run one of the file demo.m to see whether it could run normally.
The file demo.m does the following:
-
Load synthetic data from "./syn_data/data.m";
-
Prepare source sample sets (put sample sets 1, 2 in a MATLAB cell array), validation set (sample sets 3, 4 in a matrix), and test set (sample set 5 in a matrix);
-
Learn transformations using SCA on the source sample sets and validate hyperparameters on the validation set.
-
Apply the optimal transformation on the test set.
Change your current folder to "SCA" and use the following commands
[test_accuracy, predicted_labels, Zs, Zt] = SCA(X_s_cell, Y_s_cell, X_t, Y_t, params)
Input | Description |
---|---|
X_s_cell | cell of (n_s*d) matrix, each matrix corresponds to the instance features of a source domain |
Y_s_cell | cell of (n_s*1) matrix, each matrix corresponds to the instance labels of a source domain |
X_t | (n_t*d) matrix, rows correspond to instances and columns correspond to features |
Y_t | (n_t*1) matrix, each row is the class label of corresponding instances in X_t |
params | optional parameters, details can be found in SCA.m |
Output | Description |
---|---|
test_accuracy | test accuracy on target instances |
predicted_labels | predicted labels of target instances |
Zs | projected source domain instances |
Zt | projected target domain instances |
- Shoubo Hu - shoubo [dot] sub [at] gmail [dot] com
See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE file for details.
- Hat tip to Ya Li for his Conditional Invariant Domain Generalization (CIDG) code.