Data and parameters (closed)
Data and parameters (closed)
Objective function (MaxEnt)
Objective function (MaxEnt)
lambdas is a vector of 12 parameters. The function calculates a penalized log-likelihood.
In[]:=
logLMaxEnt[lambdas_]:=Module[{sum,expSum,q,lnQ,logL,variances,betas,penalty},sum=normData.lambdas;expSum=Exp[sum-Max[sum]];q=expSum/Total[expSum];lnQ=Log[q];logL=Total[Take[lnQ,n]]/n;variances=Map[Variance,Transpose[Take[normData,485]]];betas=beta*Sqrt[variances/n];penalty=Total[betas*Abs[lambdas]];logL-penalty]
Below are what I believe to be the optimal lambda values, based on published work. They were obtained by the Generalized Reduced Gradient option in Excel’s Solver add-on.
In[]:=
lambdaHat={11.97726076,5.958596845,10.61323785,3.469730544,4.900673955,0.891524025,-7.852679626,6.661869372,-16.10071294,-0.405247928,-0.365607972,-9.52024*^-7};
In[]:=
logLMaxEnt[lambdaHat]
Out[]=
-4.2483
How to most effectively maximize in the Wolfram Language? I believe the function is concave. It should be a numerical routine, I think, as the objective function is unwieldy with symbol variables. (I realize that the function itself can be optimized for speed, but that’s a different issue. For now I am interesting in finding the best optimization algorithm.)