Working on cost function for ml ex1