Coder Social home page Coder Social logo

hankcs / cs224n Goto Github PK

View Code? Open in Web Editor NEW
668.0 27.0 273.0 47.06 MB

CS224n: Natural Language Processing with Deep Learning Assignments Winter, 2017

Home Page: http://www.hankcs.com/tag/cs224n/

License: GNU General Public License v3.0

Makefile 0.09% Shell 0.55% Python 99.36%
cs224n deep-learning natural-language-processing word2vec rnn tensorflow

cs224n's Introduction

CS224n

CS224n: Natural Language Processing with Deep Learning Assignments Winter, 2017

Requirements

  • Python 2.7
  • TensorFlow r1.2

Assignment #1

  1. Softmax
  2. Neural Network Basics
  3. word2vec q3_word_vectors
  4. Sentiment Analysis q4_reg_v_acc q4_dev_conf

Assignment #2

  1. Tensorflow Softmax
  2. Neural Transition-Based Dependency Parsing
924/924 [==============================] - 49s - train loss: 0.0631    
Evaluating on dev set - dev UAS: 88.54
New best dev UAS! Saving model in ./data/weights/parser.weights
================================================================================
TESTING
================================================================================
Restoring the best model weights found on the dev set
Final evaluation on test set - test UAS: 88.92
Writing predictions
Done!
  1. Recurrent Neural Networks: Language Modeling unrolled_rnn

Assignment #3

  1. A window into NER
DEBUG:Token-level confusion matrix:
go\gu   PER     ORG     LOC     MISC    O    
PER     2968    26      84      16      55   
ORG     147     1621    131     65      128  
LOC     48      88      1896    26      36   
MISC    37      40      54      1030    107  
O       42      46      18      39      42614
DEBUG:Token-level scores:
label   acc     prec    rec     f1   
PER     0.99    0.92    0.94    0.93 
ORG     0.99    0.89    0.77    0.83 
LOC     0.99    0.87    0.91    0.89 
MISC    0.99    0.88    0.81    0.84 
O       0.99    0.99    1.00    0.99 
micro   0.99    0.98    0.98    0.98 
macro   0.99    0.91    0.89    0.90 
not-O   0.99    0.89    0.87    0.88 
INFO:Entity level P/R/F1: 0.82/0.85/0.84
  1. Recurrent neural nets for NER
DEBUG:Token-level confusion matrix:
go\gu   PER     ORG     LOC     MISC    O    
PER     2987    32      47      12      71   
ORG     136     1684    90      70      112  
LOC     39      83      1907    21      44   
MISC    43      45      47      1031    102  
O       36      56      15      34      42618
DEBUG:Token-level scores:
label   acc     prec    rec     f1   
PER     0.99    0.92    0.95    0.93 
ORG     0.99    0.89    0.80    0.84 
LOC     0.99    0.91    0.91    0.91 
MISC    0.99    0.88    0.81    0.85 
O       0.99    0.99    1.00    0.99 
micro   0.99    0.98    0.98    0.98 
macro   0.99    0.92    0.89    0.91 
not-O   0.99    0.90    0.88    0.89 
INFO:Entity level P/R/F1: 0.85/0.86/0.85
  1. Grooving with GRUs

q3-noclip-rnn q3-clip-rnn q3-noclip-gru q3-clip-gru

DEBUG:Token-level confusion matrix:
go\gu	PER  	ORG  	LOC  	MISC 	O    
PER  	2920 	41   	57   	12   	119  
ORG  	101  	1716 	73   	64   	138  
LOC  	22   	95   	1908 	16   	53   
MISC 	37   	45   	53   	1017 	116  
O    	21   	67   	14   	39   	42618

DEBUG:Token-level scores:
label	acc  	prec 	rec  	f1   
PER  	0.99 	0.94 	0.93 	0.93 
ORG  	0.99 	0.87 	0.82 	0.85 
LOC  	0.99 	0.91 	0.91 	0.91 
MISC 	0.99 	0.89 	0.80 	0.84 
O    	0.99 	0.99 	1.00 	0.99 
micro	0.99 	0.98 	0.98 	0.98 
macro	0.99 	0.92 	0.89 	0.90 
not-O	0.99 	0.91 	0.88 	0.89 

INFO:Entity level P/R/F1: 0.86/0.85/0.85
  1. Easter Egg Hunt!
    • Run python q3_gru.py dynamics to unfold your candy eggs

References

CS224n official website

Many code snippets come from

cs224n's People

Contributors

dingkunliu avatar hankcs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cs224n's Issues

Assignment 1 q2_neural.py softmax gradient not explicitly calculated

In calculating gradients, the gradient of the softmax function is not calculated using the formula that is derived in the lecture notes. It seems like in the code, this step is skipped over, and the gradient of the cost function with respect to yhat is used only ('d3' variable). Am I missing something here?

关于assignment1中下载的文本的编码问题

博主,您好.我现在在做assignment1.我想用python3做完.然后就出现了一些编码问题...
主要就是下载的文本中,datasetSentences.txt 和dictionary.txt 这两个文本中的句子没办法match.
然后我发现datasetSentences.txt中的文本显示有少量乱码,因此我估计该文本编码方式有问题.然后在作业给的程序中我发现,读dictionary.txt文本时直接用read()方法即可(treebank.py中120行往下).但是在读datasetSentences.txt时的操作却让人很费解: read().decode("utf8").encode("latin1").程序中解释是"Deal with some peculiar encoding issues with this file"(treebank.py中54行往下),但没具体说为什么..博主能不能帮忙理一下,这个操作的逻辑是什么?
然后,在python3中我应该怎样正确读取datasetSentences.txt呢?因为python3中read()是不能接decode操作的,我试了下read().encode("latin1")和直接read()都不成功...
非常感谢啦!

关于作业1中求matrix的softmax

Hi,hankcs.我在做作业1的时候参考学习你的代码,其中关于softmax的矩阵运算(q1_softmax.py中35行)。
请问此处denom=lambda x:1.0/np.sum(x)是不是归一化分母,如果按照归一化分母的写法,是不是应该是denom=lambda x:1.0/np.sum(exp_minmax)或者denom=lambda x:1.0/np.sum(np.exp(x))呢?请指教

求问Assignment3的问题

在q2_rnn.py 中的Config里面
n_word_features = 2 # Number of features for every word in the input.
这个feature是什么feature?每个word用两个feature来表示是什么意思。。。想了好久都没有想通。。。

在后面做embedding的时候发现这个feature也不是word——embedding的length。。

Returns:
embeddings: tf.Tensor of shape (None, max_length, n_features*embed_size)

谢谢大神。。

怎么打分

代码里好像没有自动打分的?请问你怎么测试的呢

请问呢,作业一中word2vec梯度检测错误的原因

大佬您好,我参考了您得assignment1中得word2vec.py得实现。但是在运行过程中梯度检测报错了。
==== Gradient check for skip-gram ====
Gradient check failed.
First gradient error found at index (0, 0)
Your gradient: -0.087147 Numerical gradient: 1254.567123
我是用py3实现的,之前的所有代码几乎一致,也都正确通过了,唯独这里通过不了。之后我将您的代码直接全部拷贝下来运行,同样报以上错误,请问您知道怎么回事嘛,您当时运行通过了吗?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.