Thinking machines: machine learning and its hardware implementation Optimization of mathematical model and its software implementation