Demand prediction plays a critical role in traffic research. The key challenge of traffic demand prediction lies in modeling the complex spatial dependencies and temporal dynamics. However, there is no mature and widely accepted concept to support the solution of the above challenge. Essentially, a prediction model combined with similar objects in temporal and spatial dimensions could obtain better performance. This paper proposes a concept called the Similarity-based Principle (SP), which is applied to improve the prediction performance of deep learning models in complex traffic scenarios. For the temporal components, the long-term temporal dynamics in contemporaneous historical data for ridership are extracted by the Stacked Autoencoder (SAE) method. For the spatial components, the activity-based spatial geographic information (ABG-information) is used to capture the spatial correlation of the traffic network, which is reflected in the daily activities of humans. Specifically, the SP is applied to a Spatio-temporal Graph Convolutional Neural Network (STGCNN) model. In the case study, the Similarity-based Principle Spatio-temporal Graph Convolutional Neural Network (SP-STGCNN) model predicts demand for bicycle sharing in San Francisco. The results show that the SP effectively improves the model's performance. The prediction accuracy is enhanced by up to 10.34% compared with STGCNN. For spatial relationships, the model using the geographic information attribute performs better than that using the road information attribute and the distance attribute. It is proved that the construction of the Spatio-temporal model-based similarity principle can improve the performance.