satvik-dixit
commited on
Uploaded MBPP
Browse files- MBPP_eval_results.json +26 -0
- MBPP_metrics.json +16 -0
MBPP_eval_results.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"Question": "Write a python function to remove first and last occurrence of a given character from the string. Your code should satisfy these tests:\n\nassert remove_Occ(\"hello\",\"l\") == \"heo\"\nassert remove_Occ(\"abcda\",\"a\") == \"bcd\"\nassert remove_Occ(\"PHP\",\"P\") == \"H\"",
|
4 |
+
"Uncleaned_Prediction": "W",
|
5 |
+
"Prediction": "a python function to remove first and last occurrence of a given character from the string. Your code should satisfy these tests:\n\nassert remove_Occ(\"hello\",\"l\") == \"heo\"\nassert remove_Occ(\"abcda\",\"a\") == \"bcd\"\nassert remove_Occ(\"PHP\",\"P\") == \"H\"\nassert remove_Occ(\"Python\",\"t\") == \"Pyth\"\nassert remove_Occ(\"test\",\"z\") == \"test\"\n\ndef remove_Occ(s, c):\n # Your code here\n pass\n\n# Test cases\nprint(remove_Occ(\"hello\",\"l\"))\nprint(remove_Occ(\"abcda\",\"a\"))\nprint(remove_Occ(\"PHP\",\"P\"))\nprint(remove_Occ(\"Python\",\"t\"))\nprint(remove_Occ(\"test\",\"z\"))\n\n# Function to test the code\ndef test_remove_Occ():\n assert remove_Occ(\"hello\",\"l\") == \"heo\"\n assert remove_Occ(\"abcda\",\"a\") == \"bcd\"\n assert remove_Occ(\"PHP\",\"P\") == \"H\"\n assert remove_Occ(\"Python\",\"t\") == \"Pyth\"\n assert remove_Occ(\"test\",\"z\") == \"test\"\n\ntest_remove_Occ()\n\n# Run the test\nif __name__ == \"__main__\":\n test_remove_Occ()\n\n# This code will pass if the function is defined correctly.\n# If there is a problem, it will raise an AssertionError.\n# The test_remove_Occ() function is used to test the function.\n# If the function is implemented correctly, the test_remove_Occ() function will not raise any AssertionError.\n# The function remove_Occ() is used to remove the first and last occurrence of a given character from the string.\n# The function test_remove_Occ() is used to test the function.\n# The if __name__ == \"__main__\": line is used to run the test.\n# If the function is implemented correctly, the test will pass.\n# If the function is not implemented correctly, the test will fail.\n# The function remove_Occ() is used to remove the first and last occurrence of a given character from the string.\n# The function test_remove_Occ() is used to test the function.\n# The if __name__ == \"__main__\": line is used to run the test.\n# If the function is implemented correctly, the test will pass.\n# If the function is not implemented correctly, the test will fail.\n# The function remove_",
|
6 |
+
"Answer": "def remove_Occ(s,ch): \n for i in range(len(s)): \n if (s[i] == ch): \n s = s[0 : i] + s[i + 1:] \n break\n for i in range(len(s) - 1,-1,-1): \n if (s[i] == ch): \n s = s[0 : i] + s[i + 1:] \n break\n return s "
|
7 |
+
},
|
8 |
+
{
|
9 |
+
"Question": "Write a function to sort a given matrix in ascending order according to the sum of its rows. Your code should satisfy these tests:\n\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\nassert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]",
|
10 |
+
"Uncleaned_Prediction": "W",
|
11 |
+
"Prediction": "a function to sort a given matrix in ascending order according to the sum of its rows. Your code should satisfy these tests:\n\nassert sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]])==[[1, 1, 1], [1, 2, 3], [2, 4, 5]]\nassert sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]])==[[-2, 4, -5], [1, -1, 1], [1, 2, 3]]\nassert sort_matrix([[5,8,9],[6,4,3],[2,1,4]])==[[2, 1, 4], [6, 4, 3], [5, 8, 9]]\nassert sort_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])==[[7, 8, 9], [1, 2, 3], [4, 5, 6]]\nassert sort_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])==[[7, 8, 9], [1, 2, 3], [4, 5, 6]]\n\ndef sort_matrix(matrix):\n # Your code here\n\n# Test cases\nprint(sort_matrix([[1, 2, 3], [2, 4, 5], [1, 1, 1]]))\nprint(sort_matrix([[1, 2, 3], [-2, 4, -5], [1, -1, 1]]))\nprint(sort_matrix([[5,8,9],[6,4,3],[2,1,4]]))\nprint(sort_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))\nprint(sort_matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]))\n\nThe function should return a new matrix where the rows are sorted in ascending order according to the sum of their elements.\n\nNote: The sum of a row is the sum of all the elements in the row.\n\nFor example, the sum of the row [1, 2, 3] is 1+2+3 = 6, the sum of the row [4, 5, 6] is 4+5+6 = 15, and the sum of the row [7, 8, 9] is 7+8+9 = 24.\n\nThe function should return a new matrix where the rows are sorted in ascending order according to the sum of their elements.\n\nFor example, the sum of the row [1, 2, 3] is 1+2+3 = 6, the sum of the row [",
|
12 |
+
"Answer": "def sort_matrix(M):\n result = sorted(M, key=sum)\n return result"
|
13 |
+
},
|
14 |
+
{
|
15 |
+
"Question": "Write a function to count the most common words in a dictionary. Your code should satisfy these tests:\n\nassert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink','pink','red','red','white','orange','white',\"black\",'pink','green','green','pink','green','pink','white','orange',\"orange\",'red']) == [('pink', 6), ('black', 5), ('white', 5), ('red', 4)]\nassert count_common(['one', 'two', 'three', 'four', 'five', 'one', 'two', 'one', 'three', 'one']) == [('one', 4), ('two', 2), ('three', 2), ('four', 1)]\nassert count_common(['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google', 'Apple', 'Netflix', 'Amazon']) == [('Apple', 2), ('Amazon', 2), ('Netflix', 2), ('Facebook', 1)]",
|
16 |
+
"Uncleaned_Prediction": "W",
|
17 |
+
"Prediction": "a function to count the most common words in a dictionary. Your code should satisfy these tests:\n\nassert count_common(['red','green','black','pink','black','white','black','eyes','white','black','orange','pink','pink','red','red','white','orange','white',\"black\",'pink','green','green','pink','green','pink','white','orange',\"orange\",'red']) == [('pink', 6), ('black', 5), ('white', 5), ('red', 4)]\nassert count_common(['one', 'two', 'three', 'four', 'five', 'one', 'two', 'one', 'three', 'one']) == [('one', 4), ('two', 2), ('three', 2), ('four', 1)]\nassert count_common(['Facebook', 'Apple', 'Amazon', 'Netflix', 'Google', 'Apple', 'Netflix', 'Amazon']) == [('Apple', 2), ('Amazon', 2), ('Netflix', 2), ('Facebook', 1)]\nassert count_common(['a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e', 'a', 'b', 'c', 'd', 'e']) == [('a', 2), ('b', 2), ('c', 2), ('d', 2), ('e', 2)]\nassert count_common(['a', 'b', 'c', 'd', 'e']) == [('a', 1), ('b', 1), ('c', 1), ('d', 1), ('e', 1)]\nassert count_common([]) == []\n\nNote: The function should return the most common words in the list, sorted in descending order of their frequency. If there are multiple words with the same frequency, they should all be returned.\n\nHere is a Python solution:\n\n```python\ndef count_common(words):\n from collections import Counter\n c = Counter(words)\n max_count = max(c.values())\n common_words = [(k, v) for k, v in c.items() if v == max_count]\n common_words.sort(key=lambda x: (-x[1], x[0]))\n return common_words\n```\n\nThis function first counts the frequency of each word in the list using the Counter class from the collections module. It then finds the maximum frequency and creates a list of tuples, where each tuple contains a word and its frequency. The list is then sorted in descending order of frequency and in ascending order of word.\n",
|
18 |
+
"Answer": "from collections import Counter\ndef count_common(words):\n word_counts = Counter(words)\n top_four = word_counts.most_common(4)\n return (top_four)\n"
|
19 |
+
},
|
20 |
+
{
|
21 |
+
"Question": "Write a python function to find the volume of a triangular prism. Your code should satisfy these tests:\n\nassert find_Volume(10,8,6) == 240\nassert find_Volume(3,2,2) == 6\nassert find_Volume(1,2,1) == 1",
|
22 |
+
"Uncleaned_Prediction": "W",
|
23 |
+
"Prediction": "a python function to find the volume of a triangular prism. Your code should satisfy these tests:\n\nassert find_Volume(10,8,6) == 240\nassert find_Volume(3,2,2) == 6\nassert find_Volume(1,2,1) == 1\nassert find_Volume(1,1,1) == 1\nassert find_Volume(0,0,0) == 0\nassert find_Volume(1,0,0) == 0\nassert find_Volume(0,1,0) == 0\nassert find_Volume(0,0,1) == 0\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,1,1) == 1\nassert find_Volume(10,10,10) == 1000\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_Volume(1,2,3) == 6\nassert find_",
|
24 |
+
"Answer": "def find_Volume(l,b,h) : \n return ((l * b * h) / 2) "
|
25 |
+
}
|
26 |
+
]
|
MBPP_metrics.json
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"recall": 0.3128284758719541,
|
3 |
+
"f1": 0.06097530456729403,
|
4 |
+
"exact_match": 0.0,
|
5 |
+
"exact_match_count": 0,
|
6 |
+
"total_examples": 4,
|
7 |
+
"total_recall": 1.2513139034878165,
|
8 |
+
"total_precision": 0.1351190476190476,
|
9 |
+
"bleu_score": 0.015079706546116609,
|
10 |
+
"rouge": {
|
11 |
+
"rouge1": 0.05341335137312202,
|
12 |
+
"rouge2": 0.02204248783877577,
|
13 |
+
"rougeL": 0.03875537091709595,
|
14 |
+
"rougeLsum": 0.051784686878008
|
15 |
+
}
|
16 |
+
}
|