Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation of IncludeWorkflows #40

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added descriptions to workflows and properties
  • Loading branch information
ncguilbeault committed Jan 20, 2025
commit 3b875036a02e35709a54224cc10be2d198daacbd
4 changes: 2 additions & 2 deletions src/Bonsai.ML.HiddenMarkovModels/CheckFitFinished.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
xmlns:p1="clr-namespace:Bonsai.ML;assembly=Bonsai.ML"
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Periodically evaluates the `get_fit_finished` function of the HMM. Returns a boolean value representing the objects `fit_finished` attribute. This should onle be used in a state after the `RunFitAsync` function has already been started.</Description>
<Description>Periodically evaluates the `get_fit_finished` function of the HMM. Returns whether the `fit_finished` attribute is true. This should only be used after the `RunFitAsync` function has already been started.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
<Property Name="TimerFrequency" DisplayName="TimerFrequency" Description="The frequency with which to check if the asynchronous fit loop is complete." Category="Polling" />
</Expression>
<Expression xsi:type="rx:SelectMany">
Expand Down
14 changes: 7 additions & 7 deletions src/Bonsai.ML.HiddenMarkovModels/CreateHMM.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
xmlns:p2="clr-namespace:Bonsai.ML.HiddenMarkovModels;assembly=Bonsai.ML.HiddenMarkovModels"
xmlns:py="clr-namespace:Bonsai.Scripting.Python;assembly=Bonsai.Scripting.Python"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Creates a new HMM python object inside of the HMM module and assigns it to a named python variable.</Description>
<Description>Creates a new HMM Python object inside of the HMM module and assigns it to a named Python variable.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:CreateModelReference">
Expand All @@ -27,11 +27,11 @@
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="NumStates" Description="The number of discrete latent states of the HMM model." />
<Property Name="Dimensions" Description="The dimensionality of the observations into the HMM model." />
<Property Name="ObservationsModelType" Description="The type of distribution that the HMM will use to model the emission of data observations." />
<Property Name="StateParameters" Description="The optional state parameters of the HMM model. If an observations model or transitions model is defined within the state parameters, they will override the values set in the observations model type and transitions model type properties, respectively." />
<Property Name="TransitionsModelType" Description="The type of transition model that the HMM will use to calculate the probabilities of transitioning between states."/>
<Property Name="NumStates" Description="The number of discrete latent states in the HMM." />
<Property Name="Dimensions" Description="The dimensionality of the observations going into the HMM." />
<Property Name="ObservationModelType" Description="The type of distribution that the HMM will use to model the emission of data observations." />
<Property Name="StateParameters" Description="The optional state parameters of the HMM. If an observation model or transition model is defined within the state parameters, these will override the values set in the observation model type and transition model type properties, respectively." />
<Property Name="TransitionModelType" Description="The type of model that the HMM will use to calculate the probabilities of transitioning between states."/>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:ModelParameters">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:p2="clr-namespace:Bonsai.ML.HiddenMarkovModels.Observations;assembly=Bonsai.ML.HiddenMarkovModels"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Computes the statistics of the Gaussian observations in the HMM model. Only works for models with Gaussian observations.</Description>
<Description>Computes the statistics of the Gaussian observations in the HMM. Only works for models with Gaussian observations.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand All @@ -17,7 +17,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>hmm</Name>
Expand Down
4 changes: 2 additions & 2 deletions src/Bonsai.ML.HiddenMarkovModels/InferState.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:p2="clr-namespace:Bonsai.ML.HiddenMarkovModels;assembly=Bonsai.ML.HiddenMarkovModels"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Infers the state of the HMM model given the observations.</Description>
<Description>Infers the state of the HMM given the observations.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand All @@ -16,7 +16,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>hmm</Name>
Expand Down
8 changes: 4 additions & 4 deletions src/Bonsai.ML.HiddenMarkovModels/ModelParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class ModelParameters : PythonStringBuilder
private StateParameters stateParameters = null;

/// <summary>
/// The number of states of the HMM model.
/// The number of discrete latent states in the HMM model.
/// </summary>
[Description("The number of discrete latent states of the HMM model.")]
[Description("The number of discrete latent states in the HMM.")]
[Category("ModelSpecification")]
public int NumStates
{
Expand All @@ -44,9 +44,9 @@ public int NumStates
}

/// <summary>
/// The dimensionality of the observations into the HMM model.
/// The dimensionality of the observations going into the HMM.
/// </summary>
[Description("The dimensionality of the observations into the HMM model.")]
[Description("The dimensionality of the observations going into the HMM.")]
[Category("ModelSpecification")]
public int Dimensions
{
Expand Down
8 changes: 4 additions & 4 deletions src/Bonsai.ML.HiddenMarkovModels/RunFitAsync.bonsai
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
xmlns:p1="clr-namespace:Bonsai.ML;assembly=Bonsai.ML"
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Runs the asynchronous fit loop of the HMM model.</Description>
<Description>Runs the asynchronous fit loop of the HMM.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Value" DisplayName="BatchSize" Description="The size of the batch of data to use for fitting the model." Category="TrainingData" />
<Property Name="Value" DisplayName="BatchSize" Description="The size of the batch used for fitting the model." Category="TrainingData" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="IntProperty">
Expand Down Expand Up @@ -48,7 +48,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>hmm</Name>
Expand All @@ -65,7 +65,7 @@
</Combinator>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Value" DisplayName="NumIterations" Description="The number of iterations to use for fitting the model to a single batch of data." Category="Hyperparameters" />
<Property Name="Value" DisplayName="NumIterations" Description="The number of iterations used for fitting the model to a single batch of data." Category="Hyperparameters" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="IntProperty">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
xmlns:p2="clr-namespace:Bonsai.ML.LinearDynamicalSystems.Kinematics;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns:py="clr-namespace:Bonsai.Scripting.Python;assembly=Bonsai.Scripting.Python"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Creates a Kalman filter model for kinematics estimation based on the discrete Weiner process acceleration model.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p1:CreateModelReference" />
Expand All @@ -24,17 +25,17 @@
<Name>Source1</Name>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Fps" Category="ModelParams" />
<Property Name="Pos_x0" Category="ModelParams" />
<Property Name="Pos_y0" Category="ModelParams" />
<Property Name="Vel_x0" Category="ModelParams" />
<Property Name="Vel_y0" Category="ModelParams" />
<Property Name="Acc_x0" Category="ModelParams" />
<Property Name="Acc_y0" Category="ModelParams" />
<Property Name="Sigma_a" Category="ModelParams" />
<Property Name="Sigma_x" Category="ModelParams" />
<Property Name="Sigma_y" Category="ModelParams" />
<Property Name="Sqrt_diag_V0_value" Category="ModelParams" />
<Property Name="Fps" Description="The frames per second of the observations." Category="ModelParams" />
<Property Name="Pos_x0" Description="The initial x position." Category="ModelParams" />
<Property Name="Pos_y0" Description="The initial y position." Category="ModelParams" />
<Property Name="Vel_x0" Description="The initial x velocity." Category="ModelParams" />
<Property Name="Vel_y0" Description="The initial y velocity." Category="ModelParams" />
<Property Name="Acc_x0" Description="The initial x acceleration." Category="ModelParams" />
<Property Name="Acc_y0" Description="The initial y acceleration." Category="ModelParams" />
<Property Name="Sigma_a" Description="A scalar value representing the measurement noise." Category="ModelParams" />
<Property Name="Sigma_x" Description="A scalar value representing the prediction noise along the x axis." Category="ModelParams" />
<Property Name="Sigma_y" Description="A scalar value representing the prediction noise along the y axis." Category="ModelParams" />
<Property Name="Sqrt_diag_V0_value" Description="The initial value of the diagonal of the state covariance matrix." Category="ModelParams" />
Comment on lines +28 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general in Bonsai / C# we would use Pascal casing rather than snake case, but no need to change anything now, this is just a general comment for us to think about regarding casing of properties coming from Python.

</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="p2:KFModelParameters">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p1="clr-namespace:Bonsai.ML.LinearDynamicalSystems.Kinematics;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Creates a 2 dimensional object with the properties X and Y from the input.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:p2="clr-namespace:Bonsai.ML.LinearDynamicalSystems.Kinematics;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Performs forecasting on the LDS kinematics model.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand All @@ -15,7 +16,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>model</Name>
Expand All @@ -24,7 +25,7 @@
<Selector>Name</Selector>
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Value" DisplayName="Timesteps" />
<Property Name="Value" DisplayName="Timesteps" Description="The number of timesteps to forecast into the future." Category="ForecastParameters"/>
</Expression>
<Expression xsi:type="Combinator">
<Combinator xsi:type="IntProperty">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:p2="clr-namespace:Bonsai.ML.LinearDynamicalSystems;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns:p3="clr-namespace:Bonsai.ML.LinearDynamicalSystems.Kinematics;assembly=Bonsai.ML.LinearDynamicalSystems"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Performs inference on the LDS kinematics model.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand All @@ -16,7 +17,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the Python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>model</Name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
xmlns:scr="clr-namespace:Bonsai.Scripting.Expressions;assembly=Bonsai.Scripting.Expressions"
xmlns="https://bonsai-rx.org/2018/workflow">
<Description>Periodically evaluates the `get_optimization_finished` function of the LDS model. Returns whether the `optimization_finished` attribute is true. This should only be used after the `RunOptimizationAsync` function has already been started.</Description>
<Workflow>
<Nodes>
<Expression xsi:type="WorkflowInput">
Expand All @@ -15,7 +16,7 @@
<Combinator xsi:type="py:ObserveOnGIL" />
</Expression>
<Expression xsi:type="ExternalizedMapping">
<Property Name="Name" DisplayName="Name" Category="ModelReference" />
<Property Name="Name" DisplayName="Name" Description="The name of the python variable referencing the model object." Category="ModelReference" />
</Expression>
<Expression xsi:type="SubscribeSubject" TypeArguments="p1:ModelReference">
<Name>model</Name>
Expand Down
Loading