forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 2:35 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Python optimize.leastsq to alglib miml_d_v
PostPosted: Wed Jul 01, 2015 5:38 pm 
Offline

Joined: Wed Jul 01, 2015 5:26 pm
Posts: 1
I am new with alglib and I am trying to use miml_d_v in c# as a replacement for a function I am using in Python called optimize.leastsq of the library scify, however I am having some troubles with it.

The original code produce some data that I reproduce in the following code in python, and I would like to get the same results with alglib in C#.

Is there anyone that could help?

Python Code:
import scipy
from scipy import optimize

p0=[4873728.540127272, -785466.155700958, 4025286.807390065, 0.00093518512201935322]

ret=[[-32.434757861495015, -0.065348023336239361, -0.1034045151670188, -0.1717015531728977, -0.59427038934081844, -0.18318382750730977, -0.16254255832172945, -32.449899899214508],
[-32.434757861495015, -0.065348023336239361, -0.1034045151670188, -0.1717015531728977, -0.59427038934081844, -0.18318382750730977, -0.16254255832172945, -32.449899899214508],
[-32.434757861495015, -0.065348023336239361, -0.1034045151670188, -0.1717015531728977, -0.59427038934081844, -0.18318382750730977, -0.16254255832172945, -32.449899899214508],
[-32.448173513263463, -0.065421742527807275, -0.10338040240063293, -0.17192136949161083, -0.5947541311848914, -0.18321835632668823, -0.16264121994609027, -32.479343549162145],
[-32.431583742052318, -0.065339026320759358, -0.10338103946896396, -0.17171039677923561, -0.59437672263011387, -0.18315894732950272, -0.1625546041526833, -32.447159752249718],
[-32.464888094365598, -0.065291705030001104, -0.10345637464263159, -0.17169058705912918, -0.59459532373584856, -0.183318230090663, -0.16269966895924895, -32.472408668696879],
[-32.437264488637446, -0.065354632646321215, -0.10341374467471283, -0.17171460852259784, -0.59432261073961912, -0.18319688285700994, -0.16255561367142959, -32.452406526356931],
[-7.0108473300933832e-05, 0.0087499652417667717, 0.0097119369629178887, -0.019899209938012082, 0.0027980973944067978, -0.015756631374824807, -0.0017866643145680444, 0.00013757720589637756],
[-0.013485751301050185, 0.0086762461091344639, 0.0097360496634637268, -0.020119026070460694, 0.0023143558762967606, -0.01579116019420327, -0.0018853258807212132, -0.029306043684482572],
[0.0031039953231811524, 0.008758962215991848, 0.0097354125292926311, -0.019908053486142326, 0.0026917647104710363, -0.015731751336716129, -0.0017987100756727175, 0.0028777107596397399],
[-0.030200292170047757, 0.0088062834419209337, 0.0096600775366851403, -0.019888243882451223, 0.0024731633253395578, -0.01589103376027198, -0.0019437747308984417, -0.022371158748865128],
[-0.0025763265788555146, 0.0087433570102065337, 0.0097027089613150336, -0.019912263157311844, 0.0027458845172077442, -0.015769684594124568, -0.0017997175338678078, -0.002368640899658203],
[-6.4688175916671748e-05, 0.0087499773766082697, 0.0097119587312846679, -0.019899188692215849, 0.0027981874998658919, -0.015756601968314514, -0.0017866392154246584, 0.00014257058501243591]]

i=-1
def positionErrorFunction(p, data):
global i
i=i+1
return ret[i]

p1, ier = optimize.leastsq(positionErrorFunction, p0[:], args=(0))
print("p1: %s" %p1)
print("ier: %s" %ier)

#solution
# p1: [ 4.87372425e+06 -7.85462104e+05 4.02528066e+06 9.35032471e-04]
#ier: 2


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group