pandas 绘图

import numpy as np
import tflearn
from tflearn.layers.core import dropout
from tflearn.layers.normalization import batch_normalization
from tflearn.data_utils import to_categorical
from sklearn.model_selection import train_test_split
import sys
import pandas as pd
from pandas import Series,DataFrame
import matplotlib.pyplot as plt data_train = pd.read_csv("feature_with_dnn_todo2.dat")
data_train.info()
import matplotlib.pyplot as plt
print(data_train.columns) for col in data_train.columns[1:]:
fig = plt.figure()
fig.set(alpha=0.2)
plt.figure()
data_train[data_train.label == 0.0][col].plot()
data_train[data_train.label == 1.0][col].plot()
data_train[data_train.label == 2.0][col].plot()
data_train[data_train.label == 3.0][col].plot()
plt.xlabel(u"sample data id")
plt.ylabel(col)
plt.title(col)
plt.legend((u'white', u'cdn',u'tunnel', u"msad"),loc='best')
plt.show()

结果:

Index(['label', 'flow_cnt', 'len(srcip_arr)', 'len(dstip_arr)',
       'subdomain_num', 'uniq_subdomain_ratio',
       'np.average(dns_request_len_arr)', 'np.average(dns_reply_len_arr)',
       'np.average(subdomain_tag_num_arr)', 'np.average(subdomain_len_arr)',
       'np.average(subdomain_weird_len_arr)',
       'np.average(subdomain_entropy_arr)', 'A_rr_type_ratio',
       'incommon_rr_type_rato', 'valid_ipv4_ratio', 'uniq_valid_ipv4_ratio',
       'request_reply_ratio', 'np.max(dns_request_len_arr)',
       'np.max(dns_reply_len_arr)', 'np.max(subdomain_tag_num_arr)',
       'np.max(subdomain_len_arr)', 'np.max(subdomain_weird_len_arr)',
       'np.max(subdomain_entropy_arr)', 'avg_distance', 'std_distance'],
      dtype='object')

。。。。

输入数据样例:

label,flow_cnt,len(srcip_arr),len(dstip_arr),subdomain_num,uniq_subdomain_ratio,np.average(dns_request_len_arr),np.average(dns_reply_len_arr),np.average(subdomain_tag_num_arr),np.average(subdomain_len_arr),np.average(subdomain_weird_len_arr),np.average(subdomain_entropy_arr),A_rr_type_ratio,incommon_rr_type_rato,valid_ipv4_ratio,uniq_valid_ipv4_ratio,request_reply_ratio,np.max(dns_request_len_arr),np.max(dns_reply_len_arr),np.max(subdomain_tag_num_arr),np.max(subdomain_len_arr),np.max(subdomain_weird_len_arr),np.max(subdomain_entropy_arr),avg_distance,std_distance
0.0,1.0,1.0,1.0,1.0,1.0,35.0,148.0,1.0,3.0,0.0,0.0,1.0,0.0,1.0,1.0,0.142857142857,35.0,148.0,1.0,3.0,0.0,-0.0,0,0
0.0,10.0,1.0,3.0,6.0,0.6,42.7,143.5,1.83333333333,8.5,0.0,2.75986309274,0.6,0.0,0.2,0.2,0.0117096018735,44.0,287.0,2.0,10.0,0.0,2.94770277922,2.2,1.46969384567
0.0,100.0,1.0,2.0,50.0,0.5,49.63,62.96,1.0,7.7,0.0,2.41418035734,0.51,0.0,0.26,0.01,0.00100745516825,56.0,134.0,1.0,14.0,0.0,3.27761343682,7.14285714286,2.65729646253
0.0,100.0,1.0,3.0,17.0,0.17,46.11,70.53,1.0,4.47058823529,0.0,1.29411764706,0.4,0.0,0.13,0.05,0.00108436347864,54.0,631.0,1.0,12.0,0.0,3.0,5.1875,1.84454432042
0.0,100.0,1.0,4.0,50.0,0.5,45.8,59.59,1.0,5.8,0.0,2.06068705052,0.5,0.0,0.22,0.01,0.00109170305677,46.0,126.0,1.0,6.0,0.0,2.58496250072,4.14285714286,0.925820099773
0.0,100.0,11.0,7.0,26.0,0.26,42.64,58.51,1.0,4.80769230769,0.0,1.53846153846,0.84,0.0,0.7,0.25,0.00117260787992,47.0,201.0,1.0,5.0,0.0,2.0,1.28,0.825590697622

。。。

pandas 绘图 机器学习看特征相关性的更多相关文章

  1. pandas绘图总结

    转自:http://blog.csdn.net/genome_denovo/article/details/78322628 pandas绘图总结 pandas中的绘图函数(更加详细的绘图资料可参考p ...

  2. 什么是机器学习的特征工程?【数据集特征抽取(字典,文本TF-Idf)、特征预处理(标准化,归一化)、特征降维(低方差,相关系数,PCA)】

    2.特征工程 2.1 数据集 2.1.1 可用数据集 Kaggle网址:https://www.kaggle.com/datasets UCI数据集网址: http://archive.ics.uci ...

  3. matplotlib + pandas绘图

    利用pandas处理日期数据,并根据日期绘制增长率曲线. 处理的json文本内容如下: # pd.json [{"name": "A", "date& ...

  4. 机器学习: 特征脸算法 EigenFaces

    人脸识别是机器学习和机器视觉领域非常重要的一个研究方向,而特征脸算法是人脸识别里非常经典的一个算法,EigenFaces 是基于PCA (principal component analysis) 即 ...

  5. Python之Pandas绘图,设置显示中文问题

    # -*- coding: utf-8 -*- # author:baoshan import pandas as pd import matplotlib.pyplot as plt plt.rcP ...

  6. [Python]-pandas模块-机器学习Python入门《Python机器学习手册》-03-数据整理

    <Python机器学习手册--从数据预处理到深度学习> 这本书类似于工具书或者字典,对于python具体代码的调用和使用场景写的很清楚,感觉虽然是工具书,但是对照着做一遍应该可以对机器学习 ...

  7. [Python]-pandas模块-机器学习Python入门《Python机器学习手册》-02-加载数据:加载文件

    <Python机器学习手册--从数据预处理到深度学习> 这本书类似于工具书或者字典,对于python具体代码的调用和使用场景写的很清楚,感觉虽然是工具书,但是对照着做一遍应该可以对机器学习 ...

  8. Python数据科学手册-机器学习之特征工程

    特征工程常见示例: 分类数据.文本.图像. 还有提高模型复杂度的 衍生特征 和 处理 缺失数据的填充 方法.这个过程被叫做向量化.把任意格式的数据 转换成具有良好特性的向量形式. 分类特征 比如房屋数 ...

  9. pandas绘图

    #encoding:utf8 import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFr ...

随机推荐

  1. 零基础入门学习Python(27)--集合:在我的世界里,你就是唯一

    知识点 集合:set set和dict类似,也是一组key的集合,但不存储value.由于key不能重复,所以,在set中,没有重复的key. 集合中的元素的三个特征: 1)确定性(元素必须可hash ...

  2. UVA 1596 Bug Hunt (大模拟 栈)

    题意: 输入并模拟执行一段程序,输出第一个bug所在的行. 每行程序有两种可能: 数组定义: 格式为arr[size]. 例如a[10]或者b[5],可用下标分别是0-9和0-4.定义之后所有元素均为 ...

  3. POJ1222熄灯问题【位运算+枚举】

    EXTENDED LIGHTS OUT Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 14231   Accepted: 8 ...

  4. Webbrowser 在web项目中的使用

    string htmlstr = string.Empty; [STAThread] public string GetHtmlByWeb(string url) { try { RunWithSin ...

  5. 【03】HTML head 头部分的标签说明 和 手机头部标签说明

    HTML head 头部分的标签.元素有很多,涉及到浏览器对网页的渲染,SEO 等等,而各个浏览器内核以及各个国内浏览器厂商都有些自己的标签元素,这就造成了很多差异性.移动互联网时代,head 头部结 ...

  6. 九度oj 题目1205:N阶楼梯上楼问题

    题目1205:N阶楼梯上楼问题 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:4990 解决:2039 题目描述: N阶楼梯上楼问题:一次可以走两阶或一阶,问有多少种上楼方式.(要求采用 ...

  7. 【ZJOI2017 Round1练习】D8T1 mushroom(点分治)

    题意: 思路: num[a[u]]表示存在a[u]这个颜色且终点在u子树中的链长总和 ans[i]表示以当前的u为根,前面的子树对i的贡献之和 ..]of longint; size,f,ans,su ...

  8. int *ptr=(int *)(&a+1)问题的探讨

    从网络上看到这样一道有意思的题目,是关于数组与指针的问题,描述如下: main() { ]={,,,,}; ); printf(),*(ptr-)); } 输出为:2,5 请解释以上代码的输出结果. ...

  9. JDBC的结果集

    以下内容引用自http://wiki.jikexueyuan.com/project/jdbc/result-sets.html: SQL语句从数据库查询中获取数据,并将数据返回到结果集中.SELEC ...

  10. TensorFlow-GPU环境配置之二——CUDA环境配置

    1.安装最新显卡驱动 到系统设置->软件和更新->附加驱动中选中最新的显卡驱动,并应用 2.下载CUDA8.0 https://developer.nvidia.com/cuda-down ...