-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generators of the ShareShift test points. #111
base: main
Are you sure you want to change the base?
Conversation
This class generates p * m testing points v with: | ||
v[i] = s_i + s_i * a_k and | ||
v[j] = s_j - s_j / (sum(s) - s[i]) * (s_i * a_k) for j != i, | ||
iterating over 1 <= i <= p and k = 1, ..., m. Here, a_1, ..., a_m are a list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[a_1, ..., a_m] is a list
dataset: The DataSet for which test points are to be generated. | ||
campaign_spend_fractions: The campaign_spend / inventory_spend | ||
at each publisher, where each inventory_spend is given by | ||
dataset._max_spends. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to what Rieman recently suggested, probably add the dimension of each input argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, added. And also revised the description of this arg.
v = self._campaign_spends.copy() | ||
shift_amount = v[selected_pub] * shift_fraction | ||
if sum(v) - v[selected_pub] > 0: | ||
shift_proportions = v / (sum(v) - v[selected_pub]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this equation for um(v) - v[selected_pub] > 0 first appear? Based on the description in Returns, there seems no this definition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've now called it our in the description.
[1 / (self._npublishers - 1)] * self._npublishers | ||
) | ||
v += shift_proportions * shift_amount | ||
v[selected_pub] = self._campaign_spends[selected_pub] - shift_amount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After carefully reading, I can tell the codes are correct. The only issue is the codes might not be very easy to read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Hope it's better now with the updated descriptions.
for shift_fraction in self._shift_fraction_choices: | ||
point = self.one_testing_point(selected_pub, shift_fraction) | ||
if not any(point < 0): | ||
yield point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the definition in the previous function, the entries in point can be positive or negative. But here, you only care about the cases where all the entries of point are non-negative. Am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. We discard test points with any negative spend.
Suppose that the original spend vector is [s_1, ..., s_p]. | ||
This class generates p * m testing points v with: | ||
v[i] = s_i + s_i * a_k and | ||
v[j] = s_j - s_j / (sum(s) - s[i]) * (s_i * a_k) for j != i, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notation here seems a bit confused. In particular, v is still a p-dimensional vector. Given an a_k, we obtain p entries, i.e., v and s have the same dimension. Then enumerating over a_1, a_2, ..., a_m, we obtain a total of pm data points. It is better not to say pm testing points v, because usually it means v has p*m entries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Chenwei. Motivated by your comments, I've updated the description of this class. Please take another look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Chenwei! I improved descriptions following your comments, ptal.
Suppose that the original spend vector is [s_1, ..., s_p]. | ||
This class generates p * m testing points v with: | ||
v[i] = s_i + s_i * a_k and | ||
v[j] = s_j - s_j / (sum(s) - s[i]) * (s_i * a_k) for j != i, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Chenwei. Motivated by your comments, I've updated the description of this class. Please take another look.
dataset: The DataSet for which test points are to be generated. | ||
campaign_spend_fractions: The campaign_spend / inventory_spend | ||
at each publisher, where each inventory_spend is given by | ||
dataset._max_spends. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, added. And also revised the description of this arg.
v = self._campaign_spends.copy() | ||
shift_amount = v[selected_pub] * shift_fraction | ||
if sum(v) - v[selected_pub] > 0: | ||
shift_proportions = v / (sum(v) - v[selected_pub]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I've now called it our in the description.
[1 / (self._npublishers - 1)] * self._npublishers | ||
) | ||
v += shift_proportions * shift_amount | ||
v[selected_pub] = self._campaign_spends[selected_pub] - shift_amount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Hope it's better now with the updated descriptions.
for shift_fraction in self._shift_fraction_choices: | ||
point = self.one_testing_point(selected_pub, shift_fraction) | ||
if not any(point < 0): | ||
yield point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. We discard test points with any negative spend.
No description provided.