{"cells":[{"metadata":{},"cell_type":"markdown","source":"You can check how R,C and V score individually on LB in order to figure out where you lost most of your score. Be aware that R is twice as impactful than C and V.\nMost people will have lost a lot on C and R.\n\nAll you need to do is submit your solution with only predicting for example R and setting C and V to zero and then fill that number in the respective cell below. Same holds for C and V.\nWe can come up with the equations as we know how a solution should score if we only predict zeros."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import pandas as pd\nfrom sklearn import metrics\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"train = pd.read_csv('/kaggle/input/bengaliai-cv19/train.csv')\ntarget_columns = ['grapheme_root', 'consonant_diacritic', 'vowel_diacritic']\ny_train = train[target_columns].values","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"def metric(y, p):\n    scores = []\n    for i in range(3):\n        y_true_subset = y[:,i]\n        y_pred_subset = p[:,i]\n        recalls = []\n        for c in set(y_true_subset):\n            idx = np.where(y_true_subset==c)\n            s = (y_true_subset[idx] == y_pred_subset[idx]).mean()\n            recalls.append(s)\n        s = np.mean(recalls)\n        scores.append(s)\n    final_score = np.average(scores, weights=[2,1,1])\n    return final_score, scores","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"r = np.zeros(len(train))\nc = np.zeros(len(train))\nv = np.zeros(len(train))\nx = np.vstack([r,c,v]).T","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"metric(y_train, x)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"_, scores = metric(y_train, x)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# calculate R score\nr_lb = 0.5500\n(0.25*scores[1] + 0.25*scores[2]) / (-0.5) + (r_lb / 0.5)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# calculate C score\nc_lb = 0.2720\n(0.5*scores[0] + 0.25*scores[2]) / (-0.25) + (c_lb / 0.25)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# calculate V score\nv_lb = 0.2860\n(0.25*scores[0] + 0.25*scores[1]) / (-0.25) + (v_lb / 0.25)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"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}