Answered step by step
Verified Expert Solution
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 eliminationbyaspects 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 PbyA 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 "applyeba" that takes these three data structures as input arguments
and produces the eliminationbyaspects choice. So your function should be defined like the
following
def applyebaratingsmatrix, importancesdarray, cutoffsdarray:
Your function should return an integer from the set 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 nextmost
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
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 tiebreaking, there is randomness potentially involved so that each run of the
above applyeba function may give a somewhat different output for the product chosen.
Therefore, in reallife applications, we usually average over multiple runs. Specifically, we
need to run the applyeba function created above a large number of times like and
then aggregate over all runs. For example, if the consumer is seen to buy product P Q R S
T respectively, times out of the runs, then we predict that the
consumer's probability of buying P Q R S T to be respectively
Demonstrate that your code works correctly on the following two test cases:
Test Case : Here P and A
The PbyA ratings matrix is
The vector of length A containing the importance of each attribute is
Finally, the vector of length A giving the cutoff for each attribute is
This test case corresponds to ProductPrice Optimization Slides and We already know
from our class discussion that the correct answer is
Test Case : Here P and A
The PbyA ratings matrix is
The vector of length A containing the importance of each attribute is
Finally, the vector of length A giving the cutoff for each attribute is
This test case is more challenging because there is tiebreaking and randomness
involved. Hint to verify your answer. When you run your function times, you
should find that the second product is chosen approximately percent of the time, so
that we predict that the consumer's probability of buying the second product to be
approximately
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started