As a branch of artificial intelligence, machine learning (ML) is closer and closer in collaborating with materials science. The combination of ML and first-principles (such as density-functional theory, DFT) calculations offers possibility to efficiently predict materials structures and properties, for which conventional DFT is nearly powerless. In general, the idea is to develop and train an ML model to learn a multidimensional function from the information from available data - ranging from a few to a few thousands and even further. Each material structure is properly represented by a multi-component vector, and this learned function should represents the relationships among the given data which are now points in the high-dimensional phase space. A sufficiently trained model can predict properties of unknown materials (not in the training set) almost as accurate as conventional DFT but demanding much less computational resource. In particular for complex systems, such as multi-ionic alloys and materials with prevalent structural disorder, ML is expected to be a promising tool to acquire a complete picture of the materials space and to speed up the design of next-generation materials.