Граф коммитов

476 Коммитов

Автор SHA1 Сообщение Дата
Tom Minka 9cd729fd29
CopyPropagationTransform can substitute a value of different type if the context allows it (#328)
InferNet.Infer is generic.
ModelBuilder uses the correct overload of InferNet.Infer.
CodeBuilder.Method checks for correct number of arguments.
FileArray implements IReadOnlyList.
2021-03-16 15:06:59 +00:00
Tom Minka 4394af9e21
Added GetProbBetween to CanGetProbLessThan (#325)
CanGetQuantile and CanGetProbLessThan are generic.
2021-03-12 07:16:01 +00:00
Tom Minka b16f8074d4
Added MeanAccumulator and MMath.WeightedAverage (#324) 2021-03-11 18:49:31 +00:00
Tom Minka eeae7afcb5
Added TruncatedPoisson (#323)
* Added WordStrings and StringFormatTests.
* FactorManager does not allow point mass conversion of the return value argument of EP evidence methods (previously handled by MessageTransform).
* Code cleanup.  Renamed IdentityComparer to ReferenceEqualityComparer.
2021-03-05 18:29:54 +00:00
Tom Minka 3624808df0
Removed the unnecessary new() constraint on ICollectionDistribution.TransformElements and strengthened the method signature. (#321)
* GammaPower.GetProbLessThan returns 0 for x < 0
* LDA example does not use DistributionRefArray
* Updated FactorDocs
* Updated Sequential code doc
2021-02-26 00:38:53 +00:00
Tom Minka 8f3189b8e0
StringFormatOp takes IReadOnlyList (#320) 2021-02-09 15:10:29 +00:00
Tom Minka 7ae07237fe
SchedulingTransform identifies when a model with offset edges does not need iteration. (#319)
Fixed ForwardBackwardTransform.
2021-02-09 00:40:02 +00:00
Ivan Korostelev ac0c035bb9
Micro-optimizations for string distributions (#317)
* Enumerating support of distribution does not require it to be normalized unless determinization is requested.
   Avoiding doing this speeds up enumerating some auotomata 10x.
* states of `EpsilonClosure` can be stored in plain array instead of list. This minor change speeds up epsilon
   closure operations by 20% due to one less level of indirection and better memory allocation.
2021-02-08 14:19:42 +00:00
Ivan Korostelev 429b4debe7
Reimplement EnumerateSupport() (#315)
Previous version was correct but had a pathalogical (exponential) runtime for some forms of automata
with multiple branches with epsilon transitions. Also code was unneccessary complex, because it tried
to compute unreachable states in presence of loops.

Specific changes in this PR:
- `EnumerateSupport` implementation was moved into its own file - `Automaton.EnumerateSupport`
- `ComputeEndStateReachability` method has been resurrected. It is invoked only if loops are detected
   In all other cases, it is trivial to check for end-state reachability during normal traversal
- Traversal loop has been split in steps, some of which were moved into their own local methods.
- Fast path for non-branchy part of automaton was implemented.
2021-02-08 12:06:09 +00:00
Tom Minka b34f76f193
Channel2Transform creates unique array names (#316)
Removed Cancels attribute from PowerPlateOp.EnterAverageConditional
Sum_Expanded handles an empty array.
Dirichlet.GetMean handles zero pseudo-counts.
Moved TrueSkill tests into TrueSkillTests.
2021-02-04 08:10:25 +00:00
Tom Minka 9235b1732c
Added Python versions of string tutorials (#313) 2021-01-21 13:05:40 +00:00
Tom Minka 0c75b5ef41
Basic support for difference of Beta-distributed variables (#309) 2021-01-05 00:34:00 +00:00
Tom Minka 920e3facbc
DoubleIsBetweenOp with random bounds is more accurate (#306) 2020-12-23 23:07:54 +00:00
Tom Minka 9b79818034
Update motif finder example (#304)
* Motif Finder uses SequenceCount = 70
* DiscreteFromDirichletOp.ProbsAverageConditional handles PiecewiseVector
* GammaPower.FromLogMeanMinusMeanLog handles infinite mean and negative power
2020-11-27 11:12:31 +00:00
Tom Minka 3baf283b6f
Fixed ExpOp with point mass arguments (#303)
* Added Gamma.GetLogMeanMinusMeanLog and FromLogMeanMinusMeanLog
2020-11-23 22:02:32 +00:00
Tom Minka 69a7a1979f
Improved convergence rate of GammaPower.FromMeanAndMeanPower (#301)
* Improved accuracy of ExpOp.ExpAverageConditional
* Tutorials project uses Unicode OutputEncoding
* Fixed MethodBodySynthesizer
2020-11-18 23:44:47 +00:00
Tom Minka dcc3503b7d
Fixed TruncatedGaussian.SetToRatio (#300)
* Improved accuracy of GammaPower.FromMeanAndMeanLog, ExpOp, ExpOp_Slow
* Added MMath.DigammaInv
2020-11-11 08:01:47 +00:00
Tom Minka b3d4436e1f
Generated code uses .NET arrays where possible (#298)
* Improved accuracy of Gamma.FromMeanAndMeanLog, ExpOp, PlusGammaOp, PlusGammaVmpOp
* Fixed GammaPower.SetMeanAndVariance for infinite variance
* TruncatedGamma implements CanGetQuantile
* TruncatedGamma.Sample is faster when shape==1
* Extracted PlusWrappedGaussianOp and PlusTruncatedGaussianOp from PlusDoubleOp
* Gamma.FromMeanAndMeanLog takes an optimal logMean argument.  Removed Gamma.FromLogMeanAndMeanLog.
* Improved accuracy of GammaPower.FromMeanAndMeanLog.
* ExpOp supports GammaPower output.
2020-10-29 19:21:12 +00:00
Jonathan Tims 0be0aefe1d
Rename ImmutableArray to ReadOnlyArray (#293) 2020-09-30 18:54:20 +01:00
Jonathan Tims 568cb96cda
QuantileEstimator stores its random number generator (#291)
This allows QuantileEstimator to produce the same result even if it is serialized/deserialized in the middle.
2020-09-25 15:42:09 +01:00
Tom Minka f1c9073776
MethodInvoke.CanBeInlined returns true for more cases (#292)
* Tests use Assert.Throws instead of try/catch

* Test output is less verbose

* Added SimplestBackwardChainTest3

* Fixed IterativeProcessTransform when variable has QueryTypes.MarginalDividedByPrior and ConstrainEqualRandom(variable, observed)

* Discrete allows Dimension=0
2020-09-24 21:38:30 +01:00
msdmkats e167ce18f3
Use ulp-based constants (#289)
* Fix long overflow in OperatorTests.Longs()

* Fixed printing big float arrays, extended series for ((exp(x) - 1) / x - 1) - 0.5

* GammaPower.GetLogProb uses ulp-based threshold

* Moved a constant for maximum terms in NormalCdfMomentRatio outside of method body

* Separate methods for Previous/NextDoubleWithPositiveDifference

* More magic constants replaced with ulp-based ones

* Fixed abs value comparison in GammaPower.GetLogProb

* Ulp-based constatnts in IsBetween.XAverageConditional

* Moved the definitions of Ulp1-dependant constants below that of Ulp1

* Replaced  <= in GammaPower with a < as it used to be

Co-authored-by: Dmitry Kats <ratkillerx@hotmail.com>
2020-09-15 10:18:21 +01:00
Tom Minka 9ca3230018
Update URL for BookCrossing dataset (#288)
* Added Matrix.FromDiagonal
2020-09-09 23:54:45 +01:00
Tom Minka 2e03d713b9
Fixed Binomial.GetLogProb and Gamma.GetLogNormalizer (#287)
* Removed references to NETFULL.
* Don't define NET45.
* Don't define NETCORE, NETSTANDARD, or NETSTANDARD2_0
2020-09-08 13:39:12 +01:00
Andrii Kurdiumov 52cc9b2c78
LDA and RobustGaussianProcess support .NET Core (#286)
* Add more generated files to exclusion list
* RobustGaussianProcess uses OxyPlot.Wpf only on Windows

Co-authored-by: Tom Minka <8955276+tminka@users.noreply.github.com>
2020-09-08 11:46:38 +01:00
Andrii Kurdiumov bc953687bf
TestFSharp uses .NET 4.7.2 (#285)
This is required for .NET 5 support as explained at https://github.com/dotnet/fsharp/issues/10009#issuecomment-681019355
2020-09-01 16:22:40 +01:00
Andrii Kurdiumov bd90da2b8b
Update year of copyright (#283) 2020-08-27 15:22:30 +01:00
Andrii Kurdiumov 37ec4b0918
Improve .NET Core detection (#281)
In .NET 5, the framework description string is ".NET 5.0.0" and should not use the CodeDom compiler.
2020-08-27 12:44:37 +01:00
Andrii Kurdiumov 42b560dcbb
Documentation refers to Core 3.1 instead of Core 2.1 (#282) 2020-08-27 12:34:48 +01:00
Tom Minka 6186fff2a6
Better handling of Sequential attribute (#279)
IncrementTransform handles GetJaggedItemsOp and GetDeepJaggedItemsOp.
IndexingTransform gives a warning for unimplemented cases instead of throwing.
Improved code doc for Damp functions.
Changed "#if HAS_BINARY_FORMATTER" to "#if NETFULL"
Removed Assert.Timeout from performance tests
2020-08-26 14:47:32 +01:00
Andrii Kurdiumov 90607a287f
Add configuration required to embedding pictures in the resources (#277)
Uses version 4.6.0 of System.Resources.Extensions as explained at https://github.com/dotnet/msbuild/issues/4704#issuecomment-648967397

Co-authored-by: Tom Minka <8955276+tminka@users.noreply.github.com>
2020-08-25 17:35:52 +01:00
Andrii Kurdiumov 4e2ecb17e9
Put binary formatter usage behind define (#276)
This is required to be able support code on .NET 5.0 where this code would be obsolete.
2020-08-25 16:33:21 +01:00
Andrii Kurdiumov 17fbd5f078
Disable warning using #pragma (#275) 2020-08-25 15:26:06 +01:00
Andrii Kurdiumov 2ebf99a950
Use WindowsDesktop SDK to bring Windows Forms and WPF into project. (#234)
ClickThroughModel can run with .NET core (when explicitly built)
2020-08-24 14:52:30 +01:00
Tom Minka f72fe0f846
Improved accuracy of FastSumOp (#272)
* ModelCompiler.IncludeDebugInformation defaults to false

* Fixed TestFSharp.fsproj
2020-08-22 17:02:25 +01:00
msdmkats 980f1e2513
Fixes for RoslynDeclarationProvider and Conversion.TryFindConversion (#271)
* RoslynDeclarationProvider uses all available source codes
to build the requested type declaration.

* Conversion.TryFindConversion looks for casts defined on the toType as
well.

Co-authored-by: Dmitry Kats <ratkillerx@hotmail.com>
2020-08-13 16:47:59 +01:00
Tom Minka 421507bb6e
Update to xUnit 2.4.1 (#265)
* Update build instructions
2020-07-26 22:07:20 +01:00
Tom Minka 82bfc893ed
Ported tutorial code to Python (#264)
* Added TestPython project.
* TestFSharp exposes xUnit tests.
* Added Invoker.InvokeInstance.  Invoker favors overloads with higher array indexing depth.
* Added EpTests.LinearProgrammingTest.
* Updated FSharp.Core, Msagl
* pr-netcore.yml uses latest version of .NET 3.1 instead of exact version
* UseDotNet task
* Updated versions of YAML tasks
* netcoretest.sh uses "dotnet test"
2020-07-26 07:08:10 +01:00
Tom Minka 032372ce36 StringUtil.EscapeXmlCharacters replaces StringUtil.MethodFullNameToXmlString
Removed Visualizers/Windows/FactorManagerView
Fixed MslTests.MethodOverrideTest
Added MslTests.MethodInAnotherFileTest
2020-07-22 19:43:51 +01:00
Tom Minka b94260d87e Added GammaPowerProductOp_LaplaceTest 2020-07-09 06:24:24 +01:00
Tom Minka dbda600379 MMath.DigammaLookup and MMath.NormalCdfMomentRatioTable are Lazy 2020-07-09 06:24:24 +01:00
Tom Minka 659b224ce7 Avoid overflow 2020-07-07 15:29:20 +01:00
Tom Minka a3af197dd8 InferenceEngine.SaveFactorGraphToFolder uses correct path on Unix 2020-06-18 21:31:12 +01:00
Tom Minka 4f824e4c23
More special functions improvements (#254)
Removed c_digamma_small case from MMath.Digamma
Added tests for MMath.GammaLnSeries and XMinusLog1Plus
GenerateSeries also generates error bounds
Added CheckMathLibraries
2020-05-28 18:32:55 +01:00
msdmkats c6f896cfbf
Special functions improvements (#253)
- Ensured argument consistency in NormalCdfIntegralTest
- Fixed some test values
- Exp-Sinh quadrature in LogisticGaussian
- Arithmetic-precision-based constants in logistic gaussian
- Named const for Ulp(1)
- Generating series for gamma(x) - 1/x
- Fixed integer overflow in BGRat
- GenerateSeries can print arrays of bigfloats.
2020-05-27 18:19:16 +03:00
Tom Minka 804c8cc83d
NormalCdfRatioLn tests work correctly in arbitrary precision (#250) 2020-05-21 12:54:48 +01:00
Tom Minka 9affe7f082
Updated ComputeSpecialFunctionsTestValues.py (#248)
ComputeSpecialFunctionsTestValues.py computes more accurate test values, uses pure mpmath, more reliable quadrature. Computes values for NormalCdfRatioLn. Removed hard-coded cases.
MMath.Log1PlusExp uses a threshold based on machine epsilon.
2020-05-15 22:20:47 +01:00
Tom Minka 8aa4fbf2fc
Moved ExtendedDouble to the Microsoft.ML.Probabilistic.Math namespace (#246)
Added FloatTests
2020-05-12 18:30:49 +01:00
Tom Minka 4a6cbbaf8e
Fixed more corner cases in MMath.LogisticGaussian (#245) 2020-05-08 14:00:47 +01:00
Tom Minka cc60de338b
Fixed MMath.LogisticGaussian corner case (#244) 2020-05-07 01:14:49 +01:00