Skip to content

Instantly share code, notes, and snippets.

@Adagio-cantabile
Adagio-cantabile / mnist_example.py
Created January 10, 2017 14:41
MNIST的学习资料
import tensorflow as tf
import tensorflow.examples.tutorials.mnist.input_data as input_data
minist = input_data.read_data_sets("MNIST_data/", one_hot=True)
#None代表任意个数
#输入是个 batch数*像素数 的矩阵
x = placeholder(tf.float32, [None, 784])
#注意W,b的维度
@Adagio-cantabile
Adagio-cantabile / svd_example.py
Created January 5, 2017 14:18
note from Stanford NLP lecture
#written in python 3.5
import numpy as np
import matplotlib.pyplot as plt
la = np.linalg
words = ['I', 'like', 'enjoy', 'deep', 'learning', 'NLP', 'flying', '.']
X = np.array([[0,2,1,0,0,0,0,0],
[2,0,0,1,0,1,0,0],
[1,0,0,0,0,0,1,0],
[0,1,0,0,1,0,0,0],
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import random
#针对图片显示不了中文的问题,向matplotlib添加字库
#Mac 字体一般在/Library/Fonts/下
#Linux的字体一般在/usr/share/fonts/下
zhfont1 = matplotlib.font_manager.FontProperties(fname='/Library/Fonts/华文仿宋.ttf')
@Adagio-cantabile
Adagio-cantabile / tweepy_stream.py
Last active October 20, 2016 15:17
streaming with tweepy
import tweepy
from tweepy import api
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
c_key = 'your customer key'
c_secret = 'your customer secret'
a_token = 'your access token'
a_secret = 'your access token secret'