Microsoft AI support for COVID-19

In January 2020, Microsoft launched AI for Health program. Goal is to use Artificial Intelligence (AI) and data to help improve the health of people worldwide. Post COVID-19 hit world wide, Microsoft took steps to support & empower researchers, nonprofits and policymakers with resources.

ai-health

There have been more than 50 million confirmed cases of Covid-19 and more than 1.25 million deaths globally

World Health Organization

Research has accelerated with large-scale computing and open data.

Highlights from Grantees World wide

ai-health-covid-response
Credit: Microsoft

As shared here, few of them are:

  • A grassroots employee volunteer effort at Belgian biopharmaceutical company UCB.
  • UC Riverside researchers utilize quantum-based methods to more accurately predict the effectiveness of proposed Covid-19 inhibitors.
  • IHME, a global health research organization at the University of Washington School of Medicine, forecasts the Covid-19 pandemic.
  • Professor Amanda Randles at Duke University is conducting hundreds of millions of simulations required to help more patients have access to critical ventilators.

Partnership with Organizations

As shared here, few of them are:

  • Partnering with the White House Office of Science and Technology Policy’s (OSTP) High Performance Computing Consortium to support researchers and academia.
  • Working with Brown University’s School of Public Health and the Edmond J. Safra Center for Ethics at Harvard to visualize a common set of measures on testing and risk levels to help everyone know where we are with the pandemic and help policymakers guide their response.
  • Joining University of Oxford and their Government Response Tracker initiative to track and compare government and policy responses to address Covid-19 around the world.

The rapid progress means researchers can more quickly identify potential solutions to combat Covid-19 and provide timely information to policymakers for data-driven decisions that protect communities, cities and regions.

Microsoft blog

Public Information

Using publicly available information from partners, Microsoft have created:

  • a number of interactive visualizations to provide transparency into Covid-19 trends globally.
  • a unique measure called Progress to Zero to help everyone understand, progress in reducing Covid-19 cases, hospitalizations and deaths.
india-progress-to-zero

My Take

There are some great work being done world wide to fight Covid-19 in all possible ways. Organizations like Microsoft are making an active effort to help partners and grantees for Covid-19 response. There is much to do and supports like these will help mankind avert Pandemic.


Keep exploring!

Sandeep Mewara Github
News Update
Tech Explore
Data Explore
samples GitHub Profile Readme
Learn Machine Learning with Examples
Machine Learning workflow
What is Data Science
Word Ladder solution
What is Dynamic Programming
Learn Microsoft Tech via Videos LiveTV Streams Microsoft .NET5

Microsoft .NET 5 – all you need to know

As announced earlier, Microsoft released .NET 5 on Nov. 10 during .NET Conf 2020. It’s a major release with many new features and improvements to .NET Core 3. Keeping cross platform support and open source development as key base, going forward it kind of merges off .NET Framework and .NET Core.

dotnet-header

Plan

Microsoft started it’s journey of cross platform and open source in 2015. .NET 5 is a major milestone of this transition as .NET Framework 4.8 was the last major version of .NET Framework. Microsoft published a blog to explain how .NET 5 relates to .NET Framework.

.NET 5.0 is the main implementation of .NET going forward and .NET Framework 4.x is still supported.

dotnet-schedule
Source: Microsoft
dotnet-unified
Source: Microsoft

.NET 5 has been called as .NET Core vNext for quite some time now. It has following key principles:

– Produce a single .NET runtime and framework that can be used everywhere and that has uniform runtime behaviors and developer experiences.

– Expand the capabilities of .NET by taking the best of .NET Core, .NET Framework, Xamarin and Mono.

– Build that product out of a single code-base that developers (Microsoft and the community) can work on and expand together and that improves all scenarios.

Microsoft

Highlights

There are many improvements in .NET 5 like:

  • Performance across many components
  • Performance in .NET Libraries
  • Language C# 9 & F# 5
  • Application deployment options
  • Platform scope (includes Windows Arm64 & WebAssembly)

Details about these enhancements are here.

dot.net and Bing.com are already running on .NET 5 for months now

References

IDE

You need Visual Studio 16.8 or later to use .NET 5.0 on Windows and the latest version of Visual Studio for Mac on macOS. Latest C# extension for Visual Studio Code already supports .NET 5.0 and C# 9.

Impacts

There are few breaking changes with upgrade to .NET 5:

  • while migrating from version 3.1 of .NET Core, ASP.NET Core, or EF Core to version 5.0 of .NET, ASP.NET Core, or EF Core are captured here.
  • in Roslyn in C# 9.0 introduced with .NET 5 are captured here.
  • for migration from .NET Framework to .NET Core are captured here.
  • obsolete features in .NET 5 are captured here.

Deprecated

.NET 5 does not have few of the known technologies:

  • ASP.NET WebForms – Microsoft’s recommendation is to move to Blazor
  • Windows Communication Foundation (WCF) – Microsoft’s recommendation is to use gRPC
  • Windows Workflow Foundation (WWF) – recommendation is to look at CoreWF, a form of WF runtime

Advantages

.NET 5 helps if you have cross-platform needs or targeting microservices or want to use Docker containers. Based on how it is setup underlying, it helps in designing high-performance and scalable systems.

.NET 5 supports side-by-side installation of different versions of the .NET 5 runtime on the same machine. This allows multiple services or applications on the same server running on their own version of .NET 5 variant.

A detailed analysis and shareout can be read here.

Wrap Up

.NET 5 is a major step of the .NET journey planned ahead. Next would be .NET 6 next year (late in 2021), which will also be a long term (multi year) supported (LTS) version.

Microsoft is working towards a defined vision – same .NET API and languages working across operating system, application types and architectures.

With active support to previous .NET versions, we have time to assess, plan and adapt the new path.


Keep exploring!

Sandeep Mewara Github
News Update
Tech Explore
Data Explore
samples GitHub Profile Readme
Learn Machine Learning with Examples
Machine Learning workflow
What is Data Science
Word Ladder solution
What is Dynamic Programming
Learn Microsoft Tech via Videos LiveTV Streams Microsoft .NET5

Find missing number from 1 to N?

Last week, there was a discussion in my team on the problem of finding missing number(s). We had different thoughts and approaches and thus I thought to share it across.

find-missing-number

Problem statement was something like:

– An array of size (n) has numbers from 1 to (n+1). Find the missing one number.

– An array of size (n) has numbers from 1 to (n+2). Find the missing two numbers.

First thought …

Keep track of numbers found while traversing. At the end, use it to find the missing number. So kind of brute force approach.

We can maintain a hash or a boolean array of n size and keep on updating the hash or the array index location based on number found while traversing. Use it now to find the missing number. It would cover both one as well as two missing numbers case.

This would have two traversals of n (one for filling in the structure and another to find the missing one). Thus overall, time complexity of O(n). This would need an extra space to keep track of all numbers found and thus a space complexity of O(n).

Q: Now, can we avoid extra space or two times traversal?

Second thought …

We know how to calculate the sum of n natural numbers, i.e.: n*(n+1)/2. With it, we can traverse the given array and keep a sum of all numbers. Difference of the sum from formula to sum found would give us the missing number. Nice!

# Keep track of sum
def sumOfGivenNumbers(nos, n):
    sum = 0
    # calculate sum
    for i in range(0, n):
        sum += nos[i]
    return sum

# Input
numbers = [4, 2, 1, 6, 5, 7] 

# number range 
n = len(numbers) + 1
expectedSum = n*(n+1)/2
numbersSum = sumOfGivenNumbers(numbers,len(numbers))

print('Missing number:', expectedSum - numbersSum)

# Output
# Missing number: 3.0

This would help is solve one missing number in single traversal, thus time complexity of O(n). No extra space was used and thus space complexity of O(1).

Q: Can we extend this to two missing numbers now?

Yes, we can extend it. Along with sum, we can also use the product of n natural number as an expression. With it, we will have two equations and two numbers to find:

Missing1 = x1
Missing2 = x2
Sum of provided numbers = N1
Sum of n Natural numbers = N
Product of provided numbers = P1
Product of n Natural numbers = P

x1 + x2 + N1 = N
x1 * x2 * P1 = P

We can solve it to find the two missing numbers. It does have the quadratic flavor associated though. It maintains the time complexity as O(n) and space complexity as O(1). Nice!

Q: Does the solution help with large integers? Think of possible overflow?

Third thought …

Let’s look at possible way for 1 missing number first.

We will traverse through all the numbers of the array. While doing so, maintain a number that would be sum of all numbers traversed so far reduced by sum of all the indexes traversed (+1 if index starts from 0). It is still making use of n natural numbers (in form of indexes) to keep a check on sum to a defined limit.

# Keep track of sum
def getMissingNumber(nos, n):
    sum = 0
    # calculate sum
    for i in range(0, n):
        sum += (i+1)
        sum -= nos[i]

    # last number to add from n+1 natural nos.
    return sum+n+1

# Input
numbers = [4, 2, 1, 6, 5, 7] 

missingNumber =getMissingNumber(numbers,len(numbers))

print('Missing number:', missingNumber)

# Output
# Missing number: 3.0

This looks good and we maintain the same complexities along with solving for overflow.

We can probably try a similar thing for two missing numbers where we keep on multiple and divide the traversed number by index but it still could have overflow issues in worst case. Further, there could be round off issues.

Fourth thought …

Looking more, it seems we can make use of XOR operation to find the missing numbers. We can make use of XOR’s property to nullify the duplicate pair. We will take XOR of provided numbers and XOR of natural numbers. Combining both again with XOR will leave with missing numbers XOR output.

For one missing number, this would be easy and covers all the hurdles discussed earlier keeping same performance.

# Keep track of XOR data
def getMissingNumber(nos, n):
    x1 = nos[0]
    xn = 1

    # start from second
    for i in range(1, n):
        x1 = x1 ^ nos[i]
        xn = xn ^ (i+1)
    
    # last number to XOR
    xn = xn ^ (n+1)

    # find the missing number
    return x1 ^ xn

# Input
numbers = [4, 2, 1, 6, 5, 7] 

missingNumber =getMissingNumber(numbers,len(numbers))

print('Missing number:', missingNumber)

# Output
# Missing number: 3.0

For two missing numbers, using a similar logic of XOR above, we will have an output of XOR value of both missing numbers. Now, given the XOR value will not be zero, the XOR corresponding valid bit in missing1 and missing2 must be different to make it “1”.

# Keep track of XOR data
def getTwoMissingNumber(nos, n):
    x1 = nos[0]
    xn = 1

    # start from second
    for i in range(1, n-2):
        x1 = x1 ^ nos[i]
        xn = xn ^ (i+1)
    
    # last numbers to XOR
    xn = xn ^ (n-1) ^ (n)

    # XOR of two missing numbers
    # Any set bit in it must be 
    # set in one missing and 
    # unset in other missing number 
    XOR = x1 ^ xn

    # Get a rightmost set bit of XOR  
    set_bit_no = XOR & ~(XOR-1) 
  
    # Divide elements in two sets 
    # by comparing rightmost set bit of XOR 
    # with bit at same position in each element. 
    x = 0
    y = 0 
    for i in range(0,n-2): 
        if nos[i] & set_bit_no:    
            # XOR of first set in nos[]  
            x = x ^ nos[i]   
        else: 
            # XOR of second set in nos[]  
            y = y ^ nos[i]   

    for i in range(1,n+1): 
        if i & set_bit_no: 
            # XOR of first set in nos[]  
            x = x ^ i        
        else: 
            # XOR of second set in nos[]  
            y = y ^ i
    
    print ("Missing Numbers: %d %d"%(x,y)) 
    return

# Input
numbers = [4, 2, 1, 6, 7, 5] 

# total length will be provided count+2 missing ones
getTwoMissingNumber(numbers, len(numbers) + 2)

# Output
# Missing Numbers: 3 8

This overcomes the overflow issue and was easier to solve (compared to solving a quadratic equation). Though it took more than one traversal, overall it maintains the time complexity as O(n) and space complexity as O(1). Nice!

Closure …

There could be multiple ways to solve for one or more missing numbers. One can look at it based on ease and need.


Keep solving!

Sandeep Mewara Github
News Update
Tech Explore
Data Explore
samples GitHub Profile Readme
Learn Machine Learning with Examples
Machine Learning workflow
What is Data Science
Word Ladder solution
What is Dynamic Programming
Learn Microsoft Tech via Videos LiveTV Streams

POC Guide for Developers by Microsoft

Few weeks back, Microsoft Azure published a white paper about a Proof Of Concept (POC) guide for developers. Intent of the paper is to share what POC is and how it would help minimize risk and reduce cost while exploring new technology or an idea.

proof-of-concept

Guide uses Azure application as an example on how to create and execute a POC.

POC guide can be downloaded from here.

Brief Overview

Guide touch-bases and share details around:

  • POC Introduction
  • Steps of a POC
  • Example 1: Sample Azure web app
  • Example 2: Sample Azure chatbot

Additionally, it covers overview of Azure and where to find interactive learning path for beginners. It also shares additional resources that can help develop an Azure based application.

What is Proof of Concept?

Proof of concept (POC) is validating an idea or a concept about it’s feasibility, capability and provides helpful insights. They are scoped to limited features and are generally done in a quick and dirty manner to acquire some metrics.

A proof of concept is an important first step in cultivating business innovations.

How to prepare for and start your POC?

We can get a good POC following a defined set of basic steps:

  1. Defining a goal with success criteria
  2. Setting up a timeline and cost boundaries
  3. Scoping the feature(s) for the POC
  4. Designing, Implementing & Testing
  5. Measure metrics to deduce insights
  6. Take decisions based on the insights

Closing Thoughts

POCs are great way to validate an idea or a technology or a concept. With it, we can take a data back decision for a project that would reduce risk, provide a higher success probability and a conscious cost decision. It also help gauge probable next steps needed once adopted as a mainstream solution.

Provided document is a nice compile and provides a systematic approach for building a POC. With couple of examples, it demonstrates the steps in action. Definitely worth a read.

Don’t ever shy away from building and using a POC to explore and learn.


Keep exploring!

Sandeep Mewara Github
News Update
Tech Explore
Data Explore
samples GitHub Profile Readme
Learn Machine Learning with Examples
Machine Learning workflow
What is Data Science
Word Ladder solution
What is Dynamic Programming
Learn Microsoft Tech via Videos LiveTV Streams

Learn AI ML with Netflix’s Fei Fei!

Off late, Microsoft has been working on providing more and more learning materials. This is as per their Global Skills Initiative aimed at helping 25 million people worldwide acquire new digital skills.

global-initiative

Our goal is to ignite the passion to solve important problems relevant to their lives, families and communities.

Microsoft

Last week, they partnered with Netflix to release a new learning experience featuring a young female hero Fei Fei, who has a passion for science and explores space.

Newly launched

Microsoft has launched three new modules under Explore Space with “Over the Moon” learning path. These modules will help learn basic concepts of data science, artificial intelligence and machine learning:

  1. Plan a Moon Mission using the Python Pandas Library
  2. Predict Meteor Showers using Python and VC Code
  3. Use AI to Recognize Objects in Images using Azure Custom Vision
fei-fei-explore

The movie’s story takes place in a beautifully animated universe and tackles problems real-life space engineers face.

How is it?

They cover the basic workflow of a machine learning problem similar to what I shared in my previous article here.

Exercises also provide a professional experience as they are built on Visual Studio Code and use Azure Cognitive Services.

Looking at it, seems a fun way to learn and explore the data world. Microsoft is really trying to make things simple and available to all. An effort worth to try out. Would recommend and ask to give it a shot.


Keep learning!

samples GitHub Profile Readme
Learn Python – Beginners step by step – Basics and Examples
Sandeep Mewara Github
Sandeep Mewara Learn By Insight
Matplotlib plot samples
Sandeep Mewara Github Repositories
Learn Microsoft Tech via Videos LiveTV Streams
Machine Learning workflow