{"cells":[{"metadata":{"trusted":true,"_uuid":"ecd65b0b06d89533b1706b6a4c35835278148663"},"cell_type":"code","source":"from sklearn.metrics import fbeta_score\n\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport numpy as np\n\n%matplotlib inline","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"97cbbf233a4d2cb006c6f2be2de382eb1be7f3af"},"cell_type":"code","source":"df_classes_trainable = pd.read_csv('../input/classes-trainable.csv', index_col=0)\ndf_classes_trainable.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"53b68e64561ecb77319ad86e73f96af84d16a83a"},"cell_type":"code","source":"df_tuning_labels = pd.read_csv('../input/tuning_labels.csv', index_col=0, header=None, names=['image_id', 'labels'])\ndf_tuning_labels.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9cd7ba28027e58c75313fd88a5c3b9401580d66d"},"cell_type":"code","source":"y_true = df_tuning_labels['labels'].apply(lambda lbls: df_classes_trainable.index.isin(lbls.split()))\ny_true = pd.DataFrame(y_true.values.tolist(), index=y_true.index)\ny_true.shape\ny_true.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"4798379e0302b70a506dbf31cb244168fea31f7f"},"cell_type":"code","source":"fbeta_score(y_true, y_true, beta=2, average='samples')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7126d620ec363df321e0c48363efd6f56a0775d7"},"cell_type":"code","source":"y_predict = y_true.copy()\ny_predict.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"292cb6275bb9f2dcc24eea48b9e0b0c5cb075265"},"cell_type":"code","source":"y_predict.loc['2b2f44594449326f4e52553d', 0] = True","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"97649569bb063d8854e9e79c621d6024f12b54b4"},"cell_type":"code","source":"fbeta_score(y_true, y_predict, beta=2, average='samples')","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.6"}},"nbformat":4,"nbformat_minor":1}