Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jiayu-google
Copy link
Contributor

No description provided.

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
Copy link

@chenweiw chenweiw May 9, 2022

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.
Copy link

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?

Copy link
Contributor Author

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])
Copy link

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?

Copy link
Contributor Author

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
Copy link

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.

Copy link
Contributor Author

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
Copy link

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?

Copy link
Contributor Author

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,
Copy link

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@jiayu-google jiayu-google left a 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,
Copy link
Contributor Author

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.
Copy link
Contributor Author

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])
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

@jiayu-google jiayu-google requested a review from chenweiw May 11, 2022 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants