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. [Python3网络爬虫开发实战] 1.5.3-redis-py的安装

    对于Redis来说,我们要使用redis-py库来与其交互,这里就来介绍一下它的安装方法. 1. 相关链接 GitHub:https://github.com/andymccurdy/redis-py ...

  2. stl sort和qsort的使用

    好不容易使用了下stl的qsort函数,顺便和sort函数一起总结下: 很多时候我们都需要用到排序. 例如: 1 #include <iostream> #include <algo ...

  3. python 网络编程基础

    1. 内容回顾补充 [] [^] 带有特殊意义的元字符到字符组内大部分都会取消它的特殊意义. 会取消的: [()+*.] -[(-)] -的位置决定了它的意义,写在字符组的第一个位置/最后一个位置就表 ...

  4. MyBaties异常之 ORA-00918: 未明确定义列

    原因: 如果a表与b表连接,且a与b中存在两个相同的字段,则必须指明字段是哪个表的 箭头所致位置没有指定ROOM_ID为那个表的,应修改为t1.ROOM_ID

  5. javascript事件中'return false'详解

    浏览器中有很多异步事件,如click,mouseenter,mouseover等等,当用户执行相应操作之后,触发这个事件,然后执行相应的事件处理函数,一般情况下,我们可以通过三种方式给元素添加事件处理 ...

  6. Django——配置服务器上线

    使用UWSGI和NGINX配置项目上线 首先你得有一个拿得出手的项目 其次,购买了域名,也备案成功了 将settings.py中的DEBUG设置为False 配置Uwsgi 在项目(哪里都可以)中创建 ...

  7. BNUOJ 9870 Contestants Division

    Contestants Division Time Limit: 3000ms Memory Limit: 131072KB This problem will be judged on UVALiv ...

  8. codeforces 362B

    #include<stdio.h> #include<stdlib.h> int cmp(const void *a,const void *b) { return *(int ...

  9. 【JZOJ4857】Tourist Attractions(Bitset)

    题意:给定一个n个点的无向图,求这个图中有多少条长度为4的简单路径. n<=1500 思路: #include<map> #include<set> #include&l ...

  10. 【Tomcat】tomcat启动后查看运行时JVM参数

    Tomcat优化配置参考http://www.cnblogs.com/qlqwjy/p/8007490.html 1.启动服务后访问localhost,点击Server Status