a (b+c)/.a Plus[b__]->Times[b]

Rule

$User

$Version

$UserName

$LicenseID

$LicenseServer

f[x_,{a_,b_,c_}]:=1/(1+Exp[a+b x+c (x^2)])

g[x_]=0.5 1/(1+Exp[-20 x])+0.25+0.25 Sin[20 x];

Plot[g[x],{x,-1,1}]

Loss[g_,f_]=-g f +Log[1+Exp[f]]; (*g is true, f is fitted*)

Loss[g_,f_]=(((g-f))^2)

Timing[NIntegrate[Loss[g[x],f[x,{a,b,c}/.{a->1.2,b->0.9,c->1}]],{x,-1,1}]]

points=Table[i,{i,-1,1,0.01}];

realloss:=Plus@@(Loss[g[#],f[#,{a,b,c}]]&/@points);

gr=D[realloss,{{a,b,c},1}];

hess=D[realloss,{{a,b,c},2}];

Timing[FindMinimum[realloss,{{a,1},{b,1},{c,1}},Method->"ConjugateGradient",PrecisionGoal->10]]

Timing[FindMinimum[realloss,{{a,1},{b,1},{c,1}},Method->"ConjugateGradient",Gradient->gr]]

Timing[FindMinimum[realloss,{{a,1},{b,1},{c,1}},Method->"Newton",Gradient->gr]]

Timing[FindMinimum[realloss,{{a,1},{b,1},{c,1}},Method->{"Newton",Hessian->hess},Gradient->gr]]

result=%[[2,2]];

Plot[f[x,{a,b,c}]/.result,{x,-1,1}]