{"cells":[{"metadata":{},"cell_type":"markdown","source":"* In this competiton, we predict student's performance.\n* Students answer the questions or take lectures about TOEIC test.\n* In this notebook, you can learn about TOEIC test.\n* If you like, feel free to upvote."},{"metadata":{},"cell_type":"markdown","source":"# About TOEIC test"},{"metadata":{},"cell_type":"markdown","source":"* TOEIC is one of the most popular test of English.\n* Listening part (100 questions): Part1~Part4\n* Reading Part (100 questions): Part5~Part7"},{"metadata":{},"cell_type":"markdown","source":"# Test Content\n* Following explanations are quoted from [IIBC official website](https://www.iibc-global.org/english/toeic/test/lr/about/format.html)"},{"metadata":{},"cell_type":"markdown","source":"# Part1: Photographs\n"},{"metadata":{},"cell_type":"markdown","source":"> Four short statements regarding a photograph will be spoken only one time. The statements will not be printed. Of these four statements, select the one that best describes the photograph and mark your answer on the answer sheet."},{"metadata":{},"cell_type":"markdown","source":"# Part2: Question-response"},{"metadata":{},"cell_type":"markdown","source":"> Three responses to one question or statement will be spoken only one time. They will not be printed. Select the best response for the question, and mark your answer on the answer sheet."},{"metadata":{},"cell_type":"markdown","source":"# Part3: Conversations"},{"metadata":{},"cell_type":"markdown","source":"> Conversations between two or three people will be spoken only one time. They will not be printed. Listen to each conversation and read the questions printed in the test book (the questions will also be spoken), select the best response for the question, and mark your answer on the answer sheet. Some questions may require responses related to information found in diagrams,etc. printed on the test book as well as what you heard in the conversations. There are three questions for each conversation."},{"metadata":{},"cell_type":"markdown","source":"# Part4: Talks"},{"metadata":{},"cell_type":"markdown","source":"> Short talks such as announcements or narrations will be spoken only one time. They will not be printed. Listen to each talk and read the questions printed in the test book (the questions will also be spoken), select the best response for the question, and mark your answer on the answer sheet. Some questions may require responses related to information found in diagrams, etc. printed on the test book as well as what you heard in the talks. There are three questions for each talk."},{"metadata":{},"cell_type":"markdown","source":"# Part5: Incomplete Sentences"},{"metadata":{},"cell_type":"markdown","source":"> Select the best answer of the four choices to complete the sentence, and mark your answer on the answer sheet."},{"metadata":{},"cell_type":"markdown","source":"# Part6: Text Completion"},{"metadata":{},"cell_type":"markdown","source":"> Select the best answer of the four choices (words, phrases, or a sentence) to complete the text, and mark your answer on the answer sheet. There are four questions for each text."},{"metadata":{},"cell_type":"markdown","source":"# Part7: Single,Multiple Passeges"},{"metadata":{},"cell_type":"markdown","source":"> A range of different texts will be printed in the test book. Read the questions, select the best answer of the four choices, and mark your answer on the answer sheet. Some questions may require you to select the best place to insert a sentence within a text. There are multiple questions for each text."},{"metadata":{},"cell_type":"markdown","source":"# Merge train data and part of TOEIC"},{"metadata":{},"cell_type":"markdown","source":"* As you can see from above,each part of TOEIC has own characteristics and the skills required to answer correctly are also diffrent by part.\n* That's why I am wondering if part of TOEIC can be used as a feature.\n* In this notebook, we merge train data with part of TOEIC.\n* By doing this,we can easily grasp the relationship between content_id and part.\n* This way may be useless on the entire train data because the size is very large.\n* I am a beginner and strugging with understanding data on this comp.\n* If I make a mistake, please let me know."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"import pandas as pd\nimport numpy as np\nimport gc\nimport plotly.graph_objects as go\nimport riiideducation","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"%%time\ncols_to_load = ['row_id', 'user_id', 'answered_correctly', 'content_id', 'prior_question_had_explanation', 'prior_question_elapsed_time','content_type_id']\ntrain = pd.read_pickle(\"../input/riiid-train-data-multiple-formats/riiid_train.pkl.gzip\")[cols_to_load]\ntrain['prior_question_had_explanation'] = train['prior_question_had_explanation'].astype('boolean')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"question = pd.read_csv('../input/riiid-test-answer-prediction/questions.csv')\nlecture = pd.read_csv('../input/riiid-test-answer-prediction/lectures.csv')","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Extracting only a part of entire train"},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small = train.head(10000000)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"question","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"lecture","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Making dictionaries contain question/lecture id and part"},{"metadata":{"trusted":true},"cell_type":"code","source":"keys = question[\"question_id\"]\nvalues = question[\"part\"]\ntoeic_questions_parts = {key:value for key, value in zip(keys, values)}","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"keys = lecture[\"lecture_id\"]\nvalues = lecture[\"part\"]\ntoeic_lectures_parts = {key:value for key, value in zip(keys, values)}","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(list(toeic_questions_parts.items())[0:10])\nprint(\"The length is \" + str(len(toeic_questions_parts)))","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(list(toeic_lectures_parts.items())[0:10])\nprint(\"The length is \" + str(len(toeic_lectures_parts)))","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Associating content_id with part of TOEIC"},{"metadata":{},"cell_type":"markdown","source":"* Then, we clarify relationships between part of TOEIC and each content_id."},{"metadata":{"trusted":true},"cell_type":"code","source":"%%time\n#firstly, associating content_id with question.csv\n#\"content_type_id\" == True → lecture\n#\"content_type_id\" == False → question\nparts = []\nfor i,k in zip(train_small[\"content_id\"],train_small[\"content_type_id\"]):\n    #if k != True and i in toeic_questions_parts.keys():\n    if k != True: #question\n        parts.append(toeic_questions_parts[i])\n    elif k == True: #lecture\n        parts.append(0) ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small[\"part\"] = parts #making a new feature \"part\"\ntrain_small.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small[\"part\"].value_counts()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* According to the above, only about 2%(part=0) elements are about lectures."},{"metadata":{"trusted":true},"cell_type":"code","source":"%%time\n#Next, associate content_id with lecture.csv\nfor index,(i,k) in enumerate(zip(train_small[\"content_id\"],train_small[\"part\"])):\n    if k == 0 and i in toeic_lectures_parts.keys():\n        train_small[\"part\"][index] = toeic_lectures_parts[i]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_small[\"part\"].value_counts()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"parts = [\"Part1\",\"Part2\",\"Part3\",\"Part4\",\"Part5\",\"Part6\",\"Part7\"]\nquestion_number = [755467,1899847,859404,808760,4098861,1070802,506859]\nfig = go.Figure([go.Bar(x=parts, y=question_number)])\nfig.update_layout(title_text='The Number of Questions')\nfig.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* There are much more questions/lectures about Part5 or Part2!"},{"metadata":{},"cell_type":"markdown","source":"# Difficulties by TOEIC part"},{"metadata":{"trusted":true},"cell_type":"code","source":"correct = [0,0,0,0,0,0,0]\nincorrect = [0,0,0,0,0,0,0]\nfor i,j in zip(train_small[\"answered_correctly\"],train_small[\"part\"]):\n    if j == 1 and i == 1:\n        correct[0] += 1\n    elif j == 1 and i == 0:\n        incorrect[0] += 1\n    elif j == 2 and i == 1:\n        correct[1] += 1\n    elif j == 2 and i == 0:\n        incorrect[1] += 1\n    elif j == 3 and i == 1:\n        correct[2] += 1\n    elif j == 3 and i == 0:\n        incorrect[2] += 1\n    elif j == 4 and i == 1:\n        correct[3] += 1\n    elif j == 4 and i == 0:\n        incorrect[3] += 1\n    elif j == 5 and i == 1:\n        correct[4] += 1\n    elif j == 5 and i == 0:\n        incorrect[4] += 1\n    elif j == 6 and i == 1:\n        correct[5] += 1\n    elif j == 6 and i == 0:\n        incorrect[5] += 1\n    elif j == 7 and i == 1:\n        correct[6] += 1\n    elif j == 7 and i == 0:\n        incorrect[6] += 1\npart_ = 1\nfor i, j in zip(correct,incorrect):\n    print(\"Part\" + str(part_) + \": \" + \" Correct Answer \" + str(i) + \" Uncorrect Answer \" + str(j))\n    part_ += 1","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"fig = go.Figure([go.Bar(x=parts, y=correct)])\nfig.update_layout(title_text='The Number of Correct Answer')\nfig.show()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"fig = go.Figure([go.Bar(x=parts, y=incorrect)])\nfig.update_layout(title_text='The Number of Incorrect Answer')\nfig.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"correct_rates = []\nfor i,j in zip(correct,incorrect):\n    correct_rates.append(100*i/(i+j))\nfor i,j in enumerate(correct_rates):\n    print(\"Correct Answer Rate of Part\" + str(i+1) + \" is \" + str(j) + \"%\")","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"fig = go.Figure([go.Bar(x=parts, y=correct_rates)])\nfig.update_layout(title_text='Correct Answer Rate (%)')\nfig.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"* According to the above, correct answer rates of 7 parts are in the range of 60% to 74%."}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}