Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you want to determine the elimination - by - aspects ( EBA ) choice of a consumer choosing from among P products, each having

Suppose you want to determine the elimination-by-aspects (EBA) choice
of a consumer choosing from among P products, each having A attributes. This is a noncompensatory choice prediction model. You are given the following data structures: a P-byA matrix containing the consumer's rating or performance of each product on each attribute, a
vector of length A containing the consumer's importance of each attribute, a vector of length
A giving the consumer's cutoff for each attribute (we are considering the general case where
it is possible for the consumer to have different cutoffs for different attributes). Write a
function called "apply_eba" that takes these three data structures as input arguments
and produces the elimination-by-aspects choice. So your function should be defined like the
following
def apply_eba(ratings_matrix, importances_1d_array, cutoffs_1d_array):
Your function should return an integer from the set {1,2,...,P} corresponding to the product
predicted to be purchased by EBA.
In EBA, if the rating of a product on a certain attribute is greater than or equal to the cutoff
for that attribute, then that product is NOT eliminated. If the rating is strictly less than the
cutoff then the product is eliminated.
It is important to note that in the EBA algorithm, one may run into situations where there are
ties or null sets. Your code needs to handle these as follows. When picking the next-most
important attribute, if there is more than one attribute with the highest level of
importance, then pick one of the attributes randomly with equal probability and proceed to
eliminate products on the basis of that attribute. When eliminating products that fall below
the performance rating cutoff on a certain attribute, if none of the remaining products meet
the cutoff then pick one of those remaining products randomly with equal probability and
take the resultant product to be the final choice of that consumer.
I will give you more points if you write this function without using explicit loops like "for",
"while", "repeat" or recursion. For even more points: Write the function without using any
"if" statement and also without using explicit loops. You can however use implicit loops like
in the "apply" family of functions in R or "map" function of python. Writing the function will
initially seem very complicated. You can write the code using explicit loops like "for",
"while", "repeat" or recursion if you don't want the extra points (beyond the points you will
already get for doing this task), but actually it is easier to write it without the explicit loops or
"if" statements, by using array operations. My own solution program to this task has only 6
lines of code and does not use explicit loops or the "if" statement. I mention this to let you
know that the code is actually quite simple to write if you think carefully about EBA and how
to structure it as array operations.
Because of the tie-breaking, there is randomness potentially involved so that each run of the
above apply_eba function may give a somewhat different output for the product chosen.
Therefore, in real-life applications, we usually average over multiple runs. Specifically, we
need to run the apply_eba function created above a large number of times (like 2000) and
then aggregate over all runs. For example, if the consumer is seen to buy product P, Q, R, S,
T, respectively, 620,320,400,310,350 times out of the 2000 runs, then we predict that the
consumer's probability of buying P, Q, R, S, T to be respectively 0.31,0.16,0.20,0.155,
0.175
Demonstrate that your code works correctly on the following two test cases:
Test Case 1: Here P=3 and A=4.
The P-by-A ratings matrix is
1,7,7,7
3,7,2,5
7,1,7,1
The vector of length A containing the importance of each attribute is
[9,55,12,24]
Finally, the vector of length A giving the cutoff for each attribute is
[2,2,2,2]
This test case corresponds to Product-Price Optimization Slides 6 and 7. We already know
from our class discussion that the correct answer is 2.
Test Case 2: Here P=5 and A=7.
The P-by-A ratings matrix is
1,1,2,3,4,5,5
3,4,2,7,3,5,3
2,4,3,4,6,4,3
4,1,4,3,5,6,6
3,1,6,6,4,6,4
The vector of length A containing the importance of each attribute is
17,9,9,13,22,26,4
Finally, the vector of length A giving the cutoff for each attribute is
[1.5,1.5,3.5,2.5,1.5,2.5,2.5]
This test case is more challenging because there is tiebreaking and randomness
involved. Hint to verify your answer. When you run your function 2000 times, you
should find that the second product is chosen approximately 25% percent of the time, so
that we predict that the consumer's probability of buying the second product to be
approximately 0.25.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

explain what is meant by the terms unitarism and pluralism

Answered: 1 week ago