Running a Model on the Edge Tutorial¶
In this tutorial, we will run a machine learning model in Arundo Edge. This model will calculate the total power output of two wind turbines.
The tutorial is divided into the following sections:
- Learning Objectives - things you will know how to do after completing the tutorial.
- Prerequisites - requirements to meet before you get started.
- Setup - set up necessary before you get started.
- Instructions - instructions on how to complete the tutorial.
- Finishing Up - challenges and further reading for after the tutorial.
After completing this tutorial, you will know how to:
- Create simulators that stream sample data
- Build machine learning models
- Deploy machine learning models to Arundo Edge
- View the output of machine learning models
This tutorial uses a machine learning model built in Arundo Enterprise. If you haven't worked with machine learning models in Arundo Enterprise before, take a look at the Model Workspaces and Models articles before you start this tutorial.
Before you start the tutorial, you must do the following:
- Install Arundo Edge
- Add a Cloud interface for Arundo Fabric
- Install Arundo Composer
- Install the latest version of Docker Desktop/CE (Windows / macOS / Linux)
- Start Docker and keep it running
Now let's get started...
1. Set Up a Simulator¶
The first step is to set up a simulator to stream sample turbine data.
a) Download the Sample Data¶
Download the following sample data file.
Save the file on your local device.
The simulator will stream data from this file.
b) Add a Sequence Interface¶
Add a Sequence interface in Arundo Edge:
The Sequence interface will stream the sample data from Arundo Edge to Arundo Fabric on repeat.
- Double-click the Arundo Edge shortcut on the desktop.
- Log in as normal.
- Select Interfaces | + Add new.
- Select Sequence.
- In Name, enter "Turbine Simulator".
- Click Add interface.
c) Upload the Sample Data¶
Upload the sample data file to Sequence interface by clicking Upload CSV (highlighted below).
Then click the upload box and select the sample data file. The sample data now displays on the screen as follows:
2. Publish the Model¶
The next step is to build and publish a machine learning model into Arundo Fabric.
a) Build a Model Workspace¶
Access the Arundo Composer CLI and browse to the local directory where you want to store the model workspace. Then run the following command:
composer init Wind_Farm_Output
Press Y and Enter to add a new folder. The following message displays once the workspace is built:
1 2 3 4 5
(arundo) C:\Documents\Composer>composer init Wind_Farm_Output The folder pump_efficiency does not exist, create it? [y/N]: y Created: app.py Created: config.yaml Project initialized successfully: Wind_Farm_Output
b) Update the config.yaml¶
Next, open a source code editor and open the contents of the model workspace directory. Open the config.yaml file, then set the model name and version number as follows:
1 2 3
model_name: Wind Farm Output model_version: 1.0.0. wrapper_version: 2
Save your changes once you are finished.
c) Update the app.py¶
Open the app.py file, delete the code on lines 6-13, and remove the blank space on line 1. This should leave the following:
from runtime.framework import endpoint, argument, option, returns, pass_api from runtime.schema import objects, fields
Enter the following code on lines 5-14:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
from runtime.framework import endpoint, argument, option, returns, pass_api from runtime.schema import objects, fields @endpoint() @argument("Wind_Turbine_1", type=float) @argument("Wind_Turbine_2", type=float) @returns("Total_Output", type=float) def AddWindTurbineOutput(Wind_Turbine_1, Wind_Turbine_2): """ This model calculates the total power output (mW) for two wind turbines. """ Total_Output = Wind_Turbine_1 + Wind_Turbine_2 return Total_Output
Finally, save your changes and close the config.yaml and app.py files.
d) Publish the Model¶
Access the Arundo Composer CLI and browse to the model workspace directory. Then run the following command:
The following message displays:
requirements.txt is missing. Do you want to continue? [y/N]:
Press Y and Enter to continue. The publishing begins and the following message displays once the model is published successfully:
1 2 3 4 5 6 7 8 9 10
Build status is: completed after 1m21s Model ID: 088e5951-7062-e32a-b721-818afc68c4 Name: Wind_Farm_Output Version: 1.0.0 Wrapper Version: 2 Build Status: completed Owner: firstname.lastname@example.org Created: 2019-13-03 09:44:19.246000 Base URL: https://test.arundo.com/model/088e5951-7062-e32a-b721-818afc68c4 Scale: 1/1
3. Deploy the Model¶
The next step is to deploy the model from Arundo Fabric to Arundo Edge. First, access Arundo Edge, open the System menu and select Upload Configuration to Fabric.
Next, access Arundo Fabric and select Models on the Navigation bar. Then locate the model in the list and click Deploy to Edge next to the model.
Select your edge device in the Edge Agents list.
Under Endpoint Configuration, select the following inputs and outputs for the model:
Finally, click Deploy. A message displays at the top of the screen once the model is deployed successfully.
4. View Model Output¶
The final step is to view the calculated output for the model. To do this, complete the following:
- Select Viewer on the sidebar.
- Open the Graph tab.
- Select "Sent to Cloud" in Filter.
- Select Auto refresh.
The output displays on the Total_Output panel under Models.
Congratulations! You've now deployed and ran a machine learning model on the edge. We hope you now understand how to run models on the edge to enhance your data analytics.
Want to expand your knowledge further? Try the following:
Deploy your own machine learning models to Arundo Edge to generate output for analysis.
We have used a number of features in this tutorial. Read the following articles to learn more about them:
|Arundo Fabric||Arundo Fabric Overview|
|Arundo Composer||Arundo Composer Overview|
|Model Workspaces||Model Workspaces|
Download the files used in this tutorial.