SlideShare a Scribd company logo
Business
Analytics Using ‘R’
Types of Analytics
Types of Analytics Contd…
Descriptive and Diagnostic
Analytics
Function:
describe the main features of organizational data
Common tools:
sampling, mean, mode, median, standard deviation,
range, variance, stem and leaf diagram, histogram,
interquartile range, quartiles, and frequency distributions
Displaying results:
 graphics/charts, tables, and summary statistics such as
single numbers
 Function:
 draw conclusions and predict future behavior
 Common tools:
 cluster analysis, association analysis, multiple regression,
logistic regression, decision tree methods, neural
networks, text mining and forecasting tools (such as time
series and causal relationships)
Predictive Analytics
Function:
make decisions based on data
Common models:
linear programming
sensitivity analysis
integer programming
goal programming
nonlinear programming
simulation modeling
Prescriptive Analytics
Predictive
Analytics
Major Techniques
 Classification
Clustering
Association Mining
Regression
Classification
Classification Defined
The classification problem may be formalized
using a-posteriori probabilities:
 P(C|X) = prob. that the sample tuple
X=<x1,…,xk> is of class C.
E.g. P(class=N | outlook=sunny,windy=true,…)
Idea: assign to sample X the class label C such
that P(C|X) is maximal
Classification:
predicts categorical class labels
classifies data (constructs a model) based on the
training set and the values (class labels) in a
classifying attribute and uses it in classifying new data
Typical Applications
credit approval
target marketing
medical diagnosis
treatment effectiveness analysis
Classification
Classification—A Two-Step
Process
 Model construction: describing a set of predetermined
classes
Each tuple/sample is assumed to belong to a predefined class, as
determined by the class label attribute
The set of tuples used for model construction: training set
The model is represented as classification rules, decision trees, or
mathematical formulae
 Model usage: for classifying future or unknown objects
Estimate accuracy of the model
The known label of test sample is compared with the classified
result from the model
Accuracy rate is the percentage of test set samples that are
correctly classified by the model
Test set is independent of training set, otherwise over-fitting will
occur
Classification Process
(1): Model Construction
Training
Data
NAME RANK YEARS TENURED
Mike Assistant Prof 3 no
Mary Assistant Prof 7 yes
Bill Professor 2 yes
Jim Associate Prof 7 yes
Dave Assistant Prof 6 no
Anne Associate Prof 3 no
Classification
Algorithms
IF rank = ‘professor’
OR years > 6
THEN tenured = ‘yes’
Classifier
(Model)
Classification Process (2): Use
the Model in Prediction
Classifier
Testing
Data
NAME RANK YEARS TENURED
Tom Assistant Prof 2 no
Merlisa Associate Prof 7 no
George Professor 5 yes
Joseph Assistant Prof 7 yes
Unseen Data
(Jeff, Professor, 4)
Tenured?
Issues (1): Data Preparation
Data cleaning
Preprocess data in order to reduce noise and handle
missing values
Relevance analysis (feature selection)
Remove the irrelevant or redundant attributes
Data transformation
Generalize and/or normalize data
Issues (2): Evaluating
Classification Methods
Measurement
The Accuracy (AC) is the proportion of the
total number of predictions that were
correct.
Sensitivity or true positive rate (TP) is the
proportion of positive cases that were
correctly identified
Specificity : the proportion of actual
negative cases which are correctly
identified(TN).
Measurement Contd…
Decision Tree
Induction
Classification by Decision
Tree Induction
 Decision tree
A flow-chart-like tree structure
Internal node denotes a test on an attribute
Branch represents an outcome of the test
Leaf nodes represent class labels or class distribution
 Decision tree generation consists of two phases
Tree construction
At start, all the training examples are at the root
Partition examples recursively based on selected attributes
Tree pruning
Identify and remove branches that reflect noise or outliers
 Use of decision tree: Classifying an unknown sample
Test the attribute values of the sample against the decision tree
Training Dataset
age income student credit_rating
<=30 high no fair
<=30 high no excellent
31…40 high no fair
>40 medium no fair
>40 low yes fair
>40 low yes excellent
31…40 low yes excellent
<=30 medium no fair
<=30 low yes fair
>40 medium yes fair
<=30 medium yes excellent
31…40 medium no excellent
31…40 high yes fair
>40 medium no excellent
This
follows
an
example
from
Output: A Decision Tree for
“buys_computer”
age?
overcast
student? credit rating?
no yes fair
excellent
<=30 >40
no no
yes yes
yes
30..40
Extracting Classification
Rules from Trees
 Represent the knowledge in the form of IF-THEN rules
 One rule is created for each path from the root to a leaf
 Each attribute-value pair along a path forms a conjunction
 The leaf node holds the class prediction
 Rules are easier for humans to understand
 Example
IF age = “<=30” AND student = “no” THEN buys_computer = “no”
IF age = “<=30” AND student = “yes” THEN buys_computer = “yes”
IF age = “31…40” THEN buys_computer = “yes”
IF age = “>40” AND credit_rating = “excellent” THEN
buys_computer = “yes”
IF age = “>40” AND credit_rating = “fair” THEN buys_computer =
“no”
Bayesian Classification
Bayesian Theorem
Given training data D, posteriori probability of a
hypothesis h, P(h|D) follows the Bayes theorem
MAP (maximum posteriori) hypothesis
Practical difficulty: require initial knowledge of
many probabilities, significant computational
cost
)
(
)
(
)
|
(
)
|
(
D
P
h
P
h
D
P
D
h
P 
.
)
(
)
|
(
max
arg
)
|
(
max
arg h
P
h
D
P
H
h
D
h
P
H
h
MAP
h




Bayesian classification
The classification problem may be formalized
using a-posteriori probabilities:
 P(C|X) = prob. that the sample tuple
X=<x1,…,xk> is of class C.
Idea: assign to sample X the class label C such
that P(C|X) is maximal
Naïve Bayesian
Classification
Naïve assumption: attribute independence
P(x1,…,xk|C) = P(x1|C)·…·P(xk|C)
If i-th attribute is categorical:
P(xi|C) is estimated as the relative freq of
samples having value xi as i-th attribute in class
C
If i-th attribute is continuous:
P(xi|C) is estimated thru a Gaussian density
function
Computationally easy in both cases
Play-tennis example
Outlook Temperature Humidity Windy Class
sunny hot high false N
sunny hot high true N
overcast hot high false P
rain mild high false P
rain cool normal false P
rain cool normal true N
overcast cool normal true P
sunny mild high false N
sunny cool normal false P
rain mild normal false P
sunny mild normal true P
overcast mild high true P
overcast hot normal false P
rain mild high true N
outlook
P(sunny|p) = 2/9 P(sunny|n) = 3/5
P(overcast|p) = 4/9 P(overcast|n) = 0
P(rain|p) = 3/9 P(rain|n) = 2/5
temperature
P(hot|p) = 2/9 P(hot|n) = 2/5
P(mild|p) = 4/9 P(mild|n) = 2/5
P(cool|p) = 3/9 P(cool|n) = 1/5
humidity
P(high|p) = 3/9 P(high|n) = 4/5
P(normal|p) = 6/9 P(normal|n) = 2/5
windy
P(true|p) = 3/9 P(true|n) = 3/5
P(false|p) = 6/9 P(false|n) = 2/5
P(p) = 9/14
P(n) = 5/14
Play-tennis example:
classifying X
An unseen sample X = <rain, hot, high, false>
P(X|p)·P(p) =
P(rain|p)·P(hot|p)·P(high|p)·P(false|p)·P(p) =
3/9·2/9·3/9·6/9·9/14 = 0.010582
P(X|n)·P(n) =
P(rain|n)·P(hot|n)·P(high|n)·P(false|n)·P(n) =
2/5·2/5·4/5·2/5·5/14 = 0.018286
Sample X is classified in class n (don’t play)
Other Classification
Methods
k-nearest neighbor classifier
case-based reasoning
Genetic algorithm
Rough set approach
Fuzzy set approaches
Support Vector Machine (SVM)
Logistic Regression

More Related Content

PPT
Data Mining
PDF
NBaysian classifier, Naive Bayes classifier
PPT
Classification
PPTX
Dataming-chapter-7-Classification-Basic.pptx
PPT
Unit-4 classification
PPT
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
PPT
08 classbasic
PPT
08 classbasic
Data Mining
NBaysian classifier, Naive Bayes classifier
Classification
Dataming-chapter-7-Classification-Basic.pptx
Unit-4 classification
Data Mining:Concepts and Techniques, Chapter 8. Classification: Basic Concepts
08 classbasic
08 classbasic

Similar to Business Analytics using R.ppt (20)

PPTX
unit classification.pptx
PDF
08 classbasic
PPT
Chapter 08 ClassBasic.ppt file used for help
PPT
Data Mining Concepts and Techniques.ppt
PPT
Data Mining Concepts and Techniques.ppt
PPT
4_22865_IS465_2019_1__2_1_08ClassBasic.ppt
PDF
classification in data mining and data warehousing.pdf
PDF
classification-BIA-13122022-103948am-05102023-013341pm.pdf
PPT
Unit 3classification
PPT
classification in data warehouse and mining
PPT
Download presentation source
PPT
Dm bs-lec7-classification - dti
PPT
A General Framework for Accurate and Fast Regression by Data Summarization in...
PPT
Chapter 08 Class_Basic.ppt DataMinning
PDF
DSC603_ClassificationIntrointodatascience
PDF
Classification Techniques
PDF
Classification, Attribute Selection, Classifiers- Decision Tree, ID3,C4.5,Nav...
PPT
3_learning.ppt
PPTX
CST413 KTU S7 CSE Machine Learning Supervised Learning Classification Algorit...
PPTX
Data Science and Machine Learning with Tensorflow
unit classification.pptx
08 classbasic
Chapter 08 ClassBasic.ppt file used for help
Data Mining Concepts and Techniques.ppt
Data Mining Concepts and Techniques.ppt
4_22865_IS465_2019_1__2_1_08ClassBasic.ppt
classification in data mining and data warehousing.pdf
classification-BIA-13122022-103948am-05102023-013341pm.pdf
Unit 3classification
classification in data warehouse and mining
Download presentation source
Dm bs-lec7-classification - dti
A General Framework for Accurate and Fast Regression by Data Summarization in...
Chapter 08 Class_Basic.ppt DataMinning
DSC603_ClassificationIntrointodatascience
Classification Techniques
Classification, Attribute Selection, Classifiers- Decision Tree, ID3,C4.5,Nav...
3_learning.ppt
CST413 KTU S7 CSE Machine Learning Supervised Learning Classification Algorit...
Data Science and Machine Learning with Tensorflow
Ad

Recently uploaded (20)

PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PDF
Launch Your Data Science Career in Kochi – 2025
PPTX
Introduction to Knowledge Engineering Part 1
PPT
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
PPTX
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
PPTX
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Business Acumen Training GuidePresentation.pptx
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
Major-Components-ofNKJNNKNKNKNKronment.pptx
PPTX
1_Introduction to advance data techniques.pptx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPT
Reliability_Chapter_ presentation 1221.5784
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
Supervised vs unsupervised machine learning algorithms
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
Galatica Smart Energy Infrastructure Startup Pitch Deck
Launch Your Data Science Career in Kochi – 2025
Introduction to Knowledge Engineering Part 1
Chapter 2 METAL FORMINGhhhhhhhjjjjmmmmmmmmm
The THESIS FINAL-DEFENSE-PRESENTATION.pptx
05. PRACTICAL GUIDE TO MICROSOFT EXCEL.pptx
IB Computer Science - Internal Assessment.pptx
Business Acumen Training GuidePresentation.pptx
Business Ppt On Nestle.pptx huunnnhhgfvu
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Major-Components-ofNKJNNKNKNKNKronment.pptx
1_Introduction to advance data techniques.pptx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Reliability_Chapter_ presentation 1221.5784
oil_refinery_comprehensive_20250804084928 (1).pptx
Supervised vs unsupervised machine learning algorithms
Ad

Business Analytics using R.ppt

  • 4. Descriptive and Diagnostic Analytics Function: describe the main features of organizational data Common tools: sampling, mean, mode, median, standard deviation, range, variance, stem and leaf diagram, histogram, interquartile range, quartiles, and frequency distributions Displaying results:  graphics/charts, tables, and summary statistics such as single numbers
  • 5.  Function:  draw conclusions and predict future behavior  Common tools:  cluster analysis, association analysis, multiple regression, logistic regression, decision tree methods, neural networks, text mining and forecasting tools (such as time series and causal relationships) Predictive Analytics
  • 6. Function: make decisions based on data Common models: linear programming sensitivity analysis integer programming goal programming nonlinear programming simulation modeling Prescriptive Analytics
  • 10. Classification Defined The classification problem may be formalized using a-posteriori probabilities:  P(C|X) = prob. that the sample tuple X=<x1,…,xk> is of class C. E.g. P(class=N | outlook=sunny,windy=true,…) Idea: assign to sample X the class label C such that P(C|X) is maximal
  • 11. Classification: predicts categorical class labels classifies data (constructs a model) based on the training set and the values (class labels) in a classifying attribute and uses it in classifying new data Typical Applications credit approval target marketing medical diagnosis treatment effectiveness analysis Classification
  • 12. Classification—A Two-Step Process  Model construction: describing a set of predetermined classes Each tuple/sample is assumed to belong to a predefined class, as determined by the class label attribute The set of tuples used for model construction: training set The model is represented as classification rules, decision trees, or mathematical formulae  Model usage: for classifying future or unknown objects Estimate accuracy of the model The known label of test sample is compared with the classified result from the model Accuracy rate is the percentage of test set samples that are correctly classified by the model Test set is independent of training set, otherwise over-fitting will occur
  • 13. Classification Process (1): Model Construction Training Data NAME RANK YEARS TENURED Mike Assistant Prof 3 no Mary Assistant Prof 7 yes Bill Professor 2 yes Jim Associate Prof 7 yes Dave Assistant Prof 6 no Anne Associate Prof 3 no Classification Algorithms IF rank = ‘professor’ OR years > 6 THEN tenured = ‘yes’ Classifier (Model)
  • 14. Classification Process (2): Use the Model in Prediction Classifier Testing Data NAME RANK YEARS TENURED Tom Assistant Prof 2 no Merlisa Associate Prof 7 no George Professor 5 yes Joseph Assistant Prof 7 yes Unseen Data (Jeff, Professor, 4) Tenured?
  • 15. Issues (1): Data Preparation Data cleaning Preprocess data in order to reduce noise and handle missing values Relevance analysis (feature selection) Remove the irrelevant or redundant attributes Data transformation Generalize and/or normalize data
  • 17. Measurement The Accuracy (AC) is the proportion of the total number of predictions that were correct. Sensitivity or true positive rate (TP) is the proportion of positive cases that were correctly identified Specificity : the proportion of actual negative cases which are correctly identified(TN).
  • 20. Classification by Decision Tree Induction  Decision tree A flow-chart-like tree structure Internal node denotes a test on an attribute Branch represents an outcome of the test Leaf nodes represent class labels or class distribution  Decision tree generation consists of two phases Tree construction At start, all the training examples are at the root Partition examples recursively based on selected attributes Tree pruning Identify and remove branches that reflect noise or outliers  Use of decision tree: Classifying an unknown sample Test the attribute values of the sample against the decision tree
  • 21. Training Dataset age income student credit_rating <=30 high no fair <=30 high no excellent 31…40 high no fair >40 medium no fair >40 low yes fair >40 low yes excellent 31…40 low yes excellent <=30 medium no fair <=30 low yes fair >40 medium yes fair <=30 medium yes excellent 31…40 medium no excellent 31…40 high yes fair >40 medium no excellent This follows an example from
  • 22. Output: A Decision Tree for “buys_computer” age? overcast student? credit rating? no yes fair excellent <=30 >40 no no yes yes yes 30..40
  • 23. Extracting Classification Rules from Trees  Represent the knowledge in the form of IF-THEN rules  One rule is created for each path from the root to a leaf  Each attribute-value pair along a path forms a conjunction  The leaf node holds the class prediction  Rules are easier for humans to understand  Example IF age = “<=30” AND student = “no” THEN buys_computer = “no” IF age = “<=30” AND student = “yes” THEN buys_computer = “yes” IF age = “31…40” THEN buys_computer = “yes” IF age = “>40” AND credit_rating = “excellent” THEN buys_computer = “yes” IF age = “>40” AND credit_rating = “fair” THEN buys_computer = “no”
  • 25. Bayesian Theorem Given training data D, posteriori probability of a hypothesis h, P(h|D) follows the Bayes theorem MAP (maximum posteriori) hypothesis Practical difficulty: require initial knowledge of many probabilities, significant computational cost ) ( ) ( ) | ( ) | ( D P h P h D P D h P  . ) ( ) | ( max arg ) | ( max arg h P h D P H h D h P H h MAP h    
  • 26. Bayesian classification The classification problem may be formalized using a-posteriori probabilities:  P(C|X) = prob. that the sample tuple X=<x1,…,xk> is of class C. Idea: assign to sample X the class label C such that P(C|X) is maximal
  • 27. Naïve Bayesian Classification Naïve assumption: attribute independence P(x1,…,xk|C) = P(x1|C)·…·P(xk|C) If i-th attribute is categorical: P(xi|C) is estimated as the relative freq of samples having value xi as i-th attribute in class C If i-th attribute is continuous: P(xi|C) is estimated thru a Gaussian density function Computationally easy in both cases
  • 28. Play-tennis example Outlook Temperature Humidity Windy Class sunny hot high false N sunny hot high true N overcast hot high false P rain mild high false P rain cool normal false P rain cool normal true N overcast cool normal true P sunny mild high false N sunny cool normal false P rain mild normal false P sunny mild normal true P overcast mild high true P overcast hot normal false P rain mild high true N outlook P(sunny|p) = 2/9 P(sunny|n) = 3/5 P(overcast|p) = 4/9 P(overcast|n) = 0 P(rain|p) = 3/9 P(rain|n) = 2/5 temperature P(hot|p) = 2/9 P(hot|n) = 2/5 P(mild|p) = 4/9 P(mild|n) = 2/5 P(cool|p) = 3/9 P(cool|n) = 1/5 humidity P(high|p) = 3/9 P(high|n) = 4/5 P(normal|p) = 6/9 P(normal|n) = 2/5 windy P(true|p) = 3/9 P(true|n) = 3/5 P(false|p) = 6/9 P(false|n) = 2/5 P(p) = 9/14 P(n) = 5/14
  • 29. Play-tennis example: classifying X An unseen sample X = <rain, hot, high, false> P(X|p)·P(p) = P(rain|p)·P(hot|p)·P(high|p)·P(false|p)·P(p) = 3/9·2/9·3/9·6/9·9/14 = 0.010582 P(X|n)·P(n) = P(rain|n)·P(hot|n)·P(high|n)·P(false|n)·P(n) = 2/5·2/5·4/5·2/5·5/14 = 0.018286 Sample X is classified in class n (don’t play)
  • 30. Other Classification Methods k-nearest neighbor classifier case-based reasoning Genetic algorithm Rough set approach Fuzzy set approaches Support Vector Machine (SVM) Logistic Regression