I have submitted the csv file by the name of hello.csv and it has all the jokes covered in the correct format
Cannot get more than 52 % accuracy
Hey rahul,
This is not the case.
There must be some problem in you csv file.
Try to debug your code so that it will get all the 473 jokes.
or send me the file that you are uploading - it will definitely have some mistake, otherwise you would get full score.
I dont know how to send the csv file. I saw your email, and from there I tried to sent it but it didnt work. So please tell what should I do?
csv file link
Hi,
You have done a mistake here. what you have done is get all 614 jokes all together. but you have to submit only those jokes, that have ids in the ID…csv
So, make the use of this csv file and submit only those jokes. Also make sure, you add jokes in the correct order. i.e. the Id that comes first in ID.csv it should come first in submission.csv
I am providing the code here for your reference, but try to implement with you logic as well, you are doing pretty fine, just some minor changes required.
import pandas as pd import requests import json test = pd.read_csv("Test/ID.csv").values test = test.reshape(-1,) jokes = [] for i in test: res = requests.get("http://api.icndb.com/jokes/{}".format(int(i))) joke = json.loads(res.content)['value']['joke'] jokes.append(joke) df = pd.DataFrame({"ID": test, "Joke": jokes}) df.to_csv("pred.csv", index=False).
But I also did these for the 473 jokes. It still have 52 % accuracy. Are the orders of the IDs not proper. Since I just saw the number of IDs.
Order of the jokes matters a lot,
you only have to consider till ID 499…
[ 1, 2, 3, 4, 5, 6, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 140, 141, 142, 143, 144, 145, 146, 147, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 438, 439, 440, 441, 442, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 495, 496, 497, 498, 499]
only for these ids… with this sequence
When I wrote my code I thought that it would make sense to iterate from 1 to 500 and then only put those joke and joke id with type=‘succes’. This way we would eventually get all the jokes in the correct order in the csv file.
you iterated over 620 examples. just iterate for 473 times
Will there be a difference if iterated through csv file and just normally iterated through 1 to n till I get 473 jokes?
No both ways should be fine, But i would always recommend you to go through csv, because these are the actual examples we need to submit, and when we are doing this way we are 100% sure that we have considered all examples, whereas when you are iterating till you find id number 499, chances of error gets increases.joke number 7 that was not required in our case, and you send a get request for joke number 7 and you got failure in response, but suppose by chance you if get a OK status response, you would have saved that joke as well. And it would be very very difficult to find this error.
Therefore make only those number of requests that you actually want to save in submission file
I also saw that in the sample file some jokes were under double quotes. So do we have to check for that and if so then how?
No No, I guess it was some fault at the API side, some jokes have double quotes, while others are without quotes. But we check the submitted file with the same format as we received from API response. So don’t worry about this.
Ok thanks bhaiya I will try again and hopefully it will work this time
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.