Skip to content

Sampling From Group#144

Merged
jeff-hernandez merged 10 commits intolabel_selectfrom
sample_per_instance
Jun 23, 2020
Merged

Sampling From Group#144
jeff-hernandez merged 10 commits intolabel_selectfrom
sample_per_instance

Conversation

@jeff-hernandez
Copy link
Copy Markdown
Contributor

@jeff-hernandez jeff-hernandez commented Jun 12, 2020

Closes #124 by adding the parameter per_instance, which determines whether or not the sampling should be applied to each group. Working through the code, it made sense to make this parameter boolean. This added more functionality by allowing users to sample a fraction of the labels from each group.

Example

>>> lt
   entity labels
0       0      a
1       0      a
2       0      b
3       0      b
4       1      a
5       1      a
6       1      b
7       1      b
>>> frac = {'a': 1, 'b': .5}
>>> lt.sample(frac=frac, per_instance=True)
   entity labels
0       0      a
1       0      a
2       0      b
4       1      a
5       1      a
7       1      b

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 12, 2020

Codecov Report

Merging #144 into label_select will not change coverage.
The diff coverage is 100.00%.

@@              Coverage Diff               @@
##           label_select      #144   +/-   ##
==============================================
  Coverage        100.00%   100.00%           
==============================================
  Files                26        26           
  Lines              1048      1069   +21     
==============================================
+ Hits               1048      1069   +21     
Impacted Files Coverage Δ
composeml/label_times/object.py 100.00% <100.00%> (ø)
...mposeml/tests/test_label_transforms/test_sample.py 100.00% <100.00%> (ø)

@jeff-hernandez jeff-hernandez changed the title Adds parameter to sample labels from each group. Sampling From Group Jun 12, 2020
@jeff-hernandez jeff-hernandez linked an issue Jun 12, 2020 that may be closed by this pull request
@jeff-hernandez jeff-hernandez requested a review from frances-h June 22, 2020 17:52
Comment thread composeml/tests/test_label_transforms/test_sample.py Outdated
@jeff-hernandez jeff-hernandez requested a review from frances-h June 23, 2020 17:38
Copy link
Copy Markdown
Contributor

@frances-h frances-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jeff-hernandez jeff-hernandez merged commit af71218 into label_select Jun 23, 2020
jeff-hernandez added a commit that referenced this pull request Jun 23, 2020
@jeff-hernandez jeff-hernandez deleted the sample_per_instance branch June 26, 2020 19:55
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.

Sampling with a Label Dictionary

2 participants