Quora Question Pairs
官方比赛链接:https://www.kaggle.com/c/quora-question-pairs
here is some tips:
pandas读取数据的问题
dataframe=pd.read_csv('csvfile')
question1=list(dataframe['question1'])
question1中某些数据会被转换为float格式,需要转为str格式。加上下面这句:
question1=[str(i) for i in question1]
keras分词器Tokenizer
Tokenizer是一个用于向量化文本,或将文本转换为序列(即单词在字典中的下标构成的列表,从1算起)的类。
示例程序:
import keras.preprocessing.text as T
from keras.preprocessing.text import Tokenizertext1='some thing to eat'
text2='some thing to drink'
texts=[text1,text2]print T.text_to_word_sequence(text1) #['some', 'thing', 'to', 'eat']
print T.one_hot(text1,10) #[7, 9, 3, 4]
print T.one_hot(text2,10) #[7, 9, 3, 1]tokenizer = Tokenizer(num_words=10)
tokenzier.fit_on_text(texts)
print tokenizer.word_count #[('some', 2), ('thing', 2), ('to', 2), ('eat', 1), ('drink', 1)]
print tokenizer.word_index #{'some': 1, 'thing': 2,'to': 3 ','eat': 4, drink': 5}
print tokenizer.word_docs #{'some': 2, 'thing': 2, 'to': 2, 'drink': 1, 'eat': 1}
print tokenizer.index_docs #{1: 2, 2: 2, 3: 2, 4: 1, 5: 1}print tokenizer.text_to_sequences(texts) #[[1, 2, 3, 4], [1, 2, 3, 5]]
print tokenizer.text_to_matrix(texts) #
[[ 0., 1., 1., 1., 1., 0., 0., 0., 0., 0.],[ 0., 1., 1., 1., 0., 1., 0., 0., 0., 0.]]
保存数组为numpy的npy二进制格式
np.save(npyfile, array)
array=np.load(npyfile)with open(jsonfile, 'w') as f:json.dump({'nb_words': nb_words}, f)
with open(NB_WORDS_DATA_FILE, 'r') as f:nb_words = json.load(f)['nb_words']
Quora Question Pairs相关推荐
- Quora Question Pairs 项目参考资料
实现多种解决方案的 kaggle比赛--Quora Question Pairs https://blog.csdn.net/qq_27009517/article/details/87716641? ...
- Kaggle:Quora Question Pairs
一.概要 Quora Question Pairs是kaggle上一个关于文本匹配的问题,主要目的是判断两个问题是不是同一个意思. 二.数据简介 数据结构相对比较简单,如下: "id&quo ...
- 从Kaggle赛题: Quora Question Pairs 看文本相似性/相关性
从Kaggle赛题: Quora Question Pairs 看文本相似性/相关性 包大人 健身 Kaggle 自然语言处理 数据挖掘 137 人赞了该文章 从Kaggle赛题: Quora Que ...
- kaggle: quora question pairs
今天看了kaggle竞赛:quora question pairs的一个解决方案,受益匪浅,在此记录一下作者的解题思路. 一.quora question pairs简介 首先,介绍一下quora q ...
- kaggle比赛--Quora Question Pairs
文章目录 数据来源 数据分析 训练集 测试集 训练集的数据分析 字符个数 词的个数 词云 逻辑回归 获得特征 训练数据 ROC 评价 Precision-Recall Curve 评价 XGBoost ...
- kaggle竞赛 | Quora Question Pairs | 判断相似的Question
目录 赛题背景 解题过程 1. 数据分析 2. 构建模型 2.1 特征工程 + 树模型 2.2 词向量 + LSTM 代码中有详细注释解析 不懂请看代码 比赛链接:(数据集下载) https://ww ...
- 用bert来训练quoras question pairs的代码仓
https://github.com/grapefroot/quora-question-pairs
- Improving the Robustness of Question Answering Systems to Question Paraphrasing
<Improving the Robustness of Question Answering Systems to Question Paraphrasing> 新加坡国立大学 这篇论文 ...
- 5 分钟入门 Google 最强NLP模型:BERT
BERT (Bidirectional Encoder Representations from Transformers) 10月11日,Google AI Language 发布了论文 BERT: ...
最新文章
- 线程里面添加参数,并解决多个参数问题[原创]
- 大理,风花雪月俏丽金花
- 11个鲜为人知的实用Linux命令 - Part 2
- 01.WPF中制作无边框窗体
- OpenFileDialog 打开文件对话框
- asp.net数据库操作类(不含存储过程)
- linux mysql 实战_Linux平台MySQL多实例项目实施_MySQL数据库基础与项目实战06
- Python 爬虫 —— scrapy
- 贺利坚老师汇编课程73笔记:键盘输入的处理过程
- 教程-TObjectList.Clear、TStringList.Clear方法对象有没有被释放
- 使用Spring MVC实现数据绑定
- Java连接数据库(学生管理系统案例,可以实现增删改查)
- 金字塔原理读书笔记 一 为什么使用金字塔结构
- Win7下安装Windows SDK
- Android 7.1.1中SystemProperties详解
- 【Zookeeper】查看注册信息命令
- android定位附近店铺,高德地图怎么添加店铺位置_高德地图定位怎么设置添加自己家店铺位置_攻略...
- 【无标题】虚拟机上火狐浏览器无法访问百度 怎么破?
- 爪哇国新游记之六----抽象类
- 高斯消元法与A=LU