libDirectional开源项目

我要开发同款
匿名用户2021年11月23日
91阅读

技术信息

开源地址
https://github.com/didi/di18n
授权协议
GPL-3.0 License

作品详情

libDirectioal

libDirectioalisalibraryfordirectioalstatisticsaswellasrecursiveestimatioodirectioalmaifolds.Thesupportedmaifoldsiclude

uitcircleuithyperspherecomplexuithyperspheretorusSE(2)

Foreachofthesemaifolds,thelibrarycotaiscertaiprobabilitydistributiosaswellasrecursivefilterigalgorithms.

Istallatio

Requiremets:

Matlab2021aorlaterasuitablecompiler(VisualStudio2015,VisualStudio2017,MiGW64,gcc4.7orlater,XCode)

TouselibDirectioal,addtheetirelib-foldericludigsubdirectoriestoMatlab'ssearchpath.The,chagetothelib-folderadruthecompileAll.mscript.Thisscriptshouldcompileallmex-filesusedbylibDirectioal.

Ifyouexperieceayissues,rumex-setupadmex-setupC++toesurethatyouhaveselectedthecorrectcompiler.Icaseyouhavetroublecompiligwithgcc,makesurethatyouareusigaversiothatisofficiallysupportedbyMATLAB.

ThefollowigtoolboxesarerecommededforlibDirectioal:

image_toolboxoptimizatio_toolboxstatistics_toolboxsymbolic_toolbox

Thestatisticstoolboxadtheoptimizatiotoolboxarefairlywidelyused,buttheothertoolboxesareolyrequiredforcertaiveryspecificfeatures.

Example:PlottigProbabilityDesityFuctios

Forexample,wecageerateatwo-dimesioalplotofthepdfofawrappedormaldistributiowithparametersmu=2adsigma=1.3simplybytypigthefollowigtwocommads.

>>w=WNDistributio(2,1.3);>>w.plot2d();

Wecathesetthelabelsadaxisusigthefollowigcode:

>>setupAxisCircular('x');>>xlabel('x');ylabel('f(x)');

Similarly,wecacreateplotsofotherdistributios.Athree-dimesioalplotofthepdfofavoMisesdistributiowithparametersmu=6adkappa=0.5couldbegeeratedusigthefollowigcode.

>>vm=VMDistributio(6,0.5);>>vm.plot3d('color','red');>>holdo;vm.plotCircle('color','black');holdoff;>>xlabel('cos(x)');ylabel('si(x)');zlabel('f(x)');Example:NumericaladAalyticalCalculatio

Letusagaicosiderthewrappedormaldistributiodefiedithepreviousexample.Supposewewattocalculatethefirsttrigoometricmomet,i.e.,E(exp(ix)),ofthisdistributio.Forthispurpose,wesimplycallthecorrespodigfuctio:

>>w.trigoometricMomet(1)

Thisproducestheoutput

as=-0.1788+0.3906i

Ithecaseofthewrappedormaldistributio,trigoometricMometisafuctioisidetheclassWNDistributiothatimplemetsaaalyticcalculatioofthetrigoometricmomet.Ifoaalyticsolutiowasimplemeted,thefuctiotrigoometricMometithebaseclassAbstractCircularDistributiowouldautomaticallyfallbacktoaalgorithmbasedoumericalitegratio.Evethoughaaalyticalsolutioisavailableforthewrappedormaldistributio,wecastillcalltheumericalalgorithmasfollows.

>>w.trigoometricMometNumerical(1)

Weobtaitheresult

as=-0.1788+0.3906i

Thisca,forexample,beusedtocomparetheumericaladaalyticalresultsiordertoesurecorrectessoftheaalyticalimplemetatio.Ithiscase,bothresultsmatchuptothedisplayedumberofdigits,buticertaicases,aalyticaladumericalsolutiosmaydiffermoresigificatly.

Example:NoliearCircularFilterig

Letuscosiderasystemwithcircularstatex_ki[0,2pi)addyamics

x_{k+1}=a(x_k)+w_ka_k(x_k)=x+0.1cos(x_k)mod2pi

wherew_kisdistributedaccordigtoWN(x;0,0.4)IfweassumethatthecurretstateisdistributedaccordigtoWN(x;2,0.5),wecaperformthepredictiostepwiththeWN-assumedfilterusigthefollowigcommads.

>>filter=WNFilter();>>filter.setState(WNDistributio(2,0.5));>>a=@(x)mod(x+0.1*cos(x),2*pi);>>filter.predictNoliear(a,WNDistributio(0,0.4));>>filter.getEstimate()

Thisproducestheoutput

as=WNDistributiowithproperties:mu:1.9623sigma:0.6092

Asyoucasee,thepredicteddesityisreturedasawrappedormaldistributio.Nowwecosiderthemeasuremetmodel

z_k=h_k(x_k)+v_k

with

h_k:[0,2pi)->R,h_k(x)=si(x)

wherev_kisadditiveoisedistributedaccordigtoN(x;0,0.7).Asyoucasee,wehaveacircularstate,butareal-valuedmeasuremet,ithiscase.However,acircularmeasuremet(orameasuremetoacompletelydifferetmaifold)wouldbepossibleaswell.Ifweobtaiameasuremet,sayz=0.3,wecaperformthemeasuremetupdateasfollows.

>>h=@(x)si(x);>>measuremetNoise=GaussiaDistributio(0,0.7);>>likelihood=LikelihoodFactory.additiveNoiseLikelihood(h,measuremetNoise);>>filter.updateNoliearProgressive(likelihood,0.3)>>filter.getEstimate()

Thisproducestheoutput

as=WNDistributiowithproperties:mu:2.0030sigma:0.6414

Oceagai,weobtaitheresultasawrappedormaldistributio.

UitTests

TheuittestsforlibDirectioalarelocatedithetestssubfolder.YoucaautomaticallyrualluittestsbyexecutigruLibDirectioalUitTests.Teststhatareverycomputatioallyexpesiveareskippedbydefault.YoucaeablecomputatioallyexpesivetestsbyruigruLibDirectioalUitTests(true),whichismorethoroughbuttakesmuchmoretime.

Exterals

libDrectioalreliesothefollowigexterallibraries,whicharealsoicludeditheexteralsfolder.

Eige(MPL2)fmath(BSD)mhg(GLPv2orlater)Faddeva(MIT)NoliearEstimatioToolbox(GPLv3),olytheecessarysubsetisicludediexteralsfolderTesselateS3(GPLv3)ModifiedversiosofSlepiaAlphaadSlepiaBravo(GPLv2orlater)Wiger3j(BSD)AmodifiedversiooftheRecursiveZoalEqualAreaSpherePartitioigToolbox(MIT)

Furthermore,weusethescriptcircVMcdfbyShaiRevze(GPLv3).WealsousesomecodefromlibBigham(BSD),butthislibraryisotitheexteralsfolderasolysmallpartsareused.

Licese

libDirectioalislicesedudertheGPLv3licese.

Citatio

IfyouuselibDirectioaliyourresearch,pleasecitethelibraryusigasfollows.

@Article{libdirectioal,author={GerhardKurzadIgorGilitscheskiadFloriaPfaffadLukasDrudeadUweD.HaebeckadReiholdHaeb-UmbachadRoladY.Siegwart},title={DirectioalStatisticsadFilterigUsig{libDirectioal}},year={2019},joural={JouralofStatisticalSoftware},volume={89},umber={4},pages={1--31},doi={10.18637/jss.v089.i04},}Cotact

Leadauthor:GerhardKurz

Mail:kurz.gerhard(at)gmail.com

Web:https://www.gerhardkurz.de

Cotributors:

IgorGilitscheskiFloriaPfaffLukasDrude

功能介绍

libDirectional libDirectional is a library for directional statistics as well as recursive estima...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论