Professional Documents
Culture Documents
Explanation of The Market Basket Model
Explanation of The Market Basket Model
Explanation of The Market Basket Model
RStat (opener.htm) > Building a Market Basket Model (marketbasket48.htm) > Explanation of the Market Basket Model
How to:
Generate Rules
Reference:
In the following table (table 1), there are nine baskets containing
varying combinations of milk, cheese, apples, and
bananas.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 1/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
The second measure called the confidence of the rule is the ratio
of the number of transactions that include all items
in {B} as well
as the number of transactions that include all items in {A} to the
number of transactions that include all
items in {A}.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 2/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
The third measure called the lift or lift ratio is the ratio
of confidence to expected confidence. Expected confidence is
the
confidence divided by the frequency of B. The Lift tells us how
much better a rule is at predicting the result than
just assuming
the result in the first place. Greater lift values indicate stronger
associations.
Retail. In
Retail, Market Basket Analysis can help determine what items are
purchased together, purchased
sequentially, and purchased by season.
This can assist retailers to determine product placement and
promotion
optimization (for instance, combining product incentives). Does
it make sense to sell soda and
chips or soda and crackers?
Telecommunications. In
Telecommunications, where high churn rates continue to be a growing
concern,
Market Basket Analysis can be used to determine what services
are being utilized and what packages
customers are purchasing. They
can use that knowledge to direct marketing efforts at customers
who are
more likely to follow the same path.
Banks. In
Financial (banking for instance), Market Basket Analysis can be
used to analyze credit card
purchases of customers to build profiles
for fraud detection purposes and cross-selling opportunities.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 3/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
Insurance. In
Insurance, Market Basket Analysis can be used to build profiles
to detect medical insurance
claim fraud. By building profiles of
claims, you are able to then use the profiles to determine if more
than 1
claim belongs to a particular claimee within a specified
period of time.
Medical. In
Healthcare or Medical, Market Basket Analysis can be used for comorbid
conditions and
symptom analysis, with which a profile of illness
can be better identified. It can also be used to reveal
biologically
relevant associations between different genes or between environmental
effects and gene
expression.
Data Requirement
1. Baskets
2. Products
In
this example, we are going to create a model for Market Basket Analysis
of purchases at a grocery store. We will
use the Basket data set
that contains observations on the purchases of particular items,
such as milk, cheese, and
apples.
1. Define the
Model Data.
Select BASKET as
the Ident variable, which defines the basket.
Click Execute to
run the Model Data.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 4/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
Click Execute to
run the Model Data.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 5/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
This
is a summary of the settings that come with the apriori algorithm.
Except for Support and Confidence,
which you can change in the GUI,
the remaining settings are set to default values.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 6/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
parameter specification:
confidence minival smax arem aval originalSupport support minlen maxlen target e
.01 0.1 1 none FALSE TRUE 0.1 1 5 rules F
Control parameters
(control) influence the performance of the algorithm (for example,
enable or disable
initial sorting of the items with respect to their frequency).
algorithmic control:
Note: For
more information on the apriori algorithm parameters, see the R documentation
for the arules package at:
http://cran.r-project.org/web/packages/arules/arules.pdf (http://cran.r-project.org/web/packages/arules/arules.pdf).
To generate
rules, click the Show Rules button.
The
output will be printed below the original information presented.
The
LHS is the Antecedent ({A} from the example above).
The
RHS is the Consequent ({B} from the example above).
Support
says that 67% of customers purchased milk and cheese.
Confidence
is that 100% of the customers that bought milk also bought cheese.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 7/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
To
generate a frequency plot, click the Freq Plot button.
The output appears in a new window. This frequency plot
shows the percent
of times each unique item occurs in all baskets.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 8/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
To
execute the Market Basket Analysis:
1. Load the Baskets data set into RStat. For more information
on loading data into RStat, see Getting Started
With RStat (GettingStarted15.htm#WS376cda1d0d48fca6-2a9804f911f294651dc-778b).
2. Disable
sampling by clearing the Partition check box.
3. For the
Target Data Type, leave the Auto radio button selected.
4. Select NUMBER as
the Ident variable.
5. Select X_IF_PRODUCT as
the Target variable.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 9/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
6. Ignore all
of the remaining variables.
7. Click Execute.
To
export the Market Basket Analysis:
1. Click Export.
There
are two export types that can be selected:
Item. Exports
rules that will determine the products in the new data set.
Confidence. Exports
the confidence number for the products that are selected in the
result.
3. Create a
scoring file to run the Market Basket Analysis rules against.
This will show the format and file structure for the scoring
data set. The Max Inputs for the scoring file should
be the total
items in the training data set minus 1.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 10/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
b. Using the Upload Data option in App Studio, create a Master File, as shown in the following image.
Note: The Upload Data option allows you to upload new data to an application, creating a new, unique
Master File. Define or create
a data source, right-click a folder from the relevant application folder, and
then click Upload Data. The Reporting Server Console opens and you then select a file to upload. The
Business View and Prepared result display.
On the ribbon, click Load and Next, set your load options,
and then click Proceed to Load to create the Master File in your repository. For more information on
uploading data, see the Business Intelligence Portal manual.
The
following image shows the output that is generated for the sample WebFOCUS
report in a web
browser.
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 11/12
1/9/22, 8:04 PM Explanation of the Market Basket Model
In the
first case, item 2 is empty, so the suggested item is Milk for people
who only purchase Cheese. In the
second case, Beer is not within
the historical data for generating the rules, so No match found is
returned.
This means that there is no product recommendation for
people who purchase Beer. The result of the third
case indicates
that people who purchase Milk and Apples will also purchase Cheese.
This is followed by a
confidence value that shows the possibility
of buying Cheese after purchasing Milk and Apples together.
WebFOCUS
Feedback
(http://documentation.informationbuilders.com/WFHelpFeedback/feedback.asp)
https://webfocusinfocenter.informationbuilders.com/wfappent/TLs/TL_rstat/source/marketbasket49.htm 12/12