f[x_]=myfito[loglosst,2,points,g][[2]];
Plot[{f[x],0.5},{x,-1,1}]

f[x_]=myfito[loglosst,17,points,g][[2]];
Plot[{f[x],0.5},{x,-1,1}]

f[x_]=myfito[linloss,17,points,g][[2]];
Plot[{f[x],0.5},{x,-1,1}]

fs1=myfito[loglosst,#,points,g][[2]]&/@Table[i,{i,2,30}];
fs2=myfito[linloss,#,points,g][[2]]&/@Table[i,{i,2,30}];

Plot[Evaluate[fs1],{x,-1,1}]

Plot[Evaluate[fs2],{x,-1,1}]

ffs1=Function@@{x,#}&/@fs1;

Plot[ffs1[[10]][x],{x,-1,1}]

geterror[g_,f_]:=Module[{cf,n=100000,e},
e=Compile[x,Abs[UnitStep[g[x]-0.5]-UnitStep[f[x]-0.5]]];
Plus@@(e[#]&/@Table[i,{i,-1,1,2/n}]) *2./n
]

geterror[g,ffs1[[29]]]

errors=geterror[g,#]&/@ffs1

ListPlot[errors,Joined->True]

myfito[linloss,1,points,g][[2]]

fs1=Prepend[fs1,0.5];

fs2=Prepend[fs2,0.5];

fs1[[1]]