使用NetworkX来进行数据可视化
摘要:1 %matplotlib notebook 2 3 import networkx as nx 4 import matplotlib.pyplot as plt 5 6 # 数据读取 7 G = nx.read_gpickle('major_us_cities') 1 # draw the graph using the default spring layout 2 plt.fig...
阅读全文
posted @
2018-03-15 16:34
郑哲
阅读(4661)
推荐(2) 编辑
使用NetworkX进行社交分析
摘要:邻接表 G_adjlist.txt is the adjaceny list representation of G1. It can be read as follows: 0 1 2 3 5 →→ node 0 is adjacent to nodes 1, 2, 3, 5 1 3 6 →→ n
阅读全文
posted @
2018-03-15 14:55
郑哲
阅读(917)
推荐(0) 编辑
文本情感分析
摘要:CountVectorizer AUC: 0.889951006492 AUC: 0.889951006492 AUC: 0.889951006492 AUC: 0.889951006492 AUC: 0.889951006492 1 feature_names = np.array(vect.ge
阅读全文
posted @
2018-03-15 13:48
郑哲
阅读(782)
推荐(0) 编辑
使用NLTK进行基础的NLP处理
摘要:1 import nltk 2 from nltk.book import * *** Introductory Examples for the NLTK Book *** Loading text1, ..., text9 and sent1, ..., sent9 Type the name
阅读全文
posted @
2018-03-15 13:24
郑哲
阅读(1364)
推荐(1) 编辑
使用pandas对文本数据进行处理
摘要:1 import pandas as pd 2 3 time_sentences = ["Monday: The doctor's appointment is at 2:45pm.", 4 "Tuesday: The dentist's appointment is at 11:30 am.", 5 "Wed...
阅读全文
posted @
2018-03-15 12:53
郑哲
阅读(2019)
推荐(0) 编辑
文本处理
摘要:['#UNSG'] ['#UNSG'] ['#UNSG'] ['#UNSG'] ['#UNSG'] 1 [w for w in text6 if w.startswith('@')] ['@'] 1 text7 = '@UN @UN_Women "Ethics are built right int
阅读全文
posted @
2018-03-15 09:52
郑哲
阅读(194)
推荐(0) 编辑
分类器可视化
摘要:这本笔记本的目的是让你可视化各种分类器的决策边界。 本笔记本中使用的数据基于存储在mushrooms.csv中的UCI蘑菇数据集。 为了更好地确定决策边界,我们将对数据执行主成分分析(PCA)以将维度降至2维。 降维将在本课程后面的模块中介绍。 玩弄不同的模型和参数,看看它们如何影响分类器的决策边界
阅读全文
posted @
2018-03-15 09:41
郑哲
阅读(2074)
推荐(0) 编辑
无监督学习
摘要:数据准备 降维和流形学习 PCA 使用PCA查找乳腺癌数据集的前两个主要组成部分 画出各个因素对两个主成分的影响大小 PCA用于水果数据集(用于比较) 多种学习方法 水果数据集上的多维缩放(MDS) 乳腺癌上的多维缩放 t-SNE on the fruit dataset (结果不是很好) t-SN
阅读全文
posted @
2018-03-14 15:10
郑哲
阅读(553)
推荐(0) 编辑
监督学习2
摘要:序言和数据集 贝叶斯分类器 Application to a real-world dataset 决策树集成 随机森林 Random forest: Fruit dataset Random Forests on a real-world dataset Gradient-boosted deci
阅读全文
posted @
2018-03-14 14:44
郑哲
阅读(482)
推荐(0) 编辑
模型验证
摘要:对分类模型的检验 加载数据 Decision tree classifier (max_depth = 2) [[400 7] [ 17 26]] Decision tree classifier (max_depth = 2) [[400 7] [ 17 26]] Decision tree cl
阅读全文
posted @
2018-03-12 10:16
郑哲
阅读(612)
推荐(0) 编辑
监督学习模型(线性回归,非线性回归,逻辑回归,SVM,决策树,岭回归,Losso回归)
摘要:一.数据产生 KNN分类 KNN回归预测 KNN参数k对回归预测的影响 线性回归预测模型 线性回归图示 多元线性回归预测 岭回归 Lasso 回归 逻辑回归正则化参数的影响 应用于真实数据 SVM 线性SVM Linear Support Vector Machine: C parameter 线性
阅读全文
posted @
2018-03-11 22:57
郑哲
阅读(4479)
推荐(0) 编辑
一个简单的分类模型knn
摘要:knn中聚类个数k对最后准确率的影响 knn对数据集train/test划分比例的敏感性
阅读全文
posted @
2018-03-10 12:14
郑哲
阅读(1425)
推荐(0) 编辑
Seaborn
摘要:1 import numpy as np 2 import pandas as pd 3 import matplotlib.pyplot as plt 4 import seaborn as sns 5 6 %matplotlib notebook 1 np.random.seed(1234) 2 3 v1 = pd.Series(np.random.normal(0,10,1000)...
阅读全文
posted @
2018-03-09 21:32
郑哲
阅读(341)
推荐(0) 编辑
Pandas可视化
摘要:DataFrame.plot 我们可以设置plot函数中的kind来决定我们想画什么 下面列举kind的的可选值 kind : 'line' : 直线(默认) 'bar' : 垂直条形图 'barh' : 水平条形图 'hist' : 直方图 'box' : 箱型图 'kde' : 核密度估计图 '
阅读全文
posted @
2018-03-09 21:18
郑哲
阅读(232)
推荐(0) 编辑
交互性(Interactivity)
摘要:1 plt.figure() 2 data = np.random.rand(10) 3 plt.plot(data) 4 #创建点击事件 5 def onclick(event): 6 plt.cla() 7 plt.plot(data) 8 plt.gca().set_title('Event at pixels {},{} \nand data {}...
阅读全文
posted @
2018-03-09 20:50
郑哲
阅读(1109)
推荐(0) 编辑
动画(animation)
摘要:1 import matplotlib.animation as animation 2 3 n = 100 4 x = np.random.randn(n) 1 # create the function that will do the plotting, where curr is the current frame 2 def update(curr): 3 # ch...
阅读全文
posted @
2018-03-09 20:44
郑哲
阅读(242)
推荐(0) 编辑
热图
摘要:1 plt.figure() 2 3 Y = np.random.normal(loc=0.0, scale=1.0, size=10000) 4 X = np.random.random(size=10000) #bins设置区间大小 5 _ = plt.hist2d(X, Y, bins=25) 1 plt.figure() 2 _ = plt.hist2d(X, Y, bins=1...
阅读全文
posted @
2018-03-09 20:40
郑哲
阅读(195)
推荐(0) 编辑
箱型图
摘要:1 import pandas as pd 2 normal_sample = np.random.normal(loc=0.0, scale=1.0, size=10000) 3 random_sample = np.random.random(size=10000) 4 gamma_sample = np.random.gamma(2, size=10000) 5 6 #创建新...
阅读全文
posted @
2018-03-09 20:34
郑哲
阅读(393)
推荐(0) 编辑
直方图
摘要:在图像上直方图和条形图相似,但是直方图是用来统计数据在某个值上的数量。
阅读全文
posted @
2018-03-09 20:10
郑哲
阅读(358)
推荐(0) 编辑