Fuzzy Cognitive Maps (FCM) is a popular technique for describing dynamic systems. A FCM for a dynamic system is a signed graph consisted of relevant concepts and causal relationships/weights between the concepts in the system. With suitable weights defined by experts in the related areas, the inference of the FCM can provide meaningful modeling of the system. Thus correctness of the weights is crucial to the success of a FCM system. Normally the weights are set by experts in the related areas. Considering the possible inefficiency and subjectivity of experts when judging the weights, it is an appealing idea to generate weights automatically according to the samples obtained through observation of the system. Some training algorithms were proposed. However, to our best knowledge, few learning algorithm has been reported to generate weight matrix based on sample sequences with continuous values. In this paper, we introduce a new learning algorithm to train the weights of FCM. In the proposed algorithm, the weights are updated by gradient descent on a squared Bellman residual, which is an accepted method in machine learning. The experiment results show that given sufficient training samples, the correct weights can be approximated by the algorithm. The algorithm proposes a new way for FCM research and applications.