Click here to Skip to main content
15,881,424 members
Articles / Programming Languages / Python
Article

Best Practices for Leveraging Predix Analytics Services

18 Jan 2017CPOL5 min read 13.4K  
Here are few things to keep in mind when creating your analytics using Predix Analytics Services, starting with prepping the data itself through deploying the analytic in a production environment.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Predix is GE’s application platform for the Industrial Internet. Built on Cloud Foundry, Predix is optimized for secure connectivity and analytics at scale - in the Cloud and on the Edge.

With thousands of developers around the world leveraging Predix Analytics Services to create and deploy advanced business analyses applications, we thought a worthwhile place to start would be a post on best practices for leveraging all of the tools in Analytics Services.

Here are few things to keep in mind when creating your analytics, starting with prepping the data itself through deploying the analytic in a production environment.

Developing the Analytic

The general flow to creating and using an analytic in the Predix Analytics Services is to develop your analytic in one of the supported languages (Python, Matlab, or Java) on your local environment with the SDK of your choice. Do not worry about security, REST entry point, etc. at this point. Once the analytic is behaving as desired on your local environment, you can upload and deploy the analytic to your Predix Analytics Catalog.

In doing so, the Analytics Platform will wrap your analytic adding security, REST entry point, etc. and then deploy it to the Predix Cloud.

After that you can run the cloud-deployed analytic in three different ways. REST APIs allow you to run the analytic from your Predix Analytics Catalog and/or you can manage scheduled runs of your analytic via the Predix Analytics Runtime. Finally, with the Q3 release, we have added APIs for direct execution of the analytic microservice in both synchronous and Asynchronous modes. So you can build applications that deploy and consume these analytic microservices in the way it makes most sense. The following paragraphs highlight best practices for your analytic development and use.

Image 1

Publishing the Analytic to the Analytics Catalog

The first step is encapsulating the form and function of your analytic. Each analytic in the Catalog Service becomes a microservice when it is deployed. Hence the best practices for creating applications based on microservice architecture need to be followed. The analytic should apply its logic to each input and produce output without reading state information that is persisted between subsequent invocations in a data service. Hence we’re saying that you don’t want to read/write state information from databases or a file system within your analytics' code. The analytic needs to be stateless between invocations, or articulated another way, necessary state information must be passed in as input when the analytic is executed.

Once you’ve written and debugged your analytic in your local environment, you will prep it for uploading to your Predix Analytics Catalog. Your analytic needs to have one entry point with a well-defined input structure and output JSON structure. (All analytics should produce output of some kind, even if it is just a simple score. Without that output why would a developer leverage your analytic in an application?) The platform will communicate with your analytic via a JSON input structure and expect it to return a JSON output structure. The internal structure of the JSON input/output are custom to each analytic.

As a convenience, the platform provides a template for handling tables of Time Series values. Instructions are provided for prepping your analytic in predix.io documentation. Sample analytics for each of the supported languages are also provided at https://github.com/PredixDev/predix-analytics-sample.

A big positive when working with Predix Analytics Services is that you don’t have to worry about security as Predix handles this automatically. Other items that Predix handles includes making the analytic a REST service and accessing the analytics’ logs in the cloud. Once you’ve followed the wrapping instructions you can upload the executable/script to your Predix Analytics Catalog. Then you can use the Predix Analytics User Interface, or Predix Analytics Catalog Service’s APIs to deploy the analytic to the Predix Cloud and validate it.

Prepping the Analytic for Validation, Release and Execution

Now your analytics are ready for production. In the Q3 release, Predix Analytics Runtime is introducing support for orchestrations of multiple analytics, with in-memory transfer of intermediate data from one orchestration step to a subsequent one. You will create a BPMN file defining the analytic that is to be run at each step, and then write an outer trigger to collect the data needed by each analytic and disperse its results. Finally, you will run the BPMN orchestration, presumably with Predix Time Series data, for a single asset or asset group. Orchestration events are reported to our monitoring service.

Support for Machine Learning

It is worth mentioning that with our Q3 release, Predix Analytics Runtime is introducing support for machine learning and other stateful analytics. The machine learning based analytics must have been trained offline. The trained model can be provided as an input to the analytic and used to serve multiple predictions. Similarly, any stateful analytic can have its state restored as an input when it is triggered, and updated state at the end of its execution can be saved as output. In both cases, a stateless microservice handles state as one of its inputs.

We recognize that a lot of work remains to be done for machine learning support. In the near future, the models built from large data sets in our production environment will be configured for easy integration with Analytics Services, and can be periodically updated based on new data. There is a need for seamless integration of the learning phase running at scale in the big data environment, with predictions served in Analytics Runtime based on different versions of trained models. We will keep expanding our capabilities with continuous delivery of new features aligned with our major release milestones.

While these considerations are excellent for prepping the analytics, we encourage all developers to visit our overview page for Predix Analytic Services. This set of resources provides more detail on each of these steps, as well as specific examples to show you how this is done.

You can register for a Predix account here and begin using this tutorial to leverage Predix Analytics Services at Predix.io.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --