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

[Feature Request] Request for weighted sampling in tf.data.Dataset #15999

Closed
niffler92 opened this issue Jan 10, 2018 · 12 comments
Closed

[Feature Request] Request for weighted sampling in tf.data.Dataset #15999

niffler92 opened this issue Jan 10, 2018 · 12 comments
Assignees
Labels
stat:awaiting response Status - Awaiting response from author type:feature Feature requests

Comments

@niffler92
Copy link

Are there any methods that we can sample with weights without pre-weighting the dataset as the input in Dataset API?

@mrry
Copy link
Contributor

mrry commented Jan 10, 2018

The only sampling-specific method in the API is tf.contrib.data.rejection_resample(). If that doesn't work for your application, can you specify what sampling operation you'd like? Like rejection_resample() it may be possible to build it out of existing parts, like Dataset.filter() and tf.contrib.data.scan().

@mrry mrry added stat:awaiting response Status - Awaiting response from author type:feature Feature requests labels Jan 10, 2018
@niffler92
Copy link
Author

I think explicit methods for giving weights corresponding to the label would be highly useful. e.g. Dataset.resample(label, weight)

@tensorflowbutler tensorflowbutler removed the stat:awaiting response Status - Awaiting response from author label Jan 23, 2018
@tensorflowbutler
Copy link
Member

The original poster has replied to this issue after the stat:awaiting response label was applied.

@mrry
Copy link
Contributor

mrry commented Jan 24, 2018

The tf.contrib.data.rejection_resample() transformation allows you to specify a mapping from Dataset elements to an integer class, and a vector of probabilities representing the target distribution (indexed by class) for the resampling. Can you be more specific about what a Dataset.resample() method would do in addition to this?

@mrry mrry added the stat:awaiting response Status - Awaiting response from author label Jan 24, 2018
@tensorflowbutler
Copy link
Member

Nagging Awaiting Response: It has been 14 days with no activityand the awaiting response label was assigned. Is this still an issue?

2 similar comments
@tensorflowbutler
Copy link
Member

Nagging Awaiting Response: It has been 14 days with no activityand the awaiting response label was assigned. Is this still an issue?

@tensorflowbutler
Copy link
Member

Nagging Awaiting Response: It has been 14 days with no activityand the awaiting response label was assigned. Is this still an issue?

@tensorflowbutler
Copy link
Member

It has been 14 days with no activity and the awaiting response label was assigned. Is this still an issue?

@jperl
Copy link
Contributor

jperl commented Mar 25, 2018

Is it possible to sample rows from our dataset using a custom distribution like tf.distributions.Exponential?

@lytkarinskiy
Copy link

Hello all,
I'm also interested if it's possible to batch elements from Dataset with distribution, so to pick last elements more often than elements in the begin of dataset.

I'm talking about numeric dataset made from tensor_slices with initial shape 1000103

In this case depending on distribution probability we'll take elements with index [999,:,:] more often than elements with index [1,:,:].

@reedwm reedwm assigned mrry and unassigned reedwm Apr 3, 2018
@tensorflowbutler
Copy link
Member

It has been 14 days with no activity and the awaiting response label was assigned. Is this still an issue?

@yifeif yifeif closed this as completed in c2643d1 Apr 17, 2018
@shreyaskamathkm
Copy link

Is there a workaround to create a weighted sampler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting response Status - Awaiting response from author type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

7 participants