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

[WIP] AILab: Predict panel #37826

Closed
wants to merge 20 commits into from
Closed

[WIP] AILab: Predict panel #37826

wants to merge 20 commits into from

Conversation

Erin007
Copy link
Contributor

@Erin007 Erin007 commented Nov 12, 2020

This is the beginning of an App Lab component internally called the Predict Panel.

We wanted a way to use a trained model, saved out of AI Lab, in App Lab, without the student having to spend a lot of time constructing a form UI. The Predict Panel takes care of rendering the form that is used to then do a prediction using that trained model.

The Predict Panel itself is a UI component that can be added to a screen in design mode:

Screen Shot 2020-12-18 at 11 21 25 AM

The panel offers two event code stubs that can be added to the student's program:

Screen Shot 2020-12-18 at 11 21 39 AM

The panel offers a property for the model ID:

Screen Shot 2020-12-18 at 11 21 46 AM

Clicking "Choose..." (above) pops up a modal which enumerates the current user's trained models that were saved in AI Lab:

Screen Shot 2020-12-18 at 11 21 52 AM

The student can fill out the event code stubs to both initialise the Predict Panel and be notified when a prediction has been made:

Screen Shot 2020-12-18 at 11 23 17 AM

When the program is run, the Predict Panel takes a moment to retrieve the trained model, and then presents a form with the appropriate dropdowns/inputs and a "Predict" button:

Screen Shot 2020-12-18 at 11 23 39 AM

And when the "Predict" button is pressed, the student's code is called, and the prediction can be processed:

Screen Shot 2020-12-18 at 11 23 51 AM

@Erin007 Erin007 changed the title Predict panel [WIP] Predict panel Nov 12, 2020
@Erin007
Copy link
Contributor Author

Erin007 commented Dec 2, 2020

@madelynkasula and @JillianK can you take a look at this WIP, please? I've started down a path but I'm not sure it's the best one. I don't know the best way to get info in and out of the App Lab code - the applab redux? - to use to make api calls related to this new design element. The overall idea is:

1.) User drags out a Predict Panel element
2.) The user selects from a dropdown of all of their saved machine learning models in the properties panel
3.) Based on that selection, we get the metadata we need to generate input boxes that match the test data format.
4.) Within the App Lab app the user inputs data into the generated Predict Panel form and clicks predict
5.) We take the test data inputs and feed them into the machine learning model that we fetch from s3
6.) The pre-trained model returns a prediction
7.) That prediction makes its way back into the App Lab app where the student can use it

selectedId: state.mlModelDetails.modelId
}),
dispatch => ({
setMLModelId(modelId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if you go down the redux route you'll need another param to distinguish which predict panel you're updating in case a student adds more than one to their app.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to jillian's comment. however, is there a reason we want/need to use redux to store this state? it looks like the existing design elements store their state in the component rather than redux.

if only <PropertyRow/> and <MLModelSelectorRow/> need to access this state, i'd have PropertyRow manage the state and pass it as props into MLModelSelectorRow

<PropertyRow
desc={'model id'}
initialValue={elementUtils.getId(element)}
handleChange={this.props.handleChange.bind(this, 'model id')}
Copy link
Contributor

@JillianK JillianK Dec 2, 2020

Choose a reason for hiding this comment

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

You probably want to add a switch case for this change in the updateProperty function. That function is also another option for where to make the API call/dispatch redux action or somewhere in here which is the handleChange that is being referenced here

apps/src/applab/DesignToolbox.jsx Outdated Show resolved Hide resolved
selectedId: state.mlModelDetails.modelId
}),
dispatch => ({
setMLModelId(modelId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to jillian's comment. however, is there a reason we want/need to use redux to store this state? it looks like the existing design elements store their state in the component rather than redux.

if only <PropertyRow/> and <MLModelSelectorRow/> need to access this state, i'd have PropertyRow manage the state and pass it as props into MLModelSelectorRow

@breville breville changed the title [WIP] Predict panel [WIP] AILab: Predict panel Dec 18, 2020
@Erin007
Copy link
Contributor Author

Erin007 commented Jan 21, 2021

change of plans! the ideas here morphed and rolled into #38664

@Erin007 Erin007 closed this Jan 21, 2021
@breville breville deleted the predict-panel branch May 18, 2021 00:37
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.

None yet

4 participants