{"cells":[{"metadata":{"trusted":false,"_uuid":"17add1da7152129bd91b088628b211fe4613fd4a"},"cell_type":"code","source":"import numpy as np\nimport matplotlib.pyplot as plt\n\n%matplotlib inline\n\nimport warnings\nwarnings.filterwarnings('ignore')","execution_count":null,"outputs":[]},{"metadata":{"trusted":false,"_uuid":"7cd550c67afe71d5206818b10a87bc75f54aefad"},"cell_type":"code","source":"precision_min, precision_max = 0, 1\nrecall_min, recall_max = 0, 1\nxx, yy = np.meshgrid(np.arange(precision_min, precision_max, 0.1),\n                     np.arange(recall_min, recall_max, 0.1))","execution_count":null,"outputs":[]},{"metadata":{"trusted":false,"_uuid":"2f8a16915e41debf4921a0b36ca4e1d9b980100d"},"cell_type":"code","source":"Z = np.array([2.0*r*p/(r + p) for p, r in np.c_[xx.ravel(), yy.ravel()]])\nZ = Z.reshape(xx.shape)","execution_count":null,"outputs":[]},{"metadata":{"trusted":false,"_uuid":"80ef82e1c7e11df7f74432c77ee1c51b160f9096"},"cell_type":"code","source":"plt.contourf(xx, yy, Z)\nplt.ylabel('recall')\nplt.xlabel('precision')\nplt.title('F1')\nplt.colorbar()\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":false,"_uuid":"f03e069ef0e3869af5ed5c328a9e29d717f60062"},"cell_type":"code","source":"","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}