Machine Learning basics

Thinking about #machinelearning? It will be helpful to understand some numerical computations and concepts that affect the #ML algorithm. 

One might not interact with these directly, but we surely can feel the effect. The things you need to think about are:

1. Overflow and underflow – thinking of them as rounding up or down errors that shift the functions enough, and compounded across the iterations cam be devastating. Of course can also easily get to division by zero. 

2. Poor conditioning – essentially with small changes of input data, how large can the output move. You want this small. (And in cryptography you want the opposite, and large). 

3. Gradient optimizations – there will be some optimization happening in the algorithm, question is how does it handle various local points on the curve? Local minimum, saddle points, and local maximum. Generally speaking, it’s about optimizing continuous spaces.

Some algorithms take this a step further by measuring a second derivative (think of it as measuring the derivative of a derivative – the curvature of a function). 

4. Constrained Optimization – sometimes we just want to operate on a subset – so constraints only on that set. 

All of these come into play some way, directly or indirectly and having a basic understanding and constraints around this would help a long way. 

Whats the difference between #AI, #ML, and #DeepLearning?

I know I have had to explain this a lot in most #AI related conversations that I have had – and lately those have been quite a lot. In my experience, most people use these terms interchangeably when they are meaning one over the other.

Whilst they all are (inter)related and one might help trigger the other, they are still fundamentally different and at some point, it is good to understand the differences. I like the image below (source) that whilst on one hand is showing a time graph, the correlation between them and how one is a subset of the other is what is interesting.

AI vs Machine Learning vs Deep Learning
#AI vs #ML vs #DNN

#AI is getting more powerful and the potential of it which personally really excites me is the paradigm shift we are starting to see. Fundamentally it is changing on how we use, interact, and, value computers and technology.

It is shifting from us learning machines and their idiosyncrasies (remember when being computer literate was a differentiator on a resume) to this shift where technology learns us and interacts with us in a more natural, and dare I say human manner.

AI paradigm shift

I almost see it as StarTrek (and now showing my age) – the computer is everywhere, yet it is no where. It is embedded and woven into everything we do on the Enterprise rather an some “thing” one interacts with.

And it is awesome to start seeing some of this coming to life, even if it is in a demo as outlined at Build a couple of weeks ago. #AI in the Workplace and how it interacts with objects in real-time and can invoke and interact Business workflow (such as workplace policies).

AI in Workplace
AI in Workplace
Policy violation - detected using AI
Policy violation

The degree of calculations is pretty phenomenal – 27 million / sec [separately I would love to understand the definition on calculation 🙂 ]. But then given where we are heading with a fully autonomous car generating about 100GB of data each second, this isn’t small potatoes.

And whilst you can read up more on these terms and how they link, I really like to move away from the different terms which most people confuse in the first place and start thinking of more business outcomes and how enterprises and people will use.

AI
AI

To that end, the three buckets of Intelligent Automation, Robotic Process Automation (RPA), and Physical Automation is what we have found work better. On RPA, the one caveat being that it is not about robots, but rather the automation of a (business) process. The robots aspect would fall under physical automation – which essentially is anything that interacts with the real/physical world.

Core principle of Machine Learning 

There of course are many, but for someone coming from computer science, and, software engineering, where the environment is relatively clean and certain (deterministic), it usually is a leap to understand that Machine Learning (and other elements of #AI) are not. 

Machine learning, is based on probability theory and deals with stochastic (non-deterministic) elements all the time. Nearly all activities in machine learning, require the ability to factor and more importantly, represent and reason with uncertainty. 

To that end, when designing a system, it is recommended to use a simple but uncertain (with some non-deterministic aspects)  rule, rather than a complex but certain rule. 

For example, having a simple but uncertain  rule saying “most birds fly”, is easier and more effective than a certain rule such as “Birds can fly, except flightless species, or those who are sick, or babies, etc.”

As one starts getting deeper in Machine Learning, a trip down memory lane around Probability distribution, expectation, variance, and covariance won’t hurt. 

HoloPortation – Limits of Human Kind

When it comes to AI and the limits of human kind, what better example that shows the art of the possible than what Microsoft is doing with special awareness and HoloLens and other sensors.

And not only can this replay time and allow you to have a ‘living memory’ but it also is mobile.

I do believe we are living in the great time ever! 🙂

Neural Networks

Of course you heard of Neural Networks! In the context of #AI they are all the buzz of course.

You might have heard of some such as DFF (Deep Feed Forward) or RNN (Recurrent neural networks)? Or perhaps you meant Recursive neural networks? Irrespective, it can be quite messy as you can see below and it would be somewhat important to have some understanding of the differences.

neuralnetworks

And in case you are thinking, well what good or use is all this? Here is one example ( MarI/O – Machine Learning for Video Games) that shows how a computer learned to play Mario using DeepMind and a Neural network.

MarI/O uses something called NEAT (neural evolution of augmenting topologies) and is written in Lua (which is very similar to .NET) and runs in BizHalk which is a emulator for games and their various platforms (and not to be confused with BizTalk). You can checkout the code for this here.

Fjodor also has outlined a (very) brief outline on what some of these are and what they mean. If you just want to get a quick basic understand it is a great read, with of course links back to original research papers (and deeper reads) if that is your cup of tea.

Happy reading! 🙂

Object and scene detection with #AI

Continuing the previous #ArtificialIntelligence theme. Wanted to see what and how does Amazon’s rekognition work and different from the #AI offerings from the others, such as Microsoft.

Here is a #ProjectMurphy image’s confidence score. I am glad to see that there is a 99% confidence that this is a person.

Object and Scene detection

The request POST is quite simple:

{
 "method": "POST",
 "path": "/",
 "region": "us-west-2",
 "headers": {
 "Content-Type": "application/x-amz-json-1.1",
 "X-Amz-Date": "Thu, 01 Dec 2016 22:21:01 GMT",
 "X-Amz-Target": "com.amazonaws.rekognitionservice.RekognitionService.DetectLabels"
 },
 "contentString": {
 "Attributes": [
 "ALL"
 ],
 "Image": {
 "Bytes": "..."
 }
 }
 }

And so is the response:

{
 "Labels": [
 {
 "Confidence": 99.2780990600586,
 "Name": "People"
 },
 {
 "Confidence": 99.2780990600586,
 "Name": "Person"
 },
 {
 "Confidence": 99.27307891845703,
 "Name": "Human"
 },
 {
 "Confidence": 73.7669448852539,
 "Name": "Flyer"
 },
 {
 "Confidence": 73.7669448852539,
 "Name": "Poster"
 },
 {
 "Confidence": 68.23612213134765,
 "Name": "Art"
 },
 {
 "Confidence": 58.291263580322266,
 "Name": "Brochure"
 },
 {
 "Confidence": 55.91957092285156,
 "Name": "Modern Art"
 },
 {
 "Confidence": 53.9996223449707,
 "Name": "Blossom"
 },
 {
 "Confidence": 53.9996223449707,
 "Name": "Flora"
 },
 {
 "Confidence": 53.9996223449707,
 "Name": "Flower"
 },
 {
 "Confidence": 53.9996223449707,
 "Name": "Petal"
 },
 {
 "Confidence": 53.9996223449707,
 "Name": "Plant"
 },
 {
 "Confidence": 50.69965744018555,
 "Name": "Face"
 },
 {
 "Confidence": 50.69965744018555,
 "Name": "Selfie"
 }
 ]
}

Here is what the facial analysis shows;

Facial Analysis

However how does it handle something a little more complex perhaps?

Object and Scene detection

And finally, what of the comparison? I think there might be some more work to be done on that front.

Face Comparison capture

Here is the response:

{
 "FaceMatches": [
 {
 "Face": {
 "BoundingBox": {
 "Height": 0.3878205120563507,
 "Left": 0.2371794879436493,
 "Top": 0.22435897588729858,
 "Width": 0.3878205120563507
 },
 "Confidence": 99.79533386230469
 },
 "Similarity": 0
 }
 ],
 "SourceImageFace": {
 "BoundingBox": {
 "Height": 0.209781214594841,
 "Left": 0.4188888967037201,
 "Top": 0.13127413392066955,
 "Width": 0.18111111223697662
 },
 "Confidence": 99.99442291259765
 }
}

Playing with #AI

So, been spending a lot of time recently around many things related to Artificial Intelligence (#AI).  More on that some day. 🙂

Was curious about yesterdays Amazon’s announcement to jump on this bandwagon. Of course Microsoft and others have been there. I don’t know to what extend has Amazon been working on this, but given Alexa has been out for a couple of years, I know they have had rich pickings of tuning this further.

I thought Polly (like the parrot?) was quite different from the things I have seen from others. This is a text-to-speech, where it renders the inputted text into various dialects and you can have a few outputs for those too. It supports a few dialects (for the synthesized speech) and one can use it using a simple API (the Android example shows it is not very complex to consume, of course you still need to think about the overall design and elements of Software Engineering, latency, limits, bandwidth, etc.). Should you desire you can customize it using pronunciation Lexicons that allow one to tweak this.

Here are a few examples, of course none of them are me, and hence the “cold”.

Australian (Male):

Indian (Female):

Italian (Male):

US/American (Male):

Of course if you play with it, it is easy to pick up the patterns and what is being changed, versus not. But kudos to the team on this. I think it will help accelerate the adoption of #AI.