diff --git a/_posts/2016-10-05-BTTCorp.md b/_posts/2016-10-05-BTTCorp.md new file mode 100644 index 0000000..ad7979f --- /dev/null +++ b/_posts/2016-10-05-BTTCorp.md @@ -0,0 +1,100 @@ +--- +layout: post +title: "IoT and Machine Learning for Brain Thermal Pattern Recognition" +author: "David Crook" +author-link: "#" +#author-image: "{{ site.baseurl }}/images/authors/photo.jpg" +date: 2016-11-17 +categories: IoT +color: "blue" +#image: "{{ site.baseurl }}/images/imagename.png" #should be ~350px tall +excerpt: This article showcases pattern recognition with Azure IoT and Machine Learning. +language: English +verticals: Healthcare +--- + + +[![Ch. 9 Video]({{site.baseurl}}/images/BTT/Video_Picture.png)](https://www.youtube.com/watch?v=oPAqVDdNVQw&feature=youtu.be) + +Microsoft worked with BTT Corp to develop an IoT solution to help with brain thermal tunnel pattern recognition. Their solution is described here. + +The core project team included: + +- Robert Ortega - BTT CTO +- James Melenkevitz - BTT Data Scientist +- David Crook, [@Data4Bots](https://twitter.com/Data4Bots) - Microsoft Technical Evangelist +- Yung Chou, [@yungchou](https://twitter.com/yungchou) - Senior Microsoft Technical Evangelist + + +## BTT Corp ## +[Brain Tunnelgenix Technologies Corp](http://www.bttcorp.com/) (BTT Corp) is a med-tech company with offices in the US and Brazil. They have a biological discovery patent on the Brain Thermal Tunnel and are developing several product lines around this particular discovery. The goal of all product lines is to democratize brain thermodynamics insights to improve your health. + +Through continuous monitoring of brain temperature, BTT treats brain temperature like a multichannel signal and uses this to perform analysis and pattern recognition to further insights into customers' health on a personalized basis. + +One of BTT's large marketing points is that the device is non-invasive. See below reference image of device application. + +![BTT Device Application]({{ site.baseurl }}/images/BTT/BTT_Crystal_Device_Applied.png) + +## Pain point ## + +BTT Corp was looking to address two key problems. First, they needed a way to take the patterns their researchers could recognize as humans and create computer algorithms that could recognize those patterns with a high degree of accuracy. Second, they needed a way to integrate these algorithms into a production application that could perform pattern recognition in real time as well as in a batch-like process when the data is sourced from a proprietary device. + + +## Solution ## + +There are multiple processes and pathways the data takes in this particular IoT solution: + +1. IoT Hub -> Stream Analytics -> Power BI +2. IoT Hub -> Stream Analytics -> SQL Server +2. IoT Hub -> Stream Analytics -> SQL Server -> Power BI +4. IoT Hub -> Stream Analytics -> SQL Server -> Azure Machine Learning + +Below is a screenshot of a dashboard based on historical SQL Server data surfaced in Power BI with some light analytics applied. + +![BTT Power BI Dashboard]({{ site.baseurl }}/images/BTT/Dashboard.JPG) + +Much of the power of BTT comes from its ability to perform pattern recognition and thus a major portion of their product relies on these capabilities. Their current workforce is already trained using C++, Python, and R on their own workstations. Due to this, we wanted to enable this team to continue their research and development while simultaneously opening a path to production deployment. Alongside the team, we built a model using Python's sklearn packages and operationalized via Azure Machine Learning. Below you can view a screenshot of in-progress development of a binary classification model using sklearn on a Linux workstation. + +![workstation sklearn training]({{ site.baseurl }}/images/BTT/sklearn_dev_workstation.png) + +As you can see, we are using Linux, Python, and Anaconda to perform the analysis against data pulled in from SQL Database. This was purely a preference choice, but the process is loosely coupled enough to allow you to use nearly anything. The full process for operationalizing the model into Azure Machine Learning is pictured below. + +![operationalizing ML model]({{ site.baseurl }}/images/BTT/Operatinoalization_Process.png) + +One of the more interesting parts of this experiment is that we were able to separate model training and inference away from feature extraction. This enabled the ability to stack rank built in Azure Machine Learning Models against each other as well as custom models using the same features we extracted on the workstations during experimentation. This process enables two things. First, you can iterate just Azure Machine Learning models for a most likely best model to pursue while also custom developing other models should the exercise be deemed necessary and still stack it against many of the common algorithms. + +We then convert the experiment into a production model, which was a simple matter of choosing the endpoints and doing some basic cleanup. An image of the production experiment can be viewed below. + +![AzureML production model]({{ site.baseurl }}/images/BTT/productionmodel.png) + +Finally, after this process, we have an endpoint that can be integrated and tested in a variety of methods. One of the easiest ways to test is using the Excel endpoint provided. Below you can see us testing a segment of data against the endpoint to ensure we receive a negative classification. + +![AzureML excel plugin]({{ site.baseurl }}/images/BTT/BTT_ML_Excel_Plugin.png) + +## Solution architecture ## + +The BTT solution is an IoT solution leveraging the power of the Microsoft IoT Suite. It is an implementation following the [Microsoft Azure IoT Reference Architecture Guide](http://download.microsoft.com/download/A/4/D/A4DAD253-BC21-41D3-B9D9-87D2AE6F0719/Microsoft_Azure_IoT_Reference_Architecture.pdf). A higher-level explanation of this type of solution can be found [here](https://channel9.msdn.com/Blogs/raw-tech/IOT-Analytics-Architecture-Whiteboard-with-David-Crook). The key difference between this solution and many other solutions is the absence of big data infrastructure and the fact that data analysis is done both on premises and in the cloud. SQL Database is sufficient to handle current loads. BTT is evaluating SQL Data Warehouse as a big data platform when workloads increase beyond the capabilities of SQL Database. + +![BTT Pattern Recognition Architecture]({{ site.baseurl }}/images/BTT/BTT_Architecture_Diagram.png) + +## Device used and code artifacts ## + +The device used is proprietary, but based on Texas Instruments embedded micro controller platform with built-in Bluetooth. The device synchronizes with a client Windows device. The Windows device is built using the Universal Windows Platform and C#. The C# IoT Hub SDK is used in this scenario. + +Annotation App for Labeling Time Series Patterns can be located [here](https://github.com/drcrook1/ML_Annotations). + +Step-by-step instructions for how to deploy custom sklearn models to Azure Machine Learning can be located [here](http://dacrook.com/operationalizing-sklearn-with-azure-machine-learning/). + +Instructions for building a deep neural network with theano and lasagne and operationalizing via Azure Machine Learning can be found [here](https://blogs.technet.microsoft.com/machinelearning/2016/10/12/deep-neural-network-in-azure/). + +##Opportunities going forward + +BTT is planning to use Microsoft technologies (Power BI) to provide BTT™ Signal reporting and analytics, including BTT™ Signal analysis for sleep doctors and specialists. BTT plans to use Azure Notification Hub for cross-platform alerting. BTT will also start porting the BTT™ Monitor to Xamarin forms to deliver a cross-platform experience. BTT is also evaluating Microsoft Health Vault and Azure SQL Data Warehouse. + + +## Conclusion ## + +> The IoT Hub in conjunction with Azure Stream Analytics has made it super easy for us to ingest data from our sensors. We also use Azure ML for developing an operationalizing predictive model. The best part is that all of these environments are ready to go and we do not have to worry about the underlying infrastructure. One of my favorite features of Azure ML is the automatically generated sample code and Excel app for testing or invoking the predictive model web service. +> - Robert Ortega - CTO, BTT + +The partnership between BTT Corp and Microsoft is going to help democratize the insights into your brain and thereby improve the health of the world. The ability for a small team of primarily research scientists to take advantage of these tools and build a solution of this caliber truly drives home the democratizing power of the Microsoft IoT Suite and Cognitive Services platform.