 The proposed deep metric learning-based method, weighted convolutional Siamese network, WCSN, was used to learn representations from electroencephalogram e.g. signal for brain computer interface, BCI, assisted post-stroke rehabilitation. Compared to other state-of-dart approaches, our method achieved higher accuracy rates on two datasets acquired from stroke patients. Furthermore, without losing generality, our method also outperformed other approaches on two publicly available datasets acquired from healthy subjects. This article was authored by Shui Lei Zhang, Kai Kang, Dixizheng, and others.