0% found this document useful (0 votes)
95 views46 pages

Isom 3400 - Python For Business Analytics 1. Intro To Python

This document provides an introduction and overview of a course on Python for business analytics. It begins with introductions of the instructor and their research interests. It then discusses why learning programming and Python is important for abstract thinking, problem solving, and careers in data science. The document outlines the popularity and advantages of Python, including its large standard library, packages, and support from users and companies. It also notes some disadvantages of Python related to speed and memory usage. Finally, it provides an overview of business analytics and machine learning, distinguishing between supervised and unsupervised learning approaches.

Uploaded by

denny
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
95 views46 pages

Isom 3400 - Python For Business Analytics 1. Intro To Python

This document provides an introduction and overview of a course on Python for business analytics. It begins with introductions of the instructor and their research interests. It then discusses why learning programming and Python is important for abstract thinking, problem solving, and careers in data science. The document outlines the popularity and advantages of Python, including its large standard library, packages, and support from users and companies. It also notes some disadvantages of Python related to speed and memory usage. Finally, it provides an overview of business analytics and machine learning, distinguishing between supervised and unsupervised learning approaches.

Uploaded by

denny
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 46

ISOM 3400 – PYTHON FOR BUSINESS ANALYTICS

1. Intro to Python
Yingpeng Robin Zhu

JUN 20, 2022

1
About Me

 Zhu, Yingpeng (Robin)


 Ph.D. Candidate, Information Systems, Department of ISOM
 Research Interests
 Topics: User Generated Content, Digital Platform, Social Media, Email Marketing,
Recommendation Systems, Explainable Artificial Intelligence (XAI)
 Methodologies: Causal Inference, Machine Learning, Text Mining, Natural/Field
Experiments
 Hobbies  Hate Speech Detection (Text analysis+
 Basketball, Hiking, Gym, Shopping network analysis), with Yi Yang
 Financial Fraud Detection (Text analysis+
 TA: Someya Singh behavioral data analysis), with Yi Yang

2
Course Group

3
Why Learning Programming?

4
Why Learning Programming?

“Learning to code not only allows you to give


machines instructions, but it also teaches you abstract
thinking and problem-solving. In fact, problem-solving
skills and creativity are key to becoming a successful
computer programmer.”

5
About programming

“Everyone in this country should learn how to program


because it teaches you how to think”
– Steve Jobs

6
Top 10 Programming Languages for 2022

7
Top 10 Programming Languages for 2022

 According to Stack Overflow, Python is the most


popular backend programming language and the
most wanted technology

 It is also the most popular language for Data


Scientists and Machine Learning Engineers

 Although Python is 30 years old, it’s still growing in


popularity
TIOBE Index: TIOBE ratings are calculated by counting hits of the
most popular search engines

Reference: https://nexttechnology.io/top-10-programming-languages-for-2022/

8
Why Python?

Python is incredibly easy to program

9
Why Python?

10
Why Python?

Python “comes with batteries”. It has comprehensive built-in


library called standard library, including modules that provide:

 Numeric and math-related functions and data types


 Routines for interfacing with the operating system
 Text processing operations
 Networking and Internet data handling tools
 Structured markup processing tools

11
Why Python?

Python has a large collection of add-on modules, packages, and


toolkits

Notable others: Natural Language Toolkit for natural language processing,


Beautiful Soup for Web scraping, Django for Web application
development, the Python Imaging Library for complex image processing
12
Why Python?

Python enables rapid prototyping and iteration


 It suits quick scripting as well as building large systems
 It bridges the gap between research and production

Python has a healthy, active and supportive community


 It has a large community of users, easy to find help and documentations
 It has corporate sponsors
 Google even has a developer portal devoted to Python, with free classes offered including
exercises, lecture videos

https://www.python.org/community/

13
Why Python?

Python has become a formidable language in data science and


artificial intelligence fields
 It is one of the most popular languages used in data science
 It is leading the way in deep learning area

14
Why Python?

Python clients

Demand Engineering
Information Security
Personalization Algorithms
……
15
Is Python Perfect?

Anyone know any disadvantage of Python?

Speed: relatively slow as a script type of code


 e.g., If you write a small application to download MP3 in C or C++, it might take
0.001 seconds to run, but might take 0.1 seconds to run in Python. Can you tell the
difference? Especially considering network delay?
Weak in mobile development
 Very few mobile apps are developed by Python
 Libraries like Kivy and Beeware were developed to serve the purpose of creating
mobile applications using Python
Memory Consumption
 Python is not a good choice for memory intensive tasks. Due to the flexibility of the
data-types, Python's memory consumption is relatively high
16
Is Python Perfect?

C++ is around 100 times faster than Python when executing code for the same task!

https://www.youtube.com/watch?v=jeg1haA3Eis

17
Python

18
Business Analytics

Broadly speaking, business analytics (BA) refers to the application of


evidence-based logical and computational reasoning to business activities
to gain insights and drive business decision making

19
Why Business Analytics Is Important?

Business analytics can help companies make better, more informed


decisions and achieve a variety of goals

By leveraging data, businesses can:


 Better understand consumer behavior
 Gain insight into their competitors
 Identify market trends
 Measure accomplishments against goals
 Optimize operations

20
Types of Business Analytics

Bar chart

Pie chart Line chart

21
Business Analytics / Machine Learning

INFORM DECISION
DATA
ATION MAKING

STATISTICAL
MODEL

22
Two Main Categories of Machine Learning

 Supervised learning: making predictions using data


 Is an email a ‘spam’ or ‘ham’?
 How much will sale increase if we spend a certain amount on ads?
 There is a specific outcome that we are trying to predict

 Unsupervised learning: extracting structure from data or best


represent data
 Segment grocery shoppers to clusters with similar behavior
 Identify associations between items
 There is no right or wrong answer

23
How Does Supervised Learning Works?

 Step 1: Has a set of features measured on observations, and a


response also measured on observations
 Step 2: Model training (train a machine learning model using
labeled data)
 Step 3: Make prediction on new data (for which the label is
unknown)
 Step 4: Evaluate the accuracy of the model (percentage of
correct prediction using labeled data)

24
How Does Supervised Learning Works?

Classification

25
How Does Supervised Learning Works?

Regression

26
Examples of Supervised Learning

Face Detection Spam Detection

Other Examples?

Stock Price Prediction


27
How Does Unsupervised Learning Works?

 Step 1: Has a set of features measured on observations, but


there is no response
 Step 2: To discover interesting things/relationships about the
measurements on

 Perform unsupervised analysis


 Clustering analysis
 Association analysis

28
Examples of Unsupervised Learning

Clustering analysis – identify groups in a dataset that share


common characteristics
 E.g., For marketing purpose, we want to identify different groups of
clients/customers according to their observed characteristics

High debt, low income

Low debt, low income

High income, low debt

29
Examples of Unsupervised Learning

Association analysis – discovering relationship among huge data


sets
 E.g., The famous market basket analysis which gives a relationship between {Diapers
<-> beer}. It says that whenever a person buys diapers, he/she also buys beer

30
Examples of Unsupervised Learning

Other Examples?

31
Going Back To The Course

In this course, we will apply Python language enabled with packages


such as pandas to build machine learning model in order to analyze
the business problem

32
Going Back To The Course
(3) Preparation:
3-1. Anaconda. As we will learn python programming, therefore, I strongly encourage you to have the python
program installed on your personal computer. I would recommend python 3.x (instead of 2.x) version. As
creating a working environment is time-consuming, we can download and install a Python distribution such as
Anaconda. Anaconda is the most complete Python distribution. To check how to install Anaconda, please check
https://www.datacamp.com/tutorial/installing-anaconda-windows (Links to an external site.) (Windows) or
https://problemsolvingwithpython.com/01-Orientation/01.04-Installing-Anaconda-on-MacOS/
3-2. Jupyter Notebook. We will demonstrate our code through Jupyter Notebook, which allows you to create
and edit documents that display the input and output of a Python or R language script. You can easily access
Jupyter Notebook in Anaconda, please see
https://docs.anaconda.com/ae-notebooks/4.3.1/user-guide/basic-tasks/apps/jupyter/
3-3. Other Approaches. You can also install python and Jupyter Notebook through any other approach that you
want. The only thing that matters is that you make sure you have python and Jupyter Notebook installed on
your personal computer and they can work.

33
Python Installation On Windows
Step 1: Select Version of Python to Install

The installation procedure involves downloading the


official Python .exe installer and running it on your system.

The version you need depends on what you want to do in


Python. For example, if you are working on a project
coded in Python version 2.6, you probably need that
version. If you are starting a project from scratch, you
have the freedom to choose.

If you are learning to code in Python, we recommend you


download both the latest version of Python 2 and 3.
Working with Python 2 enables you to work on older
projects or test new projects for backward compatibility.

34
Python Installation On Windows
Step 2: Download Python Executable Installer

1.Open your web browser and navigate to the 


Downloads for Windows section of the 
official Python website.

2.Search for your desired version of Python. At the time of


publishing this article, the latest Python 3 release is
version 3.7.3, while the latest Python 2 release is version
2.7.16.

3.Select a link to download either the Windows x86-64


executable installer or Windows x86 executable installer.
The download is approximately 25MB.

35
Python Installation On Windows
Step 2: Download Python Executable Installer

1.Open your web browser and navigate to the 


Downloads for Windows section of the 
official Python website.

2.Search for your desired version of Python. At the time of


publishing this article, the latest Python 3 release is
version 3.7.3, while the latest Python 2 release is version
2.7.16.

3.Select a link to download either the Windows x86-64


executable installer or Windows x86 executable installer.
The download is approximately 25MB.

36
Python Installation On Windows
Step 3: Run Executable Installer

1.Run the Python Installer once downloaded. (In this


example, we have downloaded Python 3.7.3.)

2.Make sure you select the Install launcher for all


users and Add Python 3.7 to PATH checkboxes.

3. Select Install Now – the recommended installation


options.

37
Python Installation On Windows
Step 3: Run Executable Installer

1.Run the Python Installer once downloaded. (In this


example, we have downloaded Python 3.7.3.)

2.Make sure you select the Install launcher for all


users and Add Python 3.7 to PATH checkboxes.

3. Select Install Now – the recommended installation


options.

38
Python Installation On Windows
Step 3: Verify Python Was Installed On Windows

https://phoenixnap.com/kb/how-to-install-python-3-windows
39
Python Installation On Mac

 On Mac, Python is automatically included

 We can type Python statements and have them immediately


executed at the interactive prompt

40
Install Package

Python does not come bundled with everything we need

The Python Package Index (PyPI for short) is a large repository of


Python packages

Install packages from this repository using a tool like pip at the
system prompt
 pip install pandas

41
Environment

Creating a working environment is time-consuming

Instead, we can download and install a Python distribution,


which provides a fully working Python environment that is ready
to use

Anaconda is the most complete Python distribution


 It includes nearly 200 packages, which comprises NumPy, SciPy, pandas, Jupyter,
Matplotlib, Scikit-learn, and NLTK
 Its base version is free, with add-ons that contain advanced features being charged
separately
42
Environment

43
Jupyter Notebook

44
Lab Session 1

Take a screen shoot to show that you have successfully installed Python
Email me and I will record your credit

45
Jupyter Notebook

46

You might also like