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

Update validation logic following email discussion w Kelly and Megan #107

Merged
merged 2 commits into from
Jun 18, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/corporacreator/corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,26 @@ def _preprocessor_wrapper(self, client_id, sentence, up_votes, down_votes):
return pd.Series([sentence, up_votes, down_votes])

def _partition_corpus_data(self):
# If there are < 2 votes, or 2 opposing votes
# there is not enough information to make a determination
self.other = self.corpus_data.loc[
lambda df: (df.up_votes + df.down_votes) <= 1, :
lambda df: (df.up_votes + df.down_votes <= 1)
| ((df.up_votes == 1) & (df.down_votes == 1)), :
]
# If there are 2+ votes, and up_votes > down_votes, clip is valid
self.validated = self.corpus_data.loc[
lambda df: (df.up_votes + df.down_votes > 1)
& (df.up_votes > df.down_votes),
:,
]
# If there are 2+ votes, and down_votes > up_votes, clip is invalid
# If there are 3+ votes, and up_votes == down_votes, opinions
# are diverging too much to be relied upon, and clip is invalid
self.invalidated = self.corpus_data.loc[
lambda df: (df.up_votes + df.down_votes > 1)
& (df.up_votes <= df.down_votes),
& (df.up_votes < df.down_votes)
| ((df.up_votes == df.down_votes)
& (df.up_votes + df.down_votes > 2)),
phirework marked this conversation as resolved.
Show resolved Hide resolved
:,
]

Expand Down