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

177 finish kalman tutorial #178

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

the-other-james
Copy link
Contributor

Updates the Kalman filter tutorial example. Closes #177

The tutorial now shows what the Kalman filter plugin is doing, the data flow of the Kalman example, and steps the user through writing their own plugin to scream when something goes wrong (in the data).

Copy link
Contributor

@asgibson asgibson left a comment

Choose a reason for hiding this comment

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

Great job overall. This should go a long way to helping people get familiar with using OnAIR. I was able to follow it and implement with expected results.


You can see that there is now a KnowledgeRep plugin, Kalman Filter: this plugin will see the low-level data frame and use it to build up higher level information.
In this case, a list of telemetry points that have violated their Kalman filter prediction for a time step.
There is also a Learners plugin, csv output: normally a learner would use both the low-level data and the higher level information from the Knowledge Representation to TODO.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the TODO still here by design?

Comment on lines +163 to +164
The Kalman Plugin [kalman_plugin.py](../onair/plugins/kalman/kalman_plugin.py) is an [`AIPlugin`](../onair/src/ai_components/ai_plugin_abstract/ai_plugin.py) which requires two functions: `update` and `render_reasoning`.
`AIPlugin` also defines an `__init__` function which stores the plugin name and a list of names of the telemetry points in the low level data (called "headers").
Copy link
Contributor

Choose a reason for hiding this comment

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

We should mention inheritance here. It does say 'is an' but specifically mentioning inheritance would make it clear. We should also state that AIPlugin is an abstract class as this is the first mention of AIPlugin in the tutorial. This helps explain how a plugin is required to implement the functions and gain the base __init__.

ComplexPluginDict = {}
```

Note: you can set plugins to be blank or the 'generic' empty plugin.
Copy link
Contributor

Choose a reason for hiding this comment

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

I do not understand the note.


Note: you can set plugins to be blank or the 'generic' empty plugin.

You can see that there is now a KnowledgeRep plugin, Kalman Filter: this plugin will see the low-level data frame and use it to build up higher level information.
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest changing 'now' to 'currently', but only because as this is the tutorial using of the word 'now' makes it feel as though we should have just changed something (although there was no direction to have done so).

When it drops to 2.0, "CURRENT" is added to the output from the Kalman plugin.
This happens again when the current jumps again from 3.0 to 5.0.

Note: not every telemetry point flagged by the Kalman filter is idicative of a fault, some are false positives.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we provide a rationale as to why this note is true?


## Write a New Plugin

Now we are going to write a new plugin to "scream" every time a tlemetry point has been marked as broken by the Kalman plugin.
Copy link
Contributor

Choose a reason for hiding this comment

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

misspelling of telemetry

Next, the plugin checks the Kalman plugins rendered output (`high_level_data['vehicle_rep']['Kalman Filter']` is the list returned by the Kalman plugin's `render_reasoning` function).
If something is there, the scream plugin will, well scream about it.

When you run your scream example, you should now see the following amoung the output:
Copy link
Contributor

Choose a reason for hiding this comment

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

misspelling of among

First we check that the high level data does in fact have an entry named "Kalman Filter", which is the name of the Kalman plugin in the config file.

Next, the plugin checks the Kalman plugins rendered output (`high_level_data['vehicle_rep']['Kalman Filter']` is the list returned by the Kalman plugin's `render_reasoning` function).
If something is there, the scream plugin will, well scream about it.
Copy link
Contributor

Choose a reason for hiding this comment

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

I appreciate the funny! You may want a comma after well, or maybe ellipsis it, well... or, if not keeping the joke, just remove the well entirely.

pass
```

We do everything in the `update` function since scream doesn't actually have anything useful to pass on to other plugins.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because a Complex Reasoner plugin does its update and render_reasoning in succession? We may want to offer more of an explanation of why this was chosen for the tutorial to allay any misunderstanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finish Kalman tutorial
2 participants