replace fit_sgd function and manual after Marc's modifications to account for negative parameters