Data-driven material models have many advantages over classical numerical approaches, such as the direct utilization of experimental data and the possibility to improve performance of predictions when additional data is available. One approach to develop a data-driven material model is to use machine learning tools. These can be trained offline to fit an observed material behaviour and then be applied in online applications. However, learning and predicting history dependent material models, such as plasticity, is still challenging. In this work, a machine learning based material modelling framework is proposed for both elasticity and plasticity. The machine learning based hyperelasticity model is developed with the Feed forward Neural Network (FNN) directly whereas the machine learning based plasticity model is developed by using of a novel method called Proper Orthogonal Decomposition Feed forward Neural Network (PODFNN). In order to account for the loading history, the accumulated absolute strain is proposed to be the history variable of the plasticity model. Additionally, the strain-stress sequence data for plasticity is collected from different loading-unloading paths based on the concept of sequence for plasticity. By means of the POD, the multi-dimensional stress sequence is decoupled leading to independent one dimensional coefficient sequences. In this case, the neural network with multiple output is replaced by multiple independent neural networks each possessing a one-dimensional output, which leads to less training time and better training performance. To apply the machine learning based material model in finite element analysis, the tangent matrix is derived by the automatic symbolic differentiation tool AceGen. The effectiveness and generalization of the presented models are investigated by a series of numerical examples using both 2D and 3D finite element analysis.