Skip to content

Commit

Permalink
Merge branch 'main-upstream' into lds-timeseries-visualizers
Browse files Browse the repository at this point in the history
  • Loading branch information
ncguilbeault committed May 22, 2024
2 parents be3923a + 26c0624 commit 3414465
Show file tree
Hide file tree
Showing 22 changed files with 1,590 additions and 49 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
workflow_call:

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
submodules: true

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Restore NuGet Packages
run: msbuild -t:restore src/Bonsai.ML.sln

- name: Build Solution
run: msbuild src/Bonsai.ML.sln /p:Configuration=Release
17 changes: 3 additions & 14 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,16 @@ on:
workflow_dispatch:

jobs:
build:
build_docs:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
with:
submodules: true
- name: Build Solution
uses: ./.github/workflows/build.yml

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 7.x

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2

- name: Restore NuGet Packages
run: msbuild -t:restore src/Bonsai.ML.sln

- name: Build Solution
run: msbuild src/Bonsai.ML.sln /p:Configuration=Release

- name: Setup DocFX
run: dotnet tool restore
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The Bonsai.ML project is a collection of packages with reactive infrastructure f
* Bonsai.ML - provides core functionality across all Bonsai.ML packages.
* Bonsai.ML.LinearDynamicalSystems - package for performing inference of linear dynamical systems. Interfaces with the [lds_python](https://github.com/joacorapela/lds_python) package.
- *Bonsai.ML.LinearDynamicalSystems.Kinematics* - subpackage included in the LinearDynamicalSystems package which supports using the Kalman Filter to infer kinematic data.
- *Bonsai.ML.LinearDynamicalSystems.LinearRegression* - subpackage included in the LinearDynamicalSystems package which supports using the Kalman Filter to perform Bayesian linear regression.
* Bonsai.ML.Visualizers - provides a set of visualizers for dynamic graphing/plotting.

> [!NOTE]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>A Bonsai package for implementing the Kalman Filter using python.</Description>
<PackageTags>Bonsai Rx ML KalmanFilter LinearDynamicalSystems</PackageTags>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<Version>0.1.0</Version>
<Version>0.2.0</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Bonsai.Core" Version="2.8.1" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p1="clr-namespace:Bonsai.ML.LinearDynamicalSystems.LinearRegression;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns:p2="clr-namespace:Bonsai.ML.LinearDynamicalSystems;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:py="clr-namespace:Bonsai.Scripting.Python;assembly=Bonsai.Scripting.Python"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="LikelihoodPrecisionCoefficient" Category="Parameters" />
<Property Name="PriorPrecisionCoefficient" Category="Parameters" />
<Property Name="NumFeatures" Category="Parameters" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="X" Category="ModelState" />
<Property Name="P" Category="ModelState" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:KFModelParameters">
<p1:LikelihoodPrecisionCoefficient>25</p1:LikelihoodPrecisionCoefficient>
<p1:PriorPrecisionCoefficient>2</p1:PriorPrecisionCoefficient>
<p1:NumFeatures>2</p1:NumFeatures>
</Combinator>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" Category="ModelReference" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:CreateModelReference">
<p2:Name>model</p2:Name>
</Combinator>
</Expression>
<Expression xsi:type="rx:BehaviorSubject">
<Name>model</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Name</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:Zip" />
</Expression>
<Expression xsi:type="rx:Sink">
<Name>InitModel</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="Format">
<Format>{0} = KalmanFilterLinearRegression({1})</Format>
<Selector>it.Item2, it.Item1</Selector>
</Expression>
<Expression xsi:type="InputMapping">
<PropertyMappings>
<Property Name="Script" Selector="it" />
</PropertyMappings>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>LDSModule</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Module" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="py:Exec">
<py:Script>model = KalmanFilterLinearRegression(likelihood_precision_coef=25, prior_precision_coef=2, n_features=2, x=None, P=None)</py:Script>
</Combinator>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="6" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="5" To="6" Label="Source2" />
<Edge From="6" To="7" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Item1</Selector>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="3" Label="Source1" />
<Edge From="1" To="3" Label="Source2" />
<Edge From="2" To="3" Label="Source3" />
<Edge From="3" To="8" Label="Source1" />
<Edge From="4" To="5" Label="Source1" />
<Edge From="4" To="6" Label="Source2" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="7" Label="Source1" />
<Edge From="7" To="8" Label="Source2" />
<Edge From="8" To="9" Label="Source1" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:py="clr-namespace:Bonsai.Scripting.Python;assembly=Bonsai.Scripting.Python"
xmlns:p1="clr-namespace:Bonsai.ML.LinearDynamicalSystems;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:p2="clr-namespace:Bonsai.ML.LinearDynamicalSystems.LinearRegression;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns="https://bonsai-rx.org/2018/workflow">
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>model</Name>
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Name</Selector>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="MemberSelector">
<Selector>Item2</Selector>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="X0" Category="GridParameters" />
<Property Name="X1" Category="GridParameters" />
<Property Name="XSteps" Category="GridParameters" />
<Property Name="Y0" Category="GridParameters" />
<Property Name="Y1" Category="GridParameters" />
<Property Name="YSteps" Category="GridParameters" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:GridParameters">
<p2:X0>-1</p2:X0>
<p2:X1>1</p2:X1>
<p2:XSteps>100</p2:XSteps>
<p2:Y0>-1</p2:Y0>
<p2:Y1>1</p2:Y1>
<p2:YSteps>100</p2:YSteps>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="rx:WithLatestFrom" />
</Expression>
<Expression xsi:type="rx:Sink">
<Name>PDF</Name>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="Format">
<Format>{0}.pdf({1})</Format>
<Selector>it.Item1, it.Item2</Selector>
</Expression>
<Expression xsi:type="InputMapping">
<PropertyMappings>
<Property Name="Script" Selector="it" />
</PropertyMappings>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>LDSModule</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Module" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="py:Exec">
<py:Script>model.pdf(x0=-1, x1=1, xsteps=100, y0=-1, y1=1, ysteps=100)</py:Script>
</Combinator>
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="2" Label="Source1" />
<Edge From="2" To="5" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source2" />
<Edge From="5" To="6" Label="Source1" />
</Edges>
</Workflow>
</Expression>
<Expression xsi:type="InputMapping">
<PropertyMappings>
<Property Name="VariableName" Selector="it.Item1" />
</PropertyMappings>
</Expression>
<Expression xsi:type="SubscribeSubject">
<Name>LDSModule</Name>
</Expression>
<Expression xsi:type="PropertyMapping">
<PropertyMappings>
<Property Name="Module" />
</PropertyMappings>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="py:Get">
<py:VariableName>model</py:VariableName>
</Combinator>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:MultivariatePDF" />
</Expression>
<Expression xsi:type="WorkflowOutput" />
</Nodes>
<Edges>
<Edge From="0" To="1" Label="Source1" />
<Edge From="1" To="5" Label="Source1" />
<Edge From="2" To="3" Label="Source1" />
<Edge From="3" To="4" Label="Source1" />
<Edge From="4" To="5" Label="Source2" />
<Edge From="5" To="6" Label="Source1" />
<Edge From="6" To="9" Label="Source1" />
<Edge From="7" To="8" Label="Source1" />
<Edge From="8" To="9" Label="Source2" />
<Edge From="9" To="10" Label="Source1" />
<Edge From="10" To="11" Label="Source1" />
<Edge From="11" To="14" Label="Source1" />
<Edge From="12" To="13" Label="Source1" />
<Edge From="13" To="14" Label="Source2" />
<Edge From="14" To="15" Label="Source1" />
<Edge From="15" To="16" Label="Source1" />
</Edges>
</Workflow>
</WorkflowBuilder>
Loading

0 comments on commit 3414465

Please sign in to comment.