博客
关于我
Google涂鸦识别挑战项目
阅读量:592 次
发布时间:2019-03-11

本文共 2128 字,大约阅读时间需要 7 分钟。

Google涂鸦识别挑战项目

import osimport astimport pandas as pdimport seaborn as snsimport matplotlib.pyplot as pltfrom sklearn.utils import shufflepd.options.display.max_rows = 20sns.set(style="darkgrid")%matplotlib inline
files_directory = os.listdir("E:/CNN比赛/train_simplified/")train = pd.DataFrame()for file in files_directory:    train = train.append(pd.read_csv('E:/CNN比赛/train_simplified/' + file, index_col='key_id', usecols=[1, 2, 3, 5]))# Shuffle datatrain = shuffle(train, random_state=123)
print('Train number of rows: ', train.shape[0])print('Train number of columns: ', train.shape[1])print('Train set features: %s' % train.columns.values)print('Train number of label categories: %s' % len(files_directory))

在这里插入图片描述

count_gp = train.groupby(['word']).size().reset_index(name='count').sort_values('count', ascending=False)top_10 = count_gp[:10]bottom_10 = count_gp[count_gp.shape[0]-10:count_gp.shape[0]]
ax_t10 = sns.barplot(x="word", y="count", data=top_10, palette="coolwarm",ci=500)ax_t10.set_xticklabels(ax_t10.get_xticklabels(), rotation=40, ha="right")plt.show()

在这里插入图片描述

ax_b10 = sns.barplot(x="word", y="count", data=bottom_10, palette="BrBG")ax_b10.set_xticklabels(ax_b10.get_xticklabels(), rotation=40, ha="right")plt.tight_layout()plt.show()

在这里插入图片描述

sns.countplot(x="recognized", data=train)plt.show()

在这里插入图片描述

train['recognized'].value_counts()

在这里插入图片描述

4194827/(4194827+45512752)

在这里插入图片描述

rec_gp = train.groupby(['word', 'recognized']).size().reset_index(name='count')rec_true = rec_gp[(rec_gp['recognized'] == True)].rename(index=str, columns={   "recognized": "recognized_true", "count": "count_true"})rec_false = rec_gp[(rec_gp['recognized'] == False)].rename(index=str, columns={   "recognized": "recognized_false", "count": "count_false"})rec_gp = rec_true.set_index('word').join(rec_false.set_index('word'), on='word')rec_gp

在这里插入图片描述

words = train['word'].tolist()drawings = [ast.literal_eval(pts) for pts in train[:9]['drawing'].values]plt.figure(figsize=(10, 10))for i, drawing in enumerate(drawings):    plt.subplot(330 + (i+1))    for x,y in drawing:        plt.plot(x, y, marker='.')        plt.tight_layout()        plt.title(words[i]);        plt.axis('off')

在这里插入图片描述

转载地址:http://mobtz.baihongyu.com/

你可能感兴趣的文章
Mysql 自定义函数
查看>>
mysql 行转列 列转行
查看>>
Mysql 表分区
查看>>
mysql 表的操作
查看>>
mysql 视图,视图更新删除
查看>>
MySQL 触发器
查看>>
mysql 让所有IP访问数据库
查看>>
mysql 记录的增删改查
查看>>
MySQL 设置数据库的隔离级别
查看>>
MySQL 证明为什么用limit时,offset很大会影响性能
查看>>
Mysql 语句操作索引SQL语句
查看>>
MySQL 误操作后数据恢复(update,delete忘加where条件)
查看>>
MySQL 调优/优化的 101 个建议!
查看>>
mysql 转义字符用法_MySql 转义字符的使用说明
查看>>
mysql 输入密码秒退
查看>>
mysql 递归查找父节点_MySQL递归查询树状表的子节点、父节点具体实现
查看>>
mysql 通过查看mysql 配置参数、状态来优化你的mysql
查看>>
mysql 里对root及普通用户赋权及更改密码的一些命令
查看>>
Mysql 重置自增列的开始序号
查看>>
mysql 锁机制 mvcc_Mysql性能优化-事务、锁和MVCC
查看>>