{"id":15468998,"url":"https://github.com/ajaysub110/saidl-winter-assignment-2018","last_synced_at":"2025-09-04T16:36:28.494Z","repository":{"id":113986117,"uuid":"163561878","full_name":"ajaysub110/SAiDL-Winter-Assignment-2018","owner":"ajaysub110","description":"Solution to Assignment given by SAiDL in the winter of 2018","archived":false,"fork":false,"pushed_at":"2019-01-31T21:06:44.000Z","size":45857,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T20:44:18.949Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajaysub110.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-30T04:38:58.000Z","updated_at":"2019-03-21T17:07:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"d430495b-ff7c-4867-a5af-d0feb4a4d5bd","html_url":"https://github.com/ajaysub110/SAiDL-Winter-Assignment-2018","commit_stats":{"total_commits":13,"total_committers":1,"mean_commits":13.0,"dds":0.0,"last_synced_commit":"51ac81708e5ecc0789d61b50c993465ba8e62fe8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaysub110%2FSAiDL-Winter-Assignment-2018","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaysub110%2FSAiDL-Winter-Assignment-2018/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaysub110%2FSAiDL-Winter-Assignment-2018/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajaysub110%2FSAiDL-Winter-Assignment-2018/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajaysub110","download_url":"https://codeload.github.com/ajaysub110/SAiDL-Winter-Assignment-2018/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247165183,"owners_count":20894639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T01:48:44.216Z","updated_at":"2025-04-04T10:38:11.758Z","avatar_url":"https://github.com/ajaysub110.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAiDL-Winter-Assignment-2018\n\n- [x] Numpy neural network (4.1)\n- [x] Word Embeddings (4.2)\n- [x] Image Generation (4.3)\n- [x] Imitation Learning (4.4)\n\n## Question 4.1: Numpy neural network (File: nn-xor-xnor.ipynb)\n- **Data:** I have constructed a truth table for the given function for only one bit. We could do it for 2 bits as well but it is not necessary since both XOR and XNOR are bitwise operations.\n- **Model:** I have constructed a neural network (with separate functions for initializing weights, loss calculation, forward propagation, back propagation, train and predict functions) using only the numpy library.\n- **Training:** Training has been done on a large number of epochs (100000) since we desire overfitting in this scenario.\n\n\n## Question 4.2: Word Embeddings (File: word-embeddings.ipynb)\n- The first few cells are to integrate the notebook with Google Colab, download Pytorch, and obtain the Large Movie Review Dataset from Kaggle. Please ignore these cells.\n- Then, I have defined methods to load a single document (load_doc), clean and extract tokens (clean_doc), Load all files (load_all) and separate tokenization (tokenize_corpus)\n- This is an implementation of the word2vec embedding model using a simple 2 layer neural network, in pytorch.\n- **Hyperparameters and training:**\n  - embedding dimensions = 5\n  - epochs = 1000\n  - learning rate = 0.001\n- Finally, I have used sklearn's TSNE method for dimensionality reduction (to visualize the embeddings on a 2D plane)\n- **Note:** Training the model on the aclImdb dataset required high computational resources and hence in the notebook, I have used a smaller corpus of text.\n\n## Question 4.3: Image Generation (File: dcgan.ipynb)\n- Again, please ignore the first few cells\n- This is the implementation of a standard DCGAN.\n- The hyperparameters are obtained from a command line argument parser\n- The GAN has been trained on the CIFAR 10 dataset for 10 epochs with a batch size of 64\n- Note that the graph for the generator and discriminator losses is not the ideal graph since the model has been trained for 5 epochs twice.\n- **Optimizations:**\n  - Generated image before optimization:\n  \n    ![Before optimization](https://raw.githubusercontent.com/ajaysub110/SAiDL-Winter-Assignment-2018/master/gan_images/gan_1.png)\n    \n  - Optimizations made to the model (Made based on suggestions from ganhacks):\n    - Changed some ReLU functions to Leaky ReLU \n    - Added Tanh activation at the end of the Generator network\n    - Used Adam optimizer instead of SGD\n    - Changed objective function to max(log(D(G(z))) instead of min(log(1 - D(G(z)))\n    \n  - Generated image after optimization:\n  \n    ![After optimization](https://raw.githubusercontent.com/ajaysub110/SAiDL-Winter-Assignment-2018/master/gan_images/gan_3.png)\n  - I have added another intermediate generated image (gan_2.png) after 5 epochs post optimization, in the gan_images directory\n  \n ## Question 4.4 Imitation Learning (File: imitation-learning)\n - This is an implementation of the UCB DRL course in pytorch.\n - I have implemented methods for both the Behavioral Cloning and DAgger methods of imitation learning\n - Again, the hyperparameters have been taken from a command line argument parser\n - **File descriptions:** Below are the description of each file\n   - agent.py : Code for the neural network that generates actions from observations\n   - main.py : Declares all hyperparameters used in the code\n   - run_agent.py : Runs the Mujoco simulation of a humanoid agent taking the trained model weights\n   - run_expert.py : Runs the expert simulation that was provided in the repository\n   - train.py : Definition for important methods namely, DAgger, Behavioral cloning, fit_dataset, save and load model\n   - tf_utils : Redundant file, but scared to delete\n   \n   ------------------------------------------------------------------------------------------------------------------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaysub110%2Fsaidl-winter-assignment-2018","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajaysub110%2Fsaidl-winter-assignment-2018","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajaysub110%2Fsaidl-winter-assignment-2018/lists"}