Parameters estimation
generating training matrix