{"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_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"<center><img src=\"https://camo.githubusercontent.com/dd842f7b0be57140e68b2ab9cb007992acd131c48284eaf6b1aca758bfea358b/68747470733a2f2f692e696d6775722e636f6d2f52557469567a482e706e67\"></center>","metadata":{}},{"cell_type":"markdown","source":"Track everything you need to make your models reproducible with Weights & Biases— from hyperparameters and code to model weights and dataset versions.\n\nWeights & Biases helps your ML team unlock their productivity by optimizing, visualizing, collaborating on, and standardizing their model and data pipelines – regardless of framework, environment, or workflow.\n\nUsed by ML engineers at OpenAI, Lyft, Pfizer, Qualcomm, NVIDIA, Toyota, GitHub, and MILA, W&B is part of the new standard of best practices for machine learning. W&B is free for personal use and academic projects, and it's easy to get started.\n\n## W&B Embedding Projector\nRun your first experiment in 30 seconds with this quick hosted notebook: [bit.ly/intro-wb](http://wandb.me/intro)\n**With the Weights & Biases [Embedding Projector](https://docs.wandb.ai/ref/app/features/panels/weave/embedding-projector)** you can quickly run dimensionality reduction algorithms such as t-sne, PCA and UMAP on a pandas datafame and visualise like the image below. In the W&B UI you can also adjust the parameters to these algorithms.","metadata":{}},{"cell_type":"markdown","source":"<center><img \nsrc=\"https://raw.githubusercontent.com/morganmcg1/images/main/Screenshot%202022-07-01%20at%2018.30.19.png\">\n</center>","metadata":{}},{"cell_type":"markdown","source":"# Dimensionality Reduction in Minutes\nFirst we need to log the dataframe to Weights & Biases, then it can be explored in the W&B UI","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport wandb","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Import the csv data into a pandas dataframe","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv('../input/tabular-playground-series-jul-2022/data.csv')\ndf.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-01T16:40:40.207125Z","iopub.execute_input":"2022-07-01T16:40:40.207652Z","iopub.status.idle":"2022-07-01T16:40:41.676634Z","shell.execute_reply.started":"2022-07-01T16:40:40.207608Z","shell.execute_reply":"2022-07-01T16:40:41.674993Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Upload the data to Weights & Biases\nLog your dataframe to [Weights & Biases](https://wandb.ai/site), personal accounts are 100% free, your can create an account [here](https://wandb.ai/site). From there you will be able to use the Embedding Projector to generate your visualisations","metadata":{}},{"cell_type":"code","source":"wandb.init(project='kaggle-tps-july-unsupervised')\nwandb.log({'data':df})\nwandb.finish()","metadata":{"execution":{"iopub.status.busy":"2022-07-01T17:44:24.248463Z","iopub.execute_input":"2022-07-01T17:44:24.249988Z","iopub.status.idle":"2022-07-01T17:44:24.89789Z","shell.execute_reply.started":"2022-07-01T17:44:24.249921Z","shell.execute_reply":"2022-07-01T17:44:24.896457Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### View in the Embedding Projector\nOnce your data is uploaded to Weights & Biases you can click on the run link generated in your notebook which will take you to the Weights & Biases UI.\n\nFrom here you can see your data logged as a W&B Table. Clicking on the gear icon in the top right of the table and selecting \"2D Projection:Plot\" will then give you the option to use one of the 3 different dimenstionality reduction algorithms available","metadata":{}},{"cell_type":"markdown","source":"<center><img \nsrc=\"https://raw.githubusercontent.com/morganmcg1/images/main/Screenshot%202022-07-01%20at%2018.39.10.png\">\n</center>","metadata":{}}]}