Sunday, July 5, 2020

Artificial Intelligence (AI) vs Machine Learning (ML) vs Deep Learning (DL)

Artificial Intelligence (AI), Machine Learning (ML) and Deep Learning (DL) are three terms people use as synonyms although they don’t refer to the same things.
I will try to explain and unfold the difference between these terms

So, what’s the difference between these three concepts?





AI, ML and DL
From: Towards Data Science.

The image above shows that the three concepts are strictly related. However, DL is a subset of ML, which is a subset of AI.
In this post, we’ve defined these three concepts and outlined their applications.

What is Artificial Intelligence (AI)?

Artificial Intelligence (AI) refers to the simulation of human intelligence processes by machines, including learning, reasoning and self-correction. AI can be of two types: weak AI and strong AI. Weak Artificial Intelligence refers to an AI system developed for a specific task. Strong Artificial Intelligence is an AI system with generalized human cognitive skills.

In simpler terms, AI is the broader concept of machines being able to carry
out tasks in a way that we would consider "smart". Machine acting like human is AI.

 Application 

AI is usually adopted to solve customer service issues, inform people about the latest news along with giving them live traffic updates and weather forecast.

Real World AI Applications

  • Alexa and Google Voice Assistant
  • Tesla self-driving cars
  • Airplane autopilot mode
  • Email spam folder
  • Facebook picture face-recognition
  • Instagram Explore page curation

What is Machine Learning (ML)?

Machine learning (ML) is an application of Artificial Intelligence (AI) generating systems that can learn and improve without being programmed. Contrary to AI, ML concentrates on developing computer programs that access data and use it to learn for themselves.

In simpler terms, ML is an application of AI that provides system the ability to automatically learn and improve from experience without being explicitly programmed.

Application 

Machine Learning is often used to power recommendation engines that provide suggestions based on past customers’ behaviors. 

Lets Dive into an example
 I have an alexa at home, so while doing my morning exercise I ask alexa to 'play music'. 
Alexa plays the music at volume 8. But that's too loud, so I ask alexa to change the volume to 5. This happens multiple mornings, so one day when i ask alexa to change the volume, she asks 'Should I change the default volume to level 5'

Here Alexa learned from my behaviour (ML) and applied human intelligence (AI).

What is Deep Learning (DL)?

Deep Learning (DL) is a subset of Machine Learning and Artificial Intelligence. The term refers to a particular approach used for creating and training neural networks that are considered highly promising decision-making nodes.

Application

Deep Learning is used to develop highly automated systems such as self-driving cars. Through their sensors and onboard analytics, these cars can reorganise obstacle and facilitate situational awareness.
In conclusion, Artificial Intelligence, Machine Learning and Deep Learning are three different terms that need to be fully understood and used separately. 

Tuesday, March 24, 2020

Excel displays formula rather than result

Sometimes a bug in Excel results in the application displaying the text of a formula rather than the result of the formula in the spreadsheet. I have not been able to find a pattern of when it does it, but I have some spreadsheets that do this consistently.

The Fix

To get Excel to properly display the result:
  • Select the cell.
  • Format the cell as "General". (Right-click the cell, select Format Cells, and choose "General.")
  • Delete the "=" at the beginning of your formula, and hit Enter.
  • Insert the "=" back in the formula at the beginning.
That is it. You should now see the result of the calculation in the cell rather than the text of the formula.

Correct negative dates or times in Excel

When Excel shows ##### because the cell has a negative date or time value, make sure that you:
  • Verify dates and times are positive values when you’re using the 1900 date system.
  • Use a formula to subtract dates or Add or subtract time correctly to avoid negative date or time value results.

### in Excel

 Possible Reason No. 1
If the cell width is too short, Excel either simply cuts the visible text off, or it flows into the next cell (depending if the next cell has some content in it or not).
Some cell formats (e.g. decimals) can be shortened if a cell is not wide enough to display the entire number. However, some formats (e.g. dates and times) require the cell to be wide enough to display the entire value. If the cell is not wide enough, it will display a row of hashes.

Solution

Excel Alter Column Width
This problem is easily solved, by altering the cell width. The easiest way to do this is to drag the bar separating the column headers (as shown in the image on the right), until the cell is wider.
Alternatively, if you double-click on this bar, the cell should automatically re-size to fit the contents.
  

Possible Reason No. 2

If Excel continues to display a string of # symbols, no matter how wide you make your column, it is likely that Excel is attempting to display the contents of the cell as a date or time, but the cell contains an invalid date or time value.
As dates and times are stored as positive numeric values within Excel, some values (for example negative values) are invalid as dates or times. Excel shows this by filling the cell with # symbols.

Solution

  1. If the cell is intended to contain a date or time, check your formulas. Excel dates and times must be positive numeric values. Note that Excel can not handle negative dates or times.
  2. If the cell is not intended to contain a date or time, change the formatting of the cell.
    The quickest way to change a cell's formatting is to select the cell to be formatted and then select the required cell formatting from the drop-down menu in the 'Number' group on the Home tab of the Excel ribbon (see below):
    Excel Format Cells Drop Down Menu on Ribbon
However! If you use this cell as a data-input to, for example, a field in a merged Word document, only the first 256 characters will be grabbed!!!

Friday, March 20, 2020

Email charts using Excel VBA

While I was doing my project, I got a request from the client, to include charts in the mails along with other content which is being shared earlier.

As we all are so much into google, so I did some research on how we can do this.

Following are some nice examples that really helped me.


For simple mail, we all do this

Option Explicit
Private Sub CommandButton1_Click()
    On Error GoTo ErrHandler
    
    ' SET Outlook APPLICATION OBJECT.
    Dim objOutlook As Object
    Set objOutlook = CreateObject("Outlook.Application")
    
    ' CREATE EMAIL OBJECT.
    Dim objEmail As Object
    Set objEmail = objOutlook.CreateItem(olMailItem)

    With objEmail
        .to = "abc@xyz.com"
        .Subject = "This is a test message"
        .Body = "Hi there"
        .Display     ' DISPLAY MESSAGE.
    End With
    
    ' CLEAR.
    Set objEmail = Nothing:    Set objOutlook = Nothing
        
ErrHandler:
End Sub



Now for including a chart following are the examples:

Example 1

This example sends a chart with the name "Chart 1" from "Sheet1" of the ActiveWorkbook. It will save My_Sales1.gif in the temp folder, send the mail and delete My_Sales1.gif after that.
Sub SaveSend_Embedded_Chart()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim Fname As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    'File path/name of the gif file
    Fname = Environ$("temp") & "\My_Sales1.gif"

    'Save Chart named "Chart 1" as gif file
    'If you hold down the CTRL key when you select the chart
    'in 2000-2013 you see the name in the Name box(formula bar)
    ActiveWorkbook.Worksheets("Sheet1").ChartObjects("Chart 1").Chart.Export _
            Filename:=Fname, FilterName:="GIF"

    On Error Resume Next
    With OutMail
        .To = "abc@xyz.com"
        .CC = ""
        .BCC = ""
        .Subject = "This is the Subject line"
        .Body = "Hi there"
        .Attachments.Add Fname
        .Send   'or use .Display
    End With
    On Error GoTo 0

    'Delete the gif file
    Kill Fname

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub

Example 2

This example sends a chart sheet with the name "Chart1" from the ActiveWorkbook.
It will save My_Sales2.gif the temp folder, send the mail and delete My_Sales2.gif after that.
Sub SaveSend_Chart_Sheet()

    Dim OutApp As Object
    Dim OutMail As Object
    Dim Fname As String

    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    'File path/name of the gif file
    Fname = Environ$("temp") & "\My_Sales2.gif"

    'Save Chart sheet named "Chart1" as gif file
    ActiveWorkbook.Sheets("Chart1").Export _
            Filename:=Fname, FilterName:="GIF"

    On Error Resume Next
    With OutMail
        .To = "abc@xyz.com"
        .CC = ""
        .BCC = ""
        .Subject = "This is the Subject line"
        .Body = "Hi there"
        .Attachments.Add Fname
        .Send   'or use .Display
    End With
    On Error GoTo 0

    'Delete the gif file
    Kill Fname

    Set OutMail = Nothing
    Set OutApp = Nothing
End Sub