python安装及入门学习
来源:互联网 发布:sql存储过程定义变量 编辑:程序博客网 时间:2024/06/05 07:37
python安装及入门学习
python安装:http://www.jianshu.com/p/b8a703df5318
然后再安装一个pycharm就能在这个集成开发环境中写python代码了:http://www.jetbrains.com/pycharm/download/#section=windows
以上安装都是很方便的
学习python的主要目的:自己的研究课题是大数据自然语言处理这块,希望用python自带的一些模型来完成课题。目前用python成功的运行了word2vec模型。现在还处于学习的起步阶段,所以想记录下自己学习过程,同时也区分一下这门高级语言与其他语言的不同。因为我以前擅长的语言是java,现在为了研究的需要,转而来研究python。
python初步学习
这是关于word2vec
#! -*- coding=utf-8 -*-from gensim.models import word2vecimport logging# 主程序logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)sentences = word2vec.Text8Corpus(u"C:\/Users\/yaojuan2\/Desktop\/text8") #加载语料#模型初始化model = word2vec.Word2Vec(sentences, size=200) #训练skip-gram模型; 默认window=5model2 = word2vec.Word2Vec("hello wrold! hello The training algorithms were originally ported from the C package", size=100, window=5, min_count=5, workers=4)print "--------/n"print "--------/n"y1 = model.similarity("woman", "man")print u"woman和man的相似度为:", y1print "--------/n"print "--------/n"y2 = model.most_similar("good", topn=20) # 20个最相关的print u"和good最相关的词有:/n"for item in y2: print item[0], item[1]print "--------/n"print "--------/n"print ' "boy" is to "father" as "girl" is to ...? /n'y3 = model.most_similar(['girl', 'father'], ['boy'], topn=3)for item in y3: print item[0], item[1]print "--------/n"print "--------/n"y4 = model.doesnt_match("breakfast cereal dinner lunch".split())print u"不合群的词:", y4print "--------/n"print "--------/n"y5 = model.init_sims()#model.save('/tmp/text8.model')#model.save_word2vec_format('/tmp/text8.model.bin', binary=True)#model = word2vec.Word2Vec.load_word2vec_format('/tmp/vectors.bin', binary=True)print "--------/n"print "--------/n"model.most_similar(['girl', 'father'], ['boy'], topn=3)print "--------/n"print "--------/n"more_examples = ["he his she", "big bigger bad", "going went being"]for example in more_examples: a, b, x = example.split() predicted = model.most_similar([x, b], [a])[0][0] print "'%s' is to '%s' as '%s' is to '%s'" % (a, b, x, predicted)print "--------/n"print "--------/n"y6=model.wv['computer'] # numpy vector of a word#输出词向量print y6
0 0
- python安装及入门学习
- python安装及入门
- Python入门及安装
- python模块及安装学习
- 安装Python及爬虫入门介绍
- python包tqdm安装及入门
- 从0开始入门机器学习|python及库的安装
- 为什么学习Python及Python环境安装
- Python-机器学习 入门及技巧总结
- 学习笔记python入门-安装Scrapy
- 【机器学习入门——1】Python 开发环境的安装 Python(x,y)及Pycharm
- Python及其开发环境的安装、配置及Python入门
- 【Redis学习】Redis入门安装及使用
- 【python】python安装+入门
- 安装python及机器学习相关软件包
- 程序员的机器学习入门笔记(二):Python常用库的介绍,及安装(Centos 6.5)
- [Python爬虫] scrapy爬虫系列 <一>.安装及入门介绍
- Python的入门学习及开发环境的搭建
- linux进程通信之信号
- Python学习笔记(1)递归函数
- cannot import caffe
- 图像处理中的一阶偏导数和二阶偏导数
- Python 如何打开.pkl文件
- python安装及入门学习
- React 入门实例教程
- Find Peak Element
- 多态理解
- atexit函数用法
- Vue2.0 + vue-router + Vuex实战演练
- ubuntu14.04+GPU安装TensorFlow
- 商人小鑫
- 剑指offer 数组中只出现一次的数字