hoangduit / accord

Automatically exported from code.google.com/p/accord
0 stars 0 forks source link

The GoldfarbIdnani optimizer does not optimize well compared to identical library in R #109

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the attached C# code
2. Run the attached R Script which uses identical data and constraints
3. compare the two solutions and optimized value

What is the expected output? What do you see instead?
expected solution :[0 0.73222257311567 0  0.2677742688433]
C# output         :[1 0 0 0]

What version of the product are you using? On what operating system?
we're using the latest , 2.14.0

Please provide any additional information below.
The Lagrangian is different between R and Accord.Net :

R-Lagrangian for this 4-variable problem:
[0.0003730054618697  0.00016053620578588  0  0 0 0.000060343913971918 0  0  0  ]

Accord.net Lagrangian:
[0.0016358103149359798 0.0 0.0 0.00019044160049702948 0.0 
0.00052997886683526986 0.0 0.00072634804247749985 0.0]

Also the optimized value for this minimization problem with R is much better 
than the optimized value with Accord.Net

Optimized Value with R           = -0.00079179497009427
Optimized value with Accord.Net  = 0.0012680195662191284

Original issue reported on code.google.com by lakshma...@gmail.com on 8 Jan 2015 at 2:46

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks again for reporting the issue! I am adding the case to the project tests 
to investigate.

Original comment by cesarso...@gmail.com on 8 Jan 2015 at 6:22

GoogleCodeExporter commented 9 years ago
I forgot the R Script . Here it is

Original comment by lakshma...@gmail.com on 8 Jan 2015 at 9:45

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Lakshmasri! Finally I have taken the time to fix this issue. One of the 
problems that I saw is that the Accord.NET interpretation of the inputs differs 
from the one in R. In R, the method expects the contents of the dvec vector to 
be subtracted from the objective function, while Accord.NET expects it to be 
summed. I also corrected a few more translation issues by comparing against 
Turlach's 1998 Fortran routines.

Here are the changes made:

https://github.com/accord-net/framework/commit/215f29b252834b477435a5a9ac637f450
13410da?diff=unified&w=1

I will generate a new package for download soon.

Best regards,
Cesar

Original comment by cesarso...@gmail.com on 14 Feb 2015 at 8:53

GoogleCodeExporter commented 9 years ago
Thanks a lot for working on this. I'll run other use cases once I check out
the changes.

Original comment by lakshma...@gmail.com on 14 Feb 2015 at 8:58