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. 笔试算法题(34):从数字序列中寻找仅出现一次的数字 & 最大公约数(GCD)问题

    出题:给定一个数字序列,其中每个数字最多出现两次,只有一个数字仅出现了一次,如何快速找出其中仅出现了一次的数字: 分析: 由于知道一个数字异或操作它本身(X^X=0)都为0,而任何数字异或操作0都为它 ...

  2. Centos6 安装nginx

    一.编译安装nginx 1.安装nginx所需要的库pcre,pcre的全称为:perl compatible regular expression即perl正则表达式,是为了使nginx具备URL重 ...

  3. buf.toString()

    buf.toString([encoding[, start[, end]]]) encoding {String} 默认:'utf8' start {Number} 默认:0 end {Number ...

  4. Buffer.isBuffer()详解

    Buffer.isBuffer(obj) obj {Object} 返回:{Boolean} 如果 obj 是一个 Buffer 则返回 true.

  5. Python接口测试中通过登录接口获取实时token

    1.封装login_token 2.headers:对应登录请求头部信息 3.request_param:登录的参数数据 4.json.dumps:将一个Python数据结构转换为JSON 5.dic ...

  6. LeetCode(38) Count and Say

    题目 The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111 ...

  7. 添物不花钱学JavaEE(基础篇)-JSP

    JSP(JavaServer Pages)是做Java Web开发必须掌握的语言. JSP: JavaServer Pages is a technology for developing web p ...

  8. MVC系统学习6—Filter

    Mvc的过滤器是特性类,可以使我们在执行Action之前,执行Action之后,执行Action发生异常时,编写相关的处理代码实现某些逻辑.下面是四个基本的Filter接口. 上面这四个基本的Filt ...

  9. 《C语言程序设计(第四版)》阅读心得(一)

    本篇开始写我个人觉得谭浩强老师的<C语言程序设计(第四版)>中之前没有认识到,或者忘了的知识.因为本科学过,所以有些简单的东西就没有放进来了,所以可能并不是太全面. 第一章程序设计与语言 ...

  10. MySQL Foreign Key

    ntroduction to MySQL foreign key A foreign key is a field in a table that matches another field of a ...