Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
codecritic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ziyuan Nan
codecritic
Commits
6d8e17dc
Commit
6d8e17dc
authored
Oct 05, 2024
by
nzy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
step2 prepare_preference_dataset fix bug
parent
7c231b37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
step2_prepare_preference_dataset.py
+3
-3
No files found.
step2_prepare_preference_dataset.py
View file @
6d8e17dc
...
...
@@ -60,7 +60,7 @@ def calculate_edit_distances(problems):
return
list
(
chain
.
from_iterable
(
results
))
def
edit_distance
(
all_pairs
,
k
,
n
,
is_max
=
True
):
def
mk_edit_distance_dataset
(
all_pairs
,
k
,
n
,
is_max
=
True
):
"""
Top-k pairs with the maximum/minimum edit distance.
Each problem can contribute no more than n pairs.
...
...
@@ -96,7 +96,7 @@ if __name__ == "__main__":
all_edit_distance_pairs
=
calculate_edit_distances
(
problems
)
# Maximum distance
preference_pairs
,
metadata
=
edit_distance
(
preference_pairs
,
metadata
=
mk_edit_distance_dataset
(
all_edit_distance_pairs
,
10
*
1000
,
5
,
is_max
=
True
)
dataset_info
=
mk_dataset_info
(
"apps_max_edit_distance_prefrence"
)
...
...
@@ -113,7 +113,7 @@ if __name__ == "__main__":
)
# Minimum distance
preference_pairs
,
metadata
=
edit_distance
(
preference_pairs
,
metadata
=
mk_edit_distance_dataset
(
all_edit_distance_pairs
,
10
*
1000
,
5
,
is_max
=
False
)
dataset_info
=
mk_dataset_info
(
"apps_min_edit_distance_prefrence"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment