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

452 Коммитов

Автор SHA1 Сообщение Дата
Tom Minka e139be6539
Added Discrete.Truncate (#446)
* Added DiscreteEstimator.Add(DiscreteEstimator)
2023-08-07 16:04:29 +01:00
Jonathan Tims f7852106ca
Change FileArray to use DataContract serialization rather than BinaryFormatter
Change FileArray to use DataContract serialization rather than BinaryFormatter
2023-07-31 15:17:05 +01:00
Jonathan Tims e26b418057
Merge branch 'main' into jotims/pr/switch-filearray-to-use-datacontract 2023-07-31 13:09:06 +01:00
Jonathan Tims c0cdc13daf
Fix typo in test scripts specifying DistributedTests
Fix typo in test scripts specifying DistributedTests
2023-07-31 13:06:12 +01:00
Jonathan Tims 88b2020d68 w 2023-07-31 13:00:56 +01:00
Jonathan Tims f58de0d67a w 2023-07-31 11:25:05 +01:00
Tom Minka 5bd86ece6b
Fixed Rand.Sample, Vector.MaxDiff and GreaterThan (#440)
* Fixed a bug in Rand.Sample that could cause it to return a value that should have zero probability.
* Added MMath.AbsDiffAllowingNaNs
* Fixed SparseVector.MaxDiff
* DependencyGraphView, ModelView, TaskGraphView implement IDisposable
* Added missing evidence methods
* Added Vector.All(Vector, Func)
2023-05-20 18:25:36 +01:00
Tom Minka 968e3b2e8a
LogisticOp and DoublePlusOp and MaxGaussianOp handle improper messages (#439)
* Added missing evidence methods
* Added ModelCompiler.UseTracingTransform
2023-04-24 19:38:33 +01:00
Tom Minka 5b7d93b1b6
Swapped arguments of IEstimatedDistribution.GetExpectation (#438)
* Added EnumerableExtensions.TakeRandom
* Added Rand.LogGamma
* Added MMath.RisingFactorialLn
* Moved GammaProbBetween to MMath
* Added missing overload of DiscreteEstimator.Add
* CSharpWriter writes nicer array initializers
* GaussianProductOpBase.AAverageConditional handles uniform Product
* Increased accuracy of TruncatedGamma.GetMeanPower
* Improved accuracy of GaussianFromMeanAndVarianceOp.VarianceAverageConditional
* Improved accuracy of Gamma.FromDerivatives and GetDerivatives
* Improved accuracy of IsBetweenGaussianOp.XAverageConditional and GammaPower.GetLogMeanPower
* Increased accuracy of MMath.GammaUpper, TruncatedGamma.GetLogProb
* Improved accuracy of MMath.GammaProbBetween
* Improved accuracy of Gamma.GetLogProb, GetLogNormalizer, GammaPower.GetLogProb
* TruncatedGamma_GetMeanPower_WithinBounds is no longer OpenBug
* GammaUpper_IsDecreasingInX is OpenBug
2023-03-25 18:07:52 +00:00
Andrii Kurdiumov 2354ca6056
Add comment to Python test project about solution config (#437) 2023-03-09 16:30:21 +00:00
Jonathan Tims cd422070bc
Fix Visualizer NuGet (#435)
# problem
The way the ".pdb" is specified currently doesn't work for projects with multiple target platforms (OutDir is not populated).

# solution
Override the way we do it for other projects, and add entries for each target platform we have.
2023-01-08 20:55:41 +00:00
Jonathan Tims b904a5beb9
Add .net6.0-windows as a target (#433)
Add .net6.0-windows as a target so that Visualizer features are available on .NET 6.0 when targeting Windows (while preserving the cross-platform net6.0 target).

I have changed our minimum .NET 4xx dependency from net462 to net472 because this is the minimum version supported by the version of the automatic graph layout package that supports net6.0-windows.

It is possible to still use net462 and in this case to use the previous version of automatic graph layout; but the increased complexity doesn't seem worth it.
2023-01-06 10:19:03 +00:00
Tom Minka ce7e42a028
Updated factor documentation (#432) 2023-01-03 13:53:38 +00:00
Tom Minka 3a11b4a1aa
Fix last change to StocAnalysisTransform (#431) 2022-12-31 20:07:44 +00:00
Anthony Puppo 26a78040c1
Add .NET 7 check to runningOnNetCore assignment (#430) 2022-12-31 16:19:33 +00:00
Tom Minka 8b7c7c54e1
Power operator and Math.Pow support a constant base variable. (#429) 2022-12-30 13:14:00 +00:00
Jonathan Tims 5105345558
Fix some causes of Arithmetic Overflow exceptions (when running with checked arithmetic) (#426)
Co-authored-by: Tom Minka <8955276+tminka@users.noreply.github.com>
2022-12-21 14:54:19 +00:00
Tom Minka fb7dbc00ac
ModelBuilder inserts checked expressions (#425)
* ModelCompiler handles checked expressions
* StocAnalysisTransform replaces constraint assignments with Constrain.Equal
* Fixed VariablePointOpBase.LogEvidenceRatio
* Fixed ConstrainEqualOp.AverageLogFactor
2022-11-11 03:06:23 +00:00
Tom Minka a4f7e2a4b8
all-compiler-options uses ReleaseFull (#424) 2022-11-07 09:48:53 +00:00
Tom Minka 88a13d8fb6
Added ClassifierModels.DenseBinaryVectorModel (#423)
* Improved accuracy of Gamma.FromDerivatives
2022-11-01 16:37:09 +00:00
Tom Minka 4d5ced56ec
EstimatedDistribution ctor doesn't wrap ITruncatableDistribution (#422) 2022-10-21 08:36:32 +01:00
Tom Minka 9eed4e8e93
Added Interval arithmetic classes (#421) 2022-10-19 12:13:34 +01:00
Tom Minka 9d4f267962
Resolve warnings (#419) 2022-09-12 21:39:48 +01:00
Pavel Myshkov 479f2f0d31
Merge pull request #418 from dotnet/pmyshkov/allow-empty-logsumexp
Return negative infinity in logsumexp on empty input
2022-09-10 14:38:27 +01:00
Pavel Myshkov d39c5863f0 Return negative infinity in logsumexp on empty input 2022-09-10 13:44:30 +01:00
Pavel Myshkov 41f829d89d
Merge pull request #417 from dotnet/pmyshkov/support-null-tostring
Support null values in PropertiesToString
2022-08-31 12:39:16 +01:00
Pavel Myshkov c01a4a4187 Support null values in PropertiesToString 2022-08-23 15:51:55 +01:00
Andrii Kurdiumov 5cedd14dc0
Update to .NET 6 (#391)
* Disable warning for usage of WebClient in Evaluator
* vmImage: windows-latest
* Adjust to new DeflateStream behaviour in .NET 6
2022-08-23 15:38:02 +01:00
Pavel Myshkov 638771287d
Remove duplicate references to FSharp.Core (#416) 2022-08-22 20:51:23 +01:00
Tom Minka 27b37fefe4
Use .NET 4.6.2 instead of 4.6.1 (#415)
* QuantileEstimator throws on NaN arguments
2022-08-22 17:09:01 +01:00
Tom Minka 96a5cd55e3
ParallelScheduler.GetMedianMinBlockSize returns NaN when schedule is empty (#413) 2022-07-27 01:06:21 +01:00
Tom Minka b4169dfaaa
Compiler handles initialized constrained variable arrays (#412)
* MMath.Max, Min, Median throw InvalidOperationException on empty sequences.
* Increased precision of MaxGaussianOp.
* InnerProductArrayOp.AAverageConditional handles innerProduct near uniform.
* MaxOfOthersOp has internal flag for Monte Carlo.
2022-07-26 21:03:32 +01:00
Ivan Korostelev 5d8f736006
Micro-optimize StringAutomaton.Product and StringTransducer.ProjectSource (#411)
In our project these 2 methods are very hot. They are near-optimal algorithmically but implementation
wasn't efficient due to use of convenient abstractions and JIT in netframework4.7.2 being not very sophisticated.
(dotnet7 optimizes original code a lot better, but due to various reasons we can't migrate to it yet).

List of micro-optimizations in no particular order:
- ReadOnlyArray<> now returns values by reference
  - It means it can't implement IReadOnlyList<> interface anymore. But it wasn't used through interface anywhere anyway
- GenerationalDictionary<> now accesses hash-table cells by reference
- GenerationalDictionary.GetOrAdd() method added which replaces 2 calls to TryGetValue()+Add()
- Automaton.Builder now manages its dynamically growing arrays on its own instead of using List<>.
  This reduces indirection and allows to access elements by reference
- Automaton.Transition.ElementDistribution is not Option<TElementDistribution> anymore. Boxing of
  element distribution into Option<> was not optimized out by JIT.
  - New API is a little less safe (because this property can be used only for non-epsilon transitions) but more efficient.
  - Transition.OptionalElementDistribution property was added for non-performance critical parts of the code.
- StringManipulator is now a struct (value type). It allows to monomorphize generic class and inline calls to its methods.
  With classes (reference types) calls had to be dynamically dispatched.
- Automaton.Product() and TransducerBase.ProjectSource() were rewritten without use of StateCollection, State
  and ReadOnlyArraySegment<> types. These types provided convenient APIs but JIT was not ablet to eliminate
  their overhead.

This PR speeds up methods mentioned in PR title by about 30%.
2022-07-22 15:13:12 +01:00
dependabot[bot] 6809c84080
Bump Newtonsoft.Json from 11.0.2 to 13.0.1 in /test/Tests (#407)
Bumps [Newtonsoft.Json](https://github.com/JamesNK/Newtonsoft.Json) from 11.0.2 to 13.0.1.
- [Release notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Commits](https://github.com/JamesNK/Newtonsoft.Json/compare/11.0.2...13.0.1)

---
updated-dependencies:
- dependency-name: Newtonsoft.Json
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-23 18:20:24 +01:00
Tom Minka 5156776f4c
Fixed DependencyAnalysisTransform and SchedulingTransform (#405) 2022-05-29 18:40:37 +01:00
Tom Minka 55d26a7138
Added Variable.ParallelCopy (#404)
* VectorGaussian.SetToRatio correctly enforces forceProper
* BeliefPropagationGateEnterPartialOp.ValueAverageConditional double-checks for conflicting values
* Added ReplicateOp_Divide_NoInit
* PlusProductHierarchyTest is OpenBug
* MatrixVectorProduct has optional check
* Deterministic gates track the number of cases
2022-05-03 22:27:20 +01:00
Tom Minka ca25068ead
WetGlassSprinklerRainModel has flexible state counts (#402)
* Expanded CausalityExample
* Variable.Dirichlet and Discrete check the array size
* IterativeProcessTransform ensures Marginal methods have unique names
* DependencyGraph.initializedEdges overrides required edges
* DependencyAnalysisTransform requires gated definitions to fully precede their uses
2022-04-08 20:14:57 +01:00
Tom Minka f008e6c719
macOS-latest (#399) 2022-03-02 22:04:11 +00:00
Tom Minka 68a10ac833
Rprop stepsize is lower bounded (#398)
Reduced the number of false "excess memory" warnings from GateTransform.
2022-03-02 21:10:46 +00:00
Tom Minka 45d2e593ba
Improved accuracy of MMath.WeightedAverage and GaussianProductOp (#395)
* RpropBufferData.EnsureConvergence = false
* GetJaggedItemsOp and GetItemsFromJaggedOp use IReadOnlyList
2022-02-16 14:58:03 +00:00
Ivan Korostelev 5b23c2c517
Micro-optimizations for sequence and collection distributions (#394)
1. Implementation of `SequenceDistribution` (of which `StringDistribution` specialization is most important)
   uses the curiously recurring template pattern (https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)
   by specifying the `TThis` template parameter. In places where `SequenceDistribution` creates new instances
   it uses the `new TThis()` which goes through the `Activator.CreateInstance<>` method which is very slow.
   To avoid this a special helper - `Util.New<T>` is introduced which uses a code generation at runtime trick:
   https://stackoverflow.com/a/1280832 which is at least an order of magnitude faster that what compiler does.
2. `CollectionElementMappingInfo.ElementMapping` is switched from List of lists to List of read only arrays.
   This brings 2 performance benefits: a) there is less indirection when reading the element mapping and
   b) the common mappings can be cached and reused now.
2022-02-11 14:52:26 +00:00
Andrii Kurdiumov 1b4c479339
.NET 5 instead of .NET Core 3.1 (#273)
* Rename netcoreapp3.1 to net5.0 in all files
* Remove references to Microsoft.NET.Sdk.WindowsDesktop
* WinForms/WPF examples use net5.0-windows
2022-01-26 13:22:26 +00:00
Tom Minka 9b28c62294
Improved support for computing derivatives (#390)
* Inferred constant variables are not inlined
* Added Factor.ProbLessThan, ProbBetween, Quantile, Integral, Apply.
* ModelCompiler handles Delegate-valued variables.
* RatioGaussianOp handles ratio instead of ProductOp.
* ExpOp_Slow and LogOp_EP can compute derivatives
* Refactored ConstantFoldingTransform out of ModelAnalysisTransform
* CodeBuilder.MethodRefExpr takes arguments.
* Added VariableInformation.NeedsMarginalDividedByPrior and CodeRecognizer.NeedsMarginalDividedByPrior
* MessageTransform does not use a distribution for the forward message of a constant.
2022-01-25 21:41:52 +00:00
Tom Minka fee27bdf93
makeApiDocs uses newer docfx version (#389)
* DefaultFactorManager allows deterministic factors to have Full support
* DefaultFactorManager puts each factor on a separate line
* docs README mentions ShowFactorManager
2022-01-11 09:42:38 +00:00
Tom Minka b6dd9630f5
DiscreteEnumAreEqualOp supports VMP (#387) 2022-01-08 18:47:02 +00:00
Tom Minka 079250ef67
Observed Beta variables support a Gamma-distributed pseudocount if the other pseudocount is always 1 (#386)
* ShowFactorManager shows more patterns
* Tidy up code
2022-01-07 18:07:48 +00:00
Jonathan Tims fc93e12851
Switch release build to pool MicroBuild2022-1ES
Switch release build to pool MicroBuild2022-1ES
2022-01-07 14:22:35 +00:00
Tom Minka 56fccb62d8
FileArray.GetTempFolder returns a folder in the current directory (#384) 2022-01-06 22:49:41 +00:00
Jonathan Tims 4b27c953d1
Switch release build to ubuntu-latest (#383)
Switch release build to ubuntu-latest (#383)
2022-01-06 22:40:41 +00:00
Sam Webster 7e49df44ca
Update compiler options pipeline (#381)
Remove clean up tasks as they are failing and not required due to switch to hosted pool build VMs
2022-01-06 12:25:12 +00:00