/cs224n_Assignments

Stanford University cs224n Assignments solutions

Primary LanguagePythonMIT LicenseMIT

CS224N Assignments

Solutions for cs224n(Deep Learning For Natural Language Processing) course by stanford university

Prerequisites

  1. Install Anaconda
  2. go to assignmentX where X is either 1, 2, 3 using a Terminal:
    $ cd \path\to\assignment1
  3. create a python 2.7 environnment using
    $ conda env -n cs224n python=2.7 anaconda
  4. activate your environment using (add source before activate if you're working with Linux/Mac)
    $ activate cs224n
  5. install the dependencies using requirements.txt
    $ pip install -r requirements.txt
  6. Don't forget to deactivate your environment when you're done (add source before deactivate if you're on Linux/Mac)
    $ deactivate cs224n

Deployment

Assignment 1

Word2vec

Steps for training Word2vec in assignment 1 :

  1. Go to folder /assignment 1
  2. Run get_datasets.sh(By running this file you can download datasets)
  3. Open a terminal and write(Be careful, for this assignment you should have installed python2.7) :
    $ python q3_run.py

Sentiment Analysis(before you running this section you should download datasets as i mentioned in Word2vec section)

  1. If you want to use logistic regression classifier on word vectors that we trained in Word2vec section you can use this code :
    $ cd path/to/assignment1
    $ python q4_sentiment.py --yourvectors
  2. If you want to use pretrained GLOVE model you can use this code :
    $ cd path/to/assignment1
    $ python q4_sentiment.py --pretrained

Results

Assignment 1

Word2vec

images

Sentiment analysis train/dev accuracy

images

Sentiment analysis truth table

images

Built With

  • Numpy - A library for doing optimized matrix operations
  • Matplotlib - A library for visulizing our outputs as graphs
  • scipy - A Library for doing mathematic, science and engineering stuff.
  • sklearn - Simple and efficient Library for data mining and data analysis

License

This project is licensed under the MIT License - see the LICENSE.md file for details