This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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的维度 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |