├── .idea ├── Kaggle_Competition.iml ├── inspectionProfiles │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── vcs.xml └── workspace.xml ├── DigitRecongise_CNN └── CNN_DigitRecongise.py ├── DonorsChoose.org_Competition ├── DonorsChoose_Main.py ├── figure.py └── script.py ├── HomeCreditDefaultRisk └── DeepLearning_method.py ├── HousePices ├── README.md ├── __init__.py ├── deeplearning_method.py ├── main.py └── picture │ └── stacking_model.jpg ├── NLP ├── LDA_sentimental.py ├── Part1_TF-IDF │ ├── README.md │ ├── data │ │ ├── computer │ │ │ ├── 1.xml │ │ │ ├── 10.xml │ │ │ ├── 11.xml │ │ │ ├── 12.xml │ │ │ ├── 13.xml │ │ │ ├── 14.xml │ │ │ ├── 15.xml │ │ │ ├── 16.xml │ │ │ ├── 17.xml │ │ │ ├── 18.xml │ │ │ ├── 19.xml │ │ │ ├── 2.xml │ │ │ ├── 20.xml │ │ │ ├── 21.xml │ │ │ ├── 22.xml │ │ │ ├── 23.xml │ │ │ ├── 24.xml │ │ │ ├── 25.xml │ │ │ ├── 26.xml │ │ │ ├── 27.xml │ │ │ ├── 28.xml │ │ │ ├── 29.xml │ │ │ ├── 3.xml │ │ │ ├── 30.xml │ │ │ ├── 31.xml │ │ │ ├── 32.xml │ │ │ ├── 33.xml │ │ │ ├── 34.xml │ │ │ ├── 35.xml │ │ │ ├── 36.xml │ │ │ ├── 37.xml │ │ │ ├── 4.xml │ │ │ ├── 5.xml │ │ │ ├── 6.xml │ │ │ ├── 7.xml │ │ │ ├── 8.xml │ │ │ └── 9.xml │ │ ├── pro_keyword │ │ │ ├── 1.txt │ │ │ ├── 10.txt │ │ │ ├── 11.txt │ │ │ ├── 12.txt │ │ │ ├── 13.txt │ │ │ ├── 14.txt │ │ │ ├── 15.txt │ │ │ ├── 16.txt │ │ │ ├── 17.txt │ │ │ ├── 18.txt │ │ │ ├── 2.txt │ │ │ ├── 21.txt │ │ │ ├── 22.txt │ │ │ ├── 23.txt │ │ │ ├── 24.txt │ │ │ ├── 25.txt │ │ │ ├── 26.txt │ │ │ ├── 27.txt │ │ │ ├── 28.txt │ │ │ ├── 29.txt │ │ │ ├── 30.txt │ │ │ ├── 31.txt │ │ │ ├── 32.txt │ │ │ ├── 33.txt │ │ │ ├── 35.txt │ │ │ ├── 36.txt │ │ │ ├── 37.txt │ │ │ ├── 38.txt │ │ │ ├── 39.txt │ │ │ ├── 4.txt │ │ │ ├── 40.txt │ │ │ ├── 42.txt │ │ │ ├── 5.txt │ │ │ ├── 6.txt │ │ │ ├── 7.txt │ │ │ ├── 8.txt │ │ │ └── 9.txt │ │ └── title_and_abs │ │ │ ├── 1.txt │ │ │ ├── 10.txt │ │ │ ├── 11.txt │ │ │ ├── 12.txt │ │ │ ├── 13.txt │ │ │ ├── 14.txt │ │ │ ├── 15.txt │ │ │ ├── 16.txt │ │ │ ├── 17.txt │ │ │ ├── 18.txt │ │ │ ├── 2.txt │ │ │ ├── 21.txt │ │ │ ├── 22.txt │ │ │ ├── 23.txt │ │ │ ├── 24.txt │ │ │ ├── 25.txt │ │ │ ├── 26.txt │ │ │ ├── 4.txt │ │ │ ├── 5.txt │ │ │ ├── 6.txt │ │ │ ├── 7.txt │ │ │ ├── 8.txt │ │ │ └── 9.txt │ ├── example.py │ ├── src │ │ ├── GrobalParament.py │ │ ├── GrobalParament.pyc │ │ ├── get_TF_IDF.py │ │ ├── get_data.py │ │ ├── utils.py │ │ └── utils.pyc │ └── test.py ├── README.md ├── __init__.py ├── jieba │ ├── TF_IDF.py │ ├── Text_Rank.py │ ├── __init__.py │ └── jieba_demo.py ├── result.png ├── tf_idf │ └── tf_idf.py └── 抓取数据到分词案例.py ├── README.md ├── TalkingData_Competition ├── TalkingdataKaggle.py ├── Talkingdata_Figure.py ├── lightGBM_TalkingData.py ├── pandas_1M.py └── talking_data.py ├── Tensorflow ├── CNN │ ├── 7.1TF_deal_picture.py │ ├── 7.2图像预处理完整案例.py │ ├── 7.3队列操作.py │ ├── 7.4多线程操作.py │ ├── 8.1循环神经网络前向传播.py │ ├── 8.2LSTM前向传播.py │ ├── 8.4预测正弦函数.py │ ├── Convolutional_example.py │ ├── Example_TF_TFslim.py │ ├── PTB数据的batching方法.py │ ├── PTB数据转换为单词编号.py │ ├── PTB数据集预处理.py │ ├── PTB语言模型.py │ ├── cat.jpeg │ ├── cat.jpg │ ├── ptb.test │ ├── ptb.train │ ├── ptb.valid │ ├── ptb.vocab │ ├── split_flowerdata.py │ └── 深层循环神经网络.py ├── Estimator │ └── Estimator_全连接神经网络.py ├── ExponentialMovingAverage.py ├── Keras │ ├── Keras_LeNet5.py │ ├── log │ │ ├── checkpoint │ │ ├── eval │ │ │ └── events.out.tfevents.1525490421.liudongdeMacBook-Pro.local │ │ ├── events.out.tfevents.1525490369.liudongdeMacBook-Pro.local │ │ ├── events.out.tfevents.1525499215.liudongdeMacBook-Pro.local │ │ ├── graph.pbtxt │ │ ├── model.ckpt-1.data-00000-of-00001 │ │ ├── model.ckpt-1.index │ │ ├── model.ckpt-1.meta │ │ ├── model.ckpt-10000.data-00000-of-00001 │ │ ├── model.ckpt-10000.index │ │ ├── model.ckpt-10000.meta │ │ ├── model.ckpt-10001.data-00000-of-00001 │ │ ├── model.ckpt-10001.index │ │ ├── model.ckpt-10001.meta │ │ ├── model.ckpt-20000.data-00000-of-00001 │ │ ├── model.ckpt-20000.index │ │ └── model.ckpt-20000.meta │ └── 情感分析模型.py ├── L2_5Layer_NeuralNetwork.py ├── LSTM_example.py ├── LossFunction_NeuralNetwork.py ├── MNIST │ ├── mnist_eval.py │ ├── mnist_inference.py │ └── mnist_train.py ├── Save_tf_Graph.py ├── Tensorboard_可视化 │ ├── TensorBoard简单例子.py │ └── __init__.py ├── Tensorflow_turtorial │ ├── .ipynb_checkpoints │ │ ├── 01-Tensorflow入门-checkpoint.ipynb │ │ ├── 02-Tensorflow-基本运算-checkpoint.ipynb │ │ ├── 03-Tensorflow-变量-checkpoint.ipynb │ │ ├── 04-Linear_regression-checkpoint.ipynb │ │ ├── 05-Linear_SVM-checkpoint.ipynb │ │ └── 06-LogisticRegression-checkpoint.ipynb │ ├── 01-Tensorflow入门.ipynb │ ├── 02-Tensorflow-基本运算.ipynb │ ├── 03-Tensorflow-变量.ipynb │ ├── 04-Linear_regression.ipynb │ ├── 05-Linear_SVM.ipynb │ ├── 06-LogisticRegression.ipynb │ └── MNIST_data │ │ ├── t10k-images-idx3-ubyte.gz │ │ ├── t10k-labels-idx1-ubyte.gz │ │ ├── train-images-idx3-ubyte.gz │ │ └── train-labels-idx1-ubyte.gz ├── anna.txt ├── checkpoints │ ├── checkpoint │ ├── i200_1512.ckpt.data-00000-of-00001 │ ├── i200_1512.ckpt.index │ └── i200_1512.ckpt.meta ├── mnist_readData.py ├── neural_network.py ├── placeholder_network.py ├── tensorflow学习笔记.md ├── tflow.py └── twoClassify_neuralNetwork.py ├── Tianchi_Competition ├── Alimama │ ├── BPNN.py │ ├── __init__.py │ ├── __pycache__ │ │ ├── BPNN.cpython-36.pyc │ │ └── __init__.cpython-36.pyc │ ├── data_figure.py │ └── main.py ├── Zhengqi_beginner │ └── model_train.py ├── __init__.py └── __pycache__ │ └── __init__.cpython-36.pyc ├── Titanic_Competition ├── titanic.py └── train.csv ├── XGBoost保存和加载模型 └── _config.yml /.idea/Kaggle_Competition.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 13 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /DonorsChoose.org_Competition/figure.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | 3 | # 加载训练集 4 | train_data = pd.read_csv('/Users/liudong/Desktop/DonorsChoose/train.csv') 5 | print(train_data.head(10)) 6 | 7 | # 对训练集进行分析 8 | print(train_data.describe()) -------------------------------------------------------------------------------- /DonorsChoose.org_Competition/script.py: -------------------------------------------------------------------------------- 1 | # This Python 3 environment comes with many helpful analytics libraries installed 2 | # It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python 3 | # For example, here's several helpful packages to load in 4 | 5 | import numpy as np # linear algebra 6 | import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) 7 | 8 | # Input data files are available in the "../input/" directory. 9 | # For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory 10 | 11 | import os 12 | print(os.listdir("../input")) 13 | 14 | df1 = pd.read_csv("../input/keras-baseline-feature-hashing-cnn/baseline_submission.csv").rename(columns={'project_is_approved': 'project_is_approved1'}) 15 | df2 = pd.read_csv("../input/keras-baseline-feature-hashing-price-tfidf/baseline_submission.csv").rename(columns={'project_is_approved': 'project_is_approved2'}) 16 | df3 = pd.read_csv("../input/extensive-data-analysis-modelling-donors-choose/XGBMarch32018.csv").rename(columns={'project_is_approved': 'project_is_approved3'}) 17 | df4 = pd.read_csv("../input/the-choice-is-yours/blend_submission.csv").rename(columns={'project_is_approved': 'project_is_approved4'}) 18 | df5 = pd.read_csv("../input/the-choice-is-yours/xgb_submission.csv").rename(columns={'project_is_approved': 'project_is_approved5'}) 19 | df6 = pd.read_csv("../input/tf-idf-and-features-logistic-regression/logistic_sub.csv").rename(columns={'project_is_approved': 'project_is_approved6'}) 20 | df7 = pd.read_csv("../input/opanichevlightgbmandtfidfstarter/submission.csv").rename(columns={'project_is_approved': 'project_is_approved7'}) 21 | 22 | 23 | df = pd.merge(df1, df2, on='id') 24 | df = pd.merge(df, df3, on='id') 25 | df = pd.merge(df, df4, on='id') 26 | df = pd.merge(df, df5, on='id') 27 | df = pd.merge(df, df6, on='id') 28 | df = pd.merge(df, df7, on='id') 29 | 30 | 31 | df['project_is_approved'] = (df['project_is_approved1']**3*df['project_is_approved2']**3*df['project_is_approved3']*df['project_is_approved4']*df['project_is_approved5']*df['project_is_approved6']**3*df['project_is_approved7']**6)**(1/18) 32 | 33 | df[['id', 'project_is_approved']].to_csv("simple_average.csv", index=False) 34 | 35 | # Any results you write to the current directory are saved as output. -------------------------------------------------------------------------------- /HousePices/README.md: -------------------------------------------------------------------------------- 1 | ### 在这个方法中我们使用 stacking model 的方法进行预测 2 | #### 首先将我们所使用到的模型的预测结果进行输出,将这些预测结果进行整合,并作为输入,加入到最后的meta-model中作为输出,用这些整合后的结果用来作为新的输出结果 3 | 4 | 实际过程如下图所示: 5 | ![stacking_model图片](./picture/stacking_model.jpg) 6 | 7 | * In this approach, we add a meta-model on averaged base models and use the out-of-folds predictions of these base models to train our meta-model. 8 | * The procedure, for the training part, may be described as follows:Split the total training set into two disjoint sets (here train and .holdout ) 9 | 10 | * Train several base models on the first part (train) 11 | 12 | * Test these base models on the second part (holdout) 13 | 14 | * Use the predictions from 3) (called out-of-folds predictions) as the inputs, and the correct responses (target variable) as the outputs to train a higher level learner called meta-model. 15 | 16 | * The first three steps are done iteratively . If we take for example a 5-fold stacking , we first split the training data into 5 folds. Then we will do 5 iterations. In each iteration, we train every base model on 4 folds and predict on the remaining fold (holdout fold). 17 | 18 | * So, we will be sure, after 5 iterations , that the entire data is used to get out-of-folds predictions that we will then use as new feature to train our meta-model in the step 4. 19 | 20 | * For the prediction part , We average the predictions of all base models on the test data and used them as meta-features on which, the final prediction is done with the meta-model. 21 | -------------------------------------------------------------------------------- /HousePices/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/23 下午2:28' -------------------------------------------------------------------------------- /HousePices/picture/stacking_model.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/HousePices/picture/stacking_model.jpg -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/README.md: -------------------------------------------------------------------------------- 1 | ### 程序说明 2 | 1 运行get_data.py获取预处理的结果 3 | 2 运行TF_IDF.py得到tf-idf的结果 4 | 3 example.py 为计算词频的简单例子,以供对python不熟的同学参考 5 | ### 文件说明 6 | data/title_and_abs 文件夹为实验的源数据 7 | 8 | 9 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/computer/19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 流行学习算法应用于基因芯片数据分析 Analysis on manifold learning algorithm applied to gene chip data 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/computer/20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 信息时代与教师角色的转化 Internet Era and Transformation of Teachers' Role 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/computer/34.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 人格与搜索行为关系之研究——北京大学在校生搜索引擎使用的实证分析 7 | 8 | 9 | 10 | 11 | 13 | 15 | 16 | 17 |
18 |
19 | 20 | 21 | 22 |
23 | 40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/1.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 巩正 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 武汉大学信息管理学院 湖北·武汉 430072  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 电脑迷 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | PC Fan 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2013 (1) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 云计算 61 | 62 | 63 | 64 |    65 | 66 | 电子政务 67 | 68 | 69 | 70 |    71 | 72 | 网络资源 73 | 74 | 75 | 76 |   77 | 78 | 79 | 机标分类号: 80 | 81 | 82 |   83 | 84 | 85 | 机标关键词: 86 | 87 | 88 |   89 | 90 | 91 | 基金项目: 92 | 93 | 94 |   95 | 96 | 97 | DOI: 98 | 99 | 100 | 101 | 102 |   103 | 104 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/10.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 王洪彪 8 | 9 | 10 | 赵世霞 11 | 12 | 13 | WANG Hong-biao 14 | 15 | 16 | ZHAO Shi-xia 17 | 18 | 19 | 20 | 21 |   22 | 23 | 24 | 作者单位: 25 | 26 | 27 | 河南省团校,河南,郑州,450002  28 | 29 | 30 | 刊 名: 31 | 32 | 33 | 34 | 电脑知识与技术 35 | 36 |   37 | 38 | 39 | 40 | 41 | 英文刊名: 42 | 43 | 44 | 45 | COMPUTER KNOWLEDGE AND TECHNOLOGY 46 | 47 |   48 | 49 | 50 | 年,卷(期): 51 | 52 | 53 | 54 | 2010 6(8) 55 | 56 |   57 | 58 | 59 | 分类号: 60 | 61 | 62 | TP3-05  63 | 64 | 65 | 关键词: 66 | 67 | 68 | 69 | 信息时代 70 | 71 | 72 | 73 |    74 | 75 | 教师 76 | 77 | 78 | 79 |    80 | 81 | 角色转化 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | G4 G64  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | 信息时代 99 | 100 | 101 | 教师角色 102 | 103 | 104 | Teachers 105 | 106 | 107 | Transformation 108 | 109 | 110 | Era 111 | 112 | 113 | 学生品德 114 | 115 | 116 | 教育改革 117 | 118 | 119 | 多媒体教学手段 120 | 121 | 122 | 指导者 123 | 124 | 125 | 传统教学手段 126 | 127 | 128 | 生机和活力 129 | 130 | 131 | 教学研究者 132 | 133 | 134 | 教学管理者 135 | 136 | 137 | 自我设计 138 | 139 | 140 | 学习方法 141 | 142 | 143 | 协作学习 144 | 145 | 146 | 未来生活 147 | 148 | 149 | 网络结合 150 | 151 | 152 | 人际关系 153 | 154 | 155 | 培养学生 156 | 157 |   158 | 159 | 160 | 基金项目: 161 | 162 | 163 |   164 | 165 | 166 | DOI: 167 | 168 | 169 | 170 | 10.3969/j.issn.1009-3044.2010.08.055 171 | 172 |   173 | 174 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/11.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 李强 8 | 9 | 10 | LI Qiang 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 韶关学院计算机科学学院,广东韶关,512005  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 韶关学院学报 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | Journal of Shaoguan University 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2014 35(4) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 学科定义 64 | 65 | 66 | 67 |    68 | 69 | 工科 70 | 71 | 72 | 73 |    74 | 75 | 嵌入式系统 76 | 77 | 78 | 79 |    80 | 81 | 开放式系统 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | G40 G25  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | 嵌入式系统 99 | 100 | 101 | 学科定义 102 | 103 | 104 | 理论探讨 105 | 106 | 107 | 学科专业 108 | 109 | 110 | 学科建设 111 | 112 | 113 | 学科分类 114 | 115 | 116 | 高校人才培养 117 | 118 | 119 | 目标定位 120 | 121 | 122 | 教学需求 123 | 124 | 125 | 技术体系 126 | 127 | 128 | 划分方法 129 | 130 | 131 | 高技术 132 | 133 | 134 | 质量 135 | 136 | 137 | 知识 138 | 139 |   140 | 141 | 142 | 基金项目: 143 | 144 | 145 |   146 | 147 | 148 | DOI: 149 | 150 | 151 | 152 | 153 |   154 | 155 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/12.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 王剑 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 印孚瑟斯技术(上海)有限公司,上海,201203  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 电脑知识与技术 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | Computer Knowledge and Technology 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2011 07(27) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-0  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 企业:计算机应用技术 61 | 62 | 63 | 64 |    65 | 66 | 信息化建设 67 | 68 | 69 | 70 |   71 | 72 | 73 | 机标分类号: 74 | 75 | 76 | TM9 G23  77 | 78 | 79 | 机标关键词: 80 | 81 | 82 | 83 | 企业建设 84 | 85 | 86 | 计算机应用技术 87 | 88 | 89 | 信息化建设 90 | 91 | 92 | 计算机技术 93 | 94 | 95 | 信息时代 96 | 97 | 98 | 社会 99 | 100 |   101 | 102 | 103 | 基金项目: 104 | 105 | 106 |   107 | 108 | 109 | DOI: 110 | 111 | 112 | 113 | 10.3969/j.issn.1009-3044.2011.27.011 114 | 115 |   116 | 117 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/13.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 冯介一 8 | 9 | 10 | FENG Jie-yi 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 湖南师范大学,湖南长沙,410081  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电脑知识与技术 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | Computer Knowledge and Technology 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2012 08(10) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 接口技术 64 | 65 | 66 | 67 |    68 | 69 | 教学体系 70 | 71 | 72 | 73 |    74 | 75 | 总线信号 76 | 77 | 78 | 79 |    80 | 81 | 激励 82 | 83 | 84 | 85 |    86 | 87 | 响应 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 | TP3 TM3  98 | 99 | 100 | 机标关键词: 101 | 102 | 103 | 104 | 微机接口技术 105 | 106 | 107 | 新教学体系 108 | 109 | 110 | 体系探讨 111 | 112 | 113 | 总线信号 114 | 115 | 116 | 接口芯片 117 | 118 | 119 | 工作过程 120 | 121 | 122 | 学习 123 | 124 | 125 | 学生 126 | 127 | 128 | 连接 129 | 130 | 131 | 概念 132 | 133 |   134 | 135 | 136 | 基金项目: 137 | 138 | 139 | 湖南师范大学计算机科学技术课程教学团队项目  140 | 141 | 142 | DOI: 143 | 144 | 145 | 146 | 10.3969/j.issn.1009-3044.2012.10.041 147 | 148 |   149 | 150 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/14.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 叶茂枝 8 | 9 | 10 | YE Mao-zhi 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 苏州大学计算机科学与技术学院03高校教师攻硕班,江苏,苏州,215006;宁德师范高等专科学校计算机系,福建,宁德,352100  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 宁德师专学报(自然科学版) 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | JOURNAL OF NINGDE TEACHERS COLLEGE(NATURAL SCIENCE) 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2006 18(2) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-0  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 服务器端OLAP 64 | 65 | 66 | 67 |    68 | 69 | 客户端OLAP 70 | 71 | 72 | 73 |    74 | 75 | 本地数据立方体 76 | 77 | 78 | 79 |   80 | 81 | 82 | 机标分类号: 83 | 84 | 85 |   86 | 87 | 88 | 机标关键词: 89 | 90 | 91 | 92 | 数据立方体 93 | 94 | 95 | 技术 96 | 97 | 98 | 方法 99 | 100 |   101 | 102 | 103 | 基金项目: 104 | 105 | 106 |   107 | 108 | 109 | DOI: 110 | 111 | 112 | 113 | 10.3969/j.issn.2095-2481.2006.02.018 114 | 115 |   116 | 117 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/15.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 杨怀义 8 | 9 | 10 | 李洪波 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 南充职业技术学院,四川 南充 637000  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电脑知识与技术 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | Computer Knowledge and Technology 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2013 (14) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 高职教育 64 | 65 | 66 | 67 |    68 | 69 | 计算机 70 | 71 | 72 | 73 |    74 | 75 | 应用 76 | 77 | 78 | 79 |    80 | 81 | 德育 82 | 83 | 84 | 85 |    86 | 87 | 教学方法 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 |   98 | 99 | 100 | 机标关键词: 101 | 102 | 103 |   104 | 105 | 106 | 基金项目: 107 | 108 | 109 |   110 | 111 | 112 | DOI: 113 | 114 | 115 | 116 | 117 |   118 | 119 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/16.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 石泉龙 8 | 9 | 10 | 王丽亚 11 | 12 | 13 | 吴明兴 14 | 15 | 16 | 17 | 18 |   19 | 20 | 21 | 作者单位: 22 | 23 | 24 | 上海交通大学工业工程与物流工程系 上海200240  25 | 26 | 27 | 刊 名: 28 | 29 | 30 | 31 | 机械制造 32 | 33 |   34 | 35 | 36 | ISTIC 37 | 38 | 39 | 40 | 41 | 英文刊名: 42 | 43 | 44 | 45 | Machinery 46 | 47 |   48 | 49 | 50 | 年,卷(期): 51 | 52 | 53 | 54 | 2014 52(1) 55 | 56 |   57 | 58 | 59 | 分类号: 60 | 61 | 62 | TP3-05  63 | 64 | 65 | 关键词: 66 | 67 | 68 | 69 | 产品功能疲劳 70 | 71 | 72 | 73 |    74 | 75 | 产品功能组合 76 | 77 | 78 | 79 |    80 | 81 | 客户资产 82 | 83 | 84 | 85 |    86 | 87 | 广义回归神经网络 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 | U69 R33  98 | 99 | 100 | 机标关键词: 101 | 102 | 103 | 104 | 产品功能 105 | 106 | 107 | 疲劳因素 108 | 109 | 110 | 客户资产 111 | 112 | 113 | 广义回归神经网络 114 | 115 | 116 | 预测方法 117 | 118 | 119 | 向量 120 | 121 | 122 | 算法优化 123 | 124 | 125 | 量的概念 126 | 127 | 128 | 开发阶段 129 | 130 | 131 | 决策支持 132 | 133 | 134 | 功能组合 135 | 136 | 137 | 处理方法 138 | 139 | 140 | 数据 141 | 142 | 143 | 企业 144 | 145 | 146 | 描述 147 | 148 | 149 | 理想 150 | 151 | 152 | 果蝇 153 | 154 | 155 | 程度 156 | 157 |   158 | 159 | 160 | 基金项目: 161 | 162 | 163 | 国家自然科学基金资助项目  164 | 165 | 166 | DOI: 167 | 168 | 169 | 170 | 171 |   172 | 173 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/17.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 曹振丽 8 | 9 | 10 | 王玉芹 11 | 12 | 13 | 郭祥富 14 | 15 | 16 | CAO Zhen-li 17 | 18 | 19 | WANG Yu-qin 20 | 21 | 22 | GUO Xiang-fu 23 | 24 | 25 | 26 | 27 |   28 | 29 | 30 | 作者单位: 31 | 32 | 33 | 东北电力学院信息系,吉林,吉林,132012  34 | 35 | 36 | 刊 名: 37 | 38 | 39 | 40 | 电脑知识与技术(技术论坛) 41 | 42 |   43 | 44 | 45 | 46 | 47 | 英文刊名: 48 | 49 | 50 | 51 | COMPUTER KNOWLEDGE AND TECHNOLOGY 52 | 53 |   54 | 55 | 56 | 年,卷(期): 57 | 58 | 59 | 60 | 2005 (12) 61 | 62 |   63 | 64 | 65 | 分类号: 66 | 67 | 68 | TP3-0  69 | 70 | 71 | 关键词: 72 | 73 | 74 | 75 | VRML 76 | 77 | 78 | 79 |    80 | 81 | 虚拟现实 82 | 83 | 84 | 85 |    86 | 87 | JSAI 88 | 89 | 90 | 91 |    92 | 93 | EAI 94 | 95 | 96 | 97 |   98 | 99 | 100 | 机标分类号: 101 | 102 | 103 | TP3 TP1  104 | 105 | 106 | 机标关键词: 107 | 108 | 109 | 110 | 虚拟现实技术 111 | 112 | 113 | 虚拟现实建模语言 114 | 115 | 116 | 虚拟现实场景 117 | 118 | 119 | 文章系统 120 | 121 | 122 | 交互功能 123 | 124 | 125 | 动态交互 126 | 127 | 128 | 动态场景 129 | 130 | 131 | 交互式 132 | 133 |   134 | 135 | 136 | 基金项目: 137 | 138 | 139 |   140 | 141 | 142 | DOI: 143 | 144 | 145 | 146 | 147 |   148 | 149 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/18.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 钟萍 8 | 9 | 10 | 李美村 11 | 12 | 13 | ZHONG Ping 14 | 15 | 16 | LI Mei-cun 17 | 18 | 19 | 20 | 21 |   22 | 23 | 24 | 作者单位: 25 | 26 | 27 | 广州大学科技贸易技术学院计算机系,广东,广州,510421  28 | 29 | 30 | 刊 名: 31 | 32 | 33 | 34 | 电脑知识与技术(技术论坛) 35 | 36 |   37 | 38 | 39 | 40 | 41 | 英文刊名: 42 | 43 | 44 | 45 | COMPUTER KNOWLEDGE AND TECHNOLOGY 46 | 47 |   48 | 49 | 50 | 年,卷(期): 51 | 52 | 53 | 54 | 2005 (12) 55 | 56 |   57 | 58 | 59 | 分类号: 60 | 61 | 62 | TP3-05  63 | 64 | 65 | 关键词: 66 | 67 | 68 | 69 | 高职院校 70 | 71 | 72 | 73 |    74 | 75 | 电子商务 76 | 77 | 78 | 79 |    80 | 81 | 专业 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | G63 F71  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | 高职院校 99 | 100 | 101 | 电子商务 102 | 103 | 104 | 商务专业 105 | 106 | 107 | 应用电子技术 108 | 109 | 110 | 综合分析 111 | 112 | 113 | 商务活动 114 | 115 | 116 | 发展现状 117 | 118 | 119 | 发展问题 120 | 121 |   122 | 123 | 124 | 基金项目: 125 | 126 | 127 |   128 | 129 | 130 | DOI: 131 | 132 | 133 | 134 | 135 |   136 | 137 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/2.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 张炎峰 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 武汉大学信息管理学院 湖北·武汉 430072  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 电脑迷 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | PC Fan 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2013 (1) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 地方政府 61 | 62 | 63 | 64 |    65 | 66 | 网站问题 67 | 68 | 69 | 70 |    71 | 72 | 建议 73 | 74 | 75 | 76 |   77 | 78 | 79 | 机标分类号: 80 | 81 | 82 |   83 | 84 | 85 | 机标关键词: 86 | 87 | 88 |   89 | 90 | 91 | 基金项目: 92 | 93 | 94 |   95 | 96 | 97 | DOI: 98 | 99 | 100 | 101 | 102 |   103 | 104 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/21.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 小李 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 |   19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 电脑知识与技术-经验技巧 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | Computer Knowledge and Technology 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2012 (1) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05  54 | 55 | 56 | 关键词: 57 | 58 | 59 |   60 | 61 | 62 | 机标分类号: 63 | 64 | 65 | D92 S15  66 | 67 | 68 | 机标关键词: 69 | 70 | 71 | 72 | 网络游戏 73 | 74 | 75 | 诠释 76 | 77 | 78 | 严重危害 79 | 80 | 81 | 虚拟世界 82 | 83 | 84 | 未成年人 85 | 86 | 87 | 危害社会 88 | 89 | 90 | 身心健康 91 | 92 | 93 | 人的精神 94 | 95 | 96 | 精神毒品 97 | 98 | 99 | 工作压力 100 | 101 | 102 | 姿态 103 | 104 | 105 | 展现 106 | 107 | 108 | 问题 109 | 110 | 111 | 适度 112 | 113 | 114 | 市场 115 | 116 | 117 | 生命 118 | 119 | 120 | 生活 121 | 122 | 123 | 麻痹 124 | 125 | 126 | 论争 127 | 128 | 129 | 几何 130 | 131 |   132 | 133 | 134 | 基金项目: 135 | 136 | 137 |   138 | 139 | 140 | DOI: 141 | 142 | 143 | 144 | 145 |   146 | 147 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/22.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 王昭顺 8 | 9 |   10 | 11 | 12 | 作者单位: 13 | 14 | 15 | 北京科技大学计算机系  16 | 17 | 18 | 母体文献: 19 | 20 | 21 | 北京市高等教育学会2007年学术年会论文集  22 | 23 | 24 | 会议名称: 25 | 26 | 27 | 北京市高等教育学会2007年学术年会   28 | 29 | 30 | 会议时间: 31 | 32 | 33 | 2008年01月01日  34 | 35 | 36 | 会议地点: 37 | 38 | 39 | 北京  40 | 41 | 42 | 主办单位: 43 | 44 | 45 | 北京市高等教育学会  46 | 47 | 48 | 语 种: 49 | 50 | 51 | chi  52 | 53 | 54 | 分类号: 55 | 56 | 57 |   58 | 59 | 60 | 关键词: 61 | 62 | 63 | 64 | 计算机教育 65 | 66 | 67 | 68 |    69 | 70 | 教学内容 71 | 72 | 73 | 74 |    75 | 76 | 教材选择 77 | 78 | 79 | 80 |    81 | 82 | 课程建设 83 | 84 | 85 | 86 |   87 | 88 | 89 | 基金项目: 90 | 91 | 92 |   93 | 94 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/23.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 |   7 | 8 | 9 | 作者单位: 10 | 11 | 12 |   13 | 14 | 15 | 刊 名: 16 | 17 | 18 | 19 | 电脑知识与技术-经验技巧 20 | 21 |   22 | 23 | 24 | 25 | 26 | 英文刊名: 27 | 28 | 29 | 30 | Computer Knowledge and Technology 31 | 32 |   33 | 34 | 35 | 年,卷(期): 36 | 37 | 38 | 39 | 2012 (2) 40 | 41 |   42 | 43 | 44 | 分类号: 45 | 46 | 47 | TP3-05 TN929.53  48 | 49 | 50 | 关键词: 51 | 52 | 53 |   54 | 55 | 56 | 机标分类号: 57 | 58 | 59 | F6 TP3  60 | 61 | 62 | 机标关键词: 63 | 64 | 65 | 66 | 移动娱乐 67 | 68 | 69 | 文化元素 70 | 71 | 72 | 手机游戏 73 | 74 | 75 | 娱乐方式 76 | 77 | 78 | 水果汁液 79 | 80 | 81 | 操作方式 82 | 83 | 84 | 智能手机 85 | 86 | 87 | 娱乐设备 88 | 89 | 90 | 硬件设施 91 | 92 | 93 | 一分为二 94 | 95 | 96 | 休闲游戏 97 | 98 | 99 | 通讯工具 100 | 101 | 102 | 体验 103 | 104 | 105 | 屏幕界面 106 | 107 | 108 | 智能化 109 | 110 | 111 | 在路上 112 | 113 | 114 | 猕猴桃 115 | 116 | 117 | 冲击力 118 | 119 | 120 | 自然 121 | 122 | 123 | 中国 124 | 125 |   126 | 127 | 128 | 基金项目: 129 | 130 | 131 |   132 | 133 | 134 | DOI: 135 | 136 | 137 | 138 | 139 |   140 | 141 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/24.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 瞿亮 8 | 9 | 10 | 王耀南 11 | 12 | 13 | 路晓庆 14 | 15 | 16 | QU Liang 17 | 18 | 19 | WANG Yao-nan 20 | 21 | 22 | LU Xiao-qing 23 | 24 | 25 | 26 | 27 |   28 | 29 | 30 | 作者单位: 31 | 32 | 33 | 湖南大学电气与信息工程学院,湖南长沙,410082  34 | 35 | 36 | 刊 名: 37 | 38 | 39 | 40 | 电气电子教学学报 41 | 42 |   43 | 44 | 45 | 46 | 47 | 英文刊名: 48 | 49 | 50 | 51 | Journal of Electrical & Electronic Education 52 | 53 |   54 | 55 | 56 | 年,卷(期): 57 | 58 | 59 | 60 | 2014 36(4) 61 | 62 |   63 | 64 | 65 | 分类号: 66 | 67 | 68 | G420 TP3-05  69 | 70 | 71 | 关键词: 72 | 73 | 74 | 75 | 电气类 76 | 77 | 78 | 79 |    80 | 81 | 计算机仿真 82 | 83 | 84 | 85 |    86 | 87 | 教学改革 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 |   98 | 99 | 100 | 机标关键词: 101 | 102 | 103 |   104 | 105 | 106 | 基金项目: 107 | 108 | 109 | 湖南大学教学改革与研究项目  110 | 111 | 112 | DOI: 113 | 114 | 115 | 116 | 117 |   118 | 119 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/25.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 曹敏 8 | 9 | 10 | 陈够喜 11 | 12 | 13 | Cao Min 14 | 15 | 16 | Chen Gouxi 17 | 18 | 19 | 20 | 21 |   22 | 23 | 24 | 作者单位: 25 | 26 | 27 | 中北大学,电子与计算机科学技术学院,山西太原,030051  28 | 29 | 30 | 刊 名: 31 | 32 | 33 | 34 | 电子测试 35 | 36 |   37 | 38 | 39 | 40 | 41 | 英文刊名: 42 | 43 | 44 | 45 | ELECTRONIC TEST 46 | 47 |   48 | 49 | 50 | 年,卷(期): 51 | 52 | 53 | 54 | 2011 (2) 55 | 56 |   57 | 58 | 59 | 分类号: 60 | 61 | 62 | TP3-0  63 | 64 | 65 | 关键词: 66 | 67 | 68 | 69 | 信息隐藏 70 | 71 | 72 | 73 |    74 | 75 | 图像置乱 76 | 77 | 78 | 79 |    80 | 81 | 多级 82 | 83 | 84 | 85 |    86 | 87 | 二值图像 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 | TP3 TN9  98 | 99 | 100 | 机标关键词: 101 | 102 | 103 | 104 | 多级 105 | 106 | 107 | 秘密信息嵌入 108 | 109 | 110 | 隐藏方法 111 | 112 | 113 | 信息隐藏 114 | 115 | 116 | 宿主图像 117 | 118 | 119 | 安全性 120 | 121 | 122 | 抗攻击能力 123 | 124 | 125 | 峰值信噪比 126 | 127 | 128 | 图像置乱 129 | 130 | 131 | LSB算法 132 | 133 | 134 | 视觉效果 135 | 136 | 137 | 实验结果 138 | 139 | 140 | 密钥 141 | 142 | 143 | 结合方法 144 | 145 | 146 | 图像块 147 | 148 | 149 | 增强 150 | 151 | 152 | 问题 153 | 154 | 155 | 控制 156 | 157 |   158 | 159 | 160 | 基金项目: 161 | 162 | 163 |   164 | 165 | 166 | DOI: 167 | 168 | 169 | 170 | 10.3969/j.issn.1000-8519.2011.02.009 171 | 172 |   173 | 174 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/26.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 丁雪梅 8 | 9 | 10 | 陈贝贝 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 福建师范大学软件学院,福建福州,350108  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 莆田学院学报 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | journal of putian university 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2012 19(2) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 异常检测 64 | 65 | 66 | 67 |    68 | 69 | 统计方法 70 | 71 | 72 | 73 |    74 | 75 | 神经网络方法 76 | 77 | 78 | 79 |    80 | 81 | 基于规则的方法 82 | 83 | 84 | 85 |    86 | 87 | 支持向量机 88 | 89 | 90 | 91 |    92 | 93 | novelty detection 94 | 95 | 96 | 97 |    98 | 99 | statistical approaches 100 | 101 | 102 | 103 |    104 | 105 | neural network approaches 106 | 107 | 108 | 109 |    110 | 111 | rule-based approach 112 | 113 | 114 | 115 |    116 | 117 | SVM approach 118 | 119 | 120 | 121 |   122 | 123 | 124 | 机标分类号: 125 | 126 | 127 | G4 TP3  128 | 129 | 130 | 机标关键词: 131 | 132 | 133 | 134 | 基于标准 135 | 136 | 137 | 数据集 138 | 139 | 140 | 异常检测技术 141 | 142 | 143 | 实验分析 144 | 145 | 146 | Benchmark 147 | 148 | 149 | Based 150 | 151 | 152 | Experimental Analysis 153 | 154 | 155 | 异常检测算法 156 | 157 | 158 | novelty detection 159 | 160 | 161 | Gaussian Mixture 162 | 163 | 164 | Operating Characteristics 165 | 166 | 167 | experimental analysis 168 | 169 | 170 | different 171 | 172 | 173 | the differences 174 | 175 | 176 | performance 177 | 178 | 179 | literature 180 | 181 | 182 | comparison 183 | 184 | 185 | algorithms 186 | 187 | 188 | benchmark 189 | 190 | 191 | 性能 192 | 193 |   194 | 195 | 196 | 基金项目: 197 | 198 | 199 | 福建省教育厅科研基金资助项目  200 | 201 | 202 | DOI: 203 | 204 | 205 | 206 | 10.3969/j.issn.1672-4143.2012.02.013 207 | 208 |   209 | 210 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/27.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 |   7 | 8 | 9 | 作者单位: 10 | 11 | 12 |   13 | 14 | 15 | 刊 名: 16 | 17 | 18 | 19 | 电子工业专用设备 20 | 21 |   22 | 23 | 24 | 25 | 26 | 英文刊名: 27 | 28 | 29 | 30 | Equipment for Electronic Products Marufacturing 31 | 32 |   33 | 34 | 35 | 年,卷(期): 36 | 37 | 38 | 39 | 2011 40(8) 40 | 41 |   42 | 43 | 44 | 分类号: 45 | 46 | 47 | TP3-09  48 | 49 | 50 | 关键词: 51 | 52 | 53 | 54 | 集成电路技术 55 | 56 | 57 | 58 |    59 | 60 | 测试平台 61 | 62 | 63 | 64 |    65 | 66 | 宽频段 67 | 68 | 69 | 70 |    71 | 72 | 高精度 73 | 74 | 75 | 76 |   77 | 78 | 79 | 机标分类号: 80 | 81 | 82 | TN9 TP3  83 | 84 | 85 | 机标关键词: 86 | 87 | 88 | 89 | 集成电路技术 90 | 91 | 92 | 股份有限公司 93 | 94 | 95 | 测试平台 96 | 97 | 98 | 宽频段 99 | 100 | 101 | 高精度 102 | 103 | 104 | 芯片 105 | 106 | 107 | 射频 108 | 109 | 110 | 宽带 111 | 112 | 113 | 基带 114 | 115 |   116 | 117 | 118 | 基金项目: 119 | 120 | 121 |   122 | 123 | 124 | DOI: 125 | 126 | 127 | 128 | 129 |   130 | 131 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/28.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 沈绪榜 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 西安微电子技术研究所,西安,710054  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 国际技术经济研究 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | STUDIES IN INTERNATIONAL TECHNOLOGY AND ECONOMY 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2003 6(4) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05 TP212  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 传感器 61 | 62 | 63 | 64 |    65 | 66 | 计算机 67 | 68 | 69 | 70 |    71 | 72 | 解释世界 73 | 74 | 75 | 76 |    77 | 78 | 改造世界 79 | 80 | 81 | 82 |   83 | 84 | 85 | 机标分类号: 86 | 87 | 88 | G40 G64  89 | 90 | 91 | 机标关键词: 92 | 93 | 94 | 95 | 伊拉克 96 | 97 | 98 | 战争 99 | 100 | 101 | 计算机 102 | 103 | 104 | 传感器技术 105 | 106 | 107 | 模拟世界 108 | 109 | 110 | 解释世界 111 | 112 | 113 | 改变世界 114 | 115 | 116 | 数字 117 | 118 | 119 | 融合 120 | 121 | 122 | 构成 123 | 124 | 125 | 白雪 126 | 127 |   128 | 129 | 130 | 基金项目: 131 | 132 | 133 |   134 | 135 | 136 | DOI: 137 | 138 | 139 | 140 | 141 |   142 | 143 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/29.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 张玉喜 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 哈尔滨工程大学,经济管理学院,黑龙江,哈尔滨,150001  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 学术交流 26 | 27 |   28 | 29 | 30 | PKU 31 | 32 | 33 | CSSCI 34 | 35 | 36 | 37 | 38 | 英文刊名: 39 | 40 | 41 | 42 | ACADEMIC EXCHANGE 43 | 44 |   45 | 46 | 47 | 年,卷(期): 48 | 49 | 50 | 51 | 2004 (2) 52 | 53 |   54 | 55 | 56 | 分类号: 57 | 58 | 59 | TP3-05 G640  60 | 61 | 62 | 关键词: 63 | 64 | 65 | 66 | 网络高等教育 67 | 68 | 69 | 70 |    71 | 72 | 产业化机制 73 | 74 | 75 | 76 |    77 | 78 | 企业 79 | 80 | 81 | 82 |    83 | 84 | 合作办学模式 85 | 86 | 87 | 88 |    89 | 90 | 集团化 91 | 92 | 93 | 94 |   95 | 96 | 97 | 机标分类号: 98 | 99 | 100 | TP3 G64  101 | 102 | 103 | 机标关键词: 104 | 105 | 106 | 107 | 网络高等教育 108 | 109 | 110 | 产业化 111 | 112 | 113 | 机制研究 114 | 115 | 116 | 合作办学模式 117 | 118 | 119 | 运作机制 120 | 121 | 122 | 企业 123 | 124 | 125 | 经济优势 126 | 127 | 128 | 技术支持 129 | 130 | 131 | 资金 132 | 133 | 134 | 属性 135 | 136 | 137 | 经营 138 | 139 | 140 | 集团 141 | 142 | 143 | 高校 144 | 145 |   146 | 147 | 148 | 基金项目: 149 | 150 | 151 | 黑龙江省高等教育学会资助项目  152 | 153 | 154 | DOI: 155 | 156 | 157 | 158 | 10.3969/j.issn.1000-8284.2004.02.040 159 | 160 |   161 | 162 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/30.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 殷锋社 8 | 9 | 10 | YIN Feng-she 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 陕西工业职业技术学院,陕西,咸阳,712000  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电子设计工程 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | ELECTRONIC DESIGN ENGINEERING 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2011 19(7) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 检测模型 64 | 65 | 66 | 67 |    68 | 69 | 网络引擎 70 | 71 | 72 | 73 |    74 | 75 | 主机代理 76 | 77 | 78 | 79 |    80 | 81 | 特征库 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | TP3 TN9  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | 网络引擎 99 | 100 | 101 | 入侵检测系统 102 | 103 | 104 | network 105 | 106 | 107 | based 108 | 109 | 110 | intrusion detection system 111 | 112 | 113 | implementation 114 | 115 | 116 | 主机代理 117 | 118 | 119 | 检测模型 120 | 121 | 122 | 企业网络 123 | 124 | 125 | 攻击 126 | 127 | 128 | IDS系统 129 | 130 | 131 | 特征库 132 | 133 | 134 | 数据库 135 | 136 | 137 | 组件 138 | 139 | 140 | 网段 141 | 142 | 143 | 滥用 144 | 145 | 146 | 监视 147 | 148 | 149 | 技术 150 | 151 | 152 | 存储 153 | 154 |   155 | 156 | 157 | 基金项目: 158 | 159 | 160 |   161 | 162 | 163 | DOI: 164 | 165 | 166 | 167 | 10.3969/j.issn.1674-6236.2011.07.027 168 | 169 |   170 | 171 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/31.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 焦蕾 8 | 9 | 10 | 殷锋社 11 | 12 | 13 | JIAO Lei 14 | 15 | 16 | YIN Feng-she 17 | 18 | 19 | 20 | 21 |   22 | 23 | 24 | 作者单位: 25 | 26 | 27 | 陕西工业职业技术学院,陕西,咸阳,712000  28 | 29 | 30 | 刊 名: 31 | 32 | 33 | 34 | 电子设计工程 35 | 36 |   37 | 38 | 39 | 40 | 41 | 英文刊名: 42 | 43 | 44 | 45 | ELECTRONIC DESIGN ENGINEERING 46 | 47 |   48 | 49 | 50 | 年,卷(期): 51 | 52 | 53 | 54 | 2011 19(10) 55 | 56 |   57 | 58 | 59 | 分类号: 60 | 61 | 62 | TP3-05  63 | 64 | 65 | 关键词: 66 | 67 | 68 | 69 | 个性化 70 | 71 | 72 | 73 |    74 | 75 | 推理引擎 76 | 77 | 78 | 79 |    80 | 81 | 认知型学生模型 82 | 83 | 84 | 85 |    86 | 87 | 实验结果分析 88 | 89 | 90 | 91 |   92 | 93 | 94 | 机标分类号: 95 | 96 | 97 | G62 G43  98 | 99 | 100 | 机标关键词: 101 | 102 | 103 | 104 | 个性化教学系统 105 | 106 | 107 | 认知学生模型 108 | 109 | 110 | 分析与设计 111 | 112 | 113 | student model 114 | 115 | 116 | cognition 117 | 118 | 119 | design 120 | 121 | 122 | 计算机应用基础 123 | 124 | 125 | 总体结构 126 | 127 | 128 | 以学为主 129 | 130 | 131 | 学习模式 132 | 133 | 134 | 推理引擎 135 | 136 | 137 | 实验结果 138 | 139 | 140 | 教学建议 141 | 142 | 143 | 智能化 144 | 145 | 146 | 推理机 147 | 148 | 149 | 合理化 150 | 151 | 152 | 方法 153 | 154 |   155 | 156 | 157 | 基金项目: 158 | 159 | 160 |   161 | 162 | 163 | DOI: 164 | 165 | 166 | 167 | 10.3969/j.issn.1674-6236.2011.10.006 168 | 169 |   170 | 171 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/32.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 李正华 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 湖南城市学院信息与计算机科学系,湖南,益阳,413000  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 怀化学院学报 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | JOURNAL OF HUAIHUA UNIVERSITY 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2004 23(2) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 计算机安全 61 | 62 | 63 | 64 |    65 | 66 | 病毒 67 | 68 | 69 | 70 |    71 | 72 | 教育 73 | 74 | 75 | 76 |   77 | 78 | 79 | 机标分类号: 80 | 81 | 82 | TP3 G4  83 | 84 | 85 | 机标关键词: 86 | 87 | 88 | 89 | 计算机 90 | 91 | 92 | 病毒 93 | 94 | 95 | 安全教育 96 | 97 | 98 | Computer Virus 99 | 100 | 101 | 适应时代需要 102 | 103 | 104 | 不安全因素 105 | 106 | 107 | 滞后 108 | 109 | 110 | 框架 111 | 112 |   113 | 114 | 115 | 基金项目: 116 | 117 | 118 |   119 | 120 | 121 | DOI: 122 | 123 | 124 | 125 | 10.3969/j.issn.1671-9743.2004.02.038 126 | 127 |   128 | 129 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/33.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 马晓翔 8 | 9 |   10 | 11 | 12 | 作者单位: 13 | 14 | 15 | 南京艺术学院传媒学院数字媒体艺术系  16 | 17 | 18 | 母体文献: 19 | 20 | 21 | 2008全国新媒体艺术系主任(院长)论坛论文集  22 | 23 | 24 | 会议名称: 25 | 26 | 27 | 2008全国新媒体艺术系主任(院长)论坛   28 | 29 | 30 | 会议时间: 31 | 32 | 33 | 2008年11月01日  34 | 35 | 36 | 会议地点: 37 | 38 | 39 | 上海  40 | 41 | 42 | 主办单位: 43 | 44 | 45 | 中国工程图学学会  46 | 47 | 48 | 语 种: 49 | 50 | 51 | chi  52 | 53 | 54 | 分类号: 55 | 56 | 57 |   58 | 59 | 60 | 关键词: 61 | 62 | 63 | 64 | 网络文化 65 | 66 | 67 | 68 |    69 | 70 | 网络视听空间 71 | 72 | 73 | 74 |    75 | 76 | 艺术风格 77 | 78 | 79 | 80 |    81 | 82 | 民族特色 83 | 84 | 85 | 86 |   87 | 88 | 89 | 基金项目: 90 | 91 | 92 |   93 | 94 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/35.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 梅创社 8 | 9 | 10 | MEI Chuang-she 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 陕西工业职业技术学院,陕西咸阳,712000  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电子设计工程 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | ELECTRONIC DESIGN ENGINEERING 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2011 19(11) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | Agent 64 | 65 | 66 | 67 |    68 | 69 | 体系结构 70 | 71 | 72 | 73 |    74 | 75 | 通信语言 76 | 77 | 78 | 79 |    80 | 81 | 协作机制 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | TP3 TN7  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | Agent技术 99 | 100 | 101 | 分析 102 | 103 | 104 | Agent technology 105 | 106 | 107 | analysis 108 | 109 | 110 | Agent系统 111 | 112 | 113 | 知识交互 114 | 115 | 116 | 协作机制 117 | 118 | 119 | 系统开发 120 | 121 | 122 | 通信语言 123 | 124 | 125 | 体系结构 126 | 127 | 128 | 理论依据 129 | 130 | 131 | 技术支持 132 | 133 | 134 | 技术原理 135 | 136 | 137 | 智能化 138 | 139 | 140 | Agnet 141 | 142 | 143 | 概念 144 | 145 | 146 | CSCL 147 | 148 |   149 | 150 | 151 | 基金项目: 152 | 153 | 154 |   155 | 156 | 157 | DOI: 158 | 159 | 160 | 161 | 10.3969/j.issn.1674-6236.2011.11.038 162 | 163 |   164 | 165 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/36.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 何明升 8 | 9 | 10 | 白淑英 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 何明升(华东政法大学社会发展学院,上海,201620) 22 | 23 | 白淑英(哈尔滨工业大学人文学院,哈尔滨,150006)  24 | 25 | 26 | 刊 名: 27 | 28 | 29 | 30 | 学术交流 31 | 32 |   33 | 34 | 35 | PKU 36 | 37 | 38 | CSSCI 39 | 40 | 41 | 42 | 43 | 英文刊名: 44 | 45 | 46 | 47 | Academic Exchange 48 | 49 |   50 | 51 | 52 | 年,卷(期): 53 | 54 | 55 | 56 | 2014 (1) 57 | 58 |   59 | 60 | 61 | 分类号: 62 | 63 | 64 | TP3-05 G112  65 | 66 | 67 | 关键词: 68 | 69 | 70 | 71 | 网络文化 72 | 73 | 74 | 75 |    76 | 77 | 多主体协同 78 | 79 | 80 | 81 |    82 | 83 | 发展战略 84 | 85 | 86 | 87 |   88 | 89 | 90 | 机标分类号: 91 | 92 | 93 | F12 G0  94 | 95 | 96 | 机标关键词: 97 | 98 | 99 | 100 | 网络文化 101 | 102 | 103 | 文化建设 104 | 105 | 106 | 多主体 107 | 108 | 109 | 协同发展战略 110 | 111 | 112 | 目标特征 113 | 114 | 115 | 文化软实力 116 | 117 | 118 | 全球竞争力 119 | 120 | 121 | 法制化建设 122 | 123 | 124 | 多元化主体 125 | 126 | 127 | 中国特色 128 | 129 | 130 | 虚拟实践 131 | 132 | 133 | 协同管理 134 | 135 | 136 | 文化成果 137 | 138 | 139 | 网络群体 140 | 141 | 142 | 管理部门 143 | 144 | 145 | 共享网络 146 | 147 | 148 | 目标群 149 | 150 | 151 | 多层次 152 | 153 | 154 | 政治 155 | 156 | 157 | 网民 158 | 159 |   160 | 161 | 162 | 基金项目: 163 | 164 | 165 | 国家社会科学基金重点课题"中国特色网络文化建设与管理发展战略研究"  166 | 167 | 168 | DOI: 169 | 170 | 171 | 172 | 173 |   174 | 175 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/37.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 贠芳侠 8 | 9 | 10 | 邵坤鹏 11 | 12 | 13 | 刘迪 14 | 15 | 16 | 17 | 18 |   19 | 20 | 21 | 作者单位: 22 | 23 | 24 | 陕西华县金堆城钼业股份有限公司陕西渭南714102  25 | 26 | 27 | 刊 名: 28 | 29 | 30 | 31 | 电子设计工程 32 | 33 |   34 | 35 | 36 | 37 | 38 | 英文刊名: 39 | 40 | 41 | 42 | Electronic Design Engineering 43 | 44 |   45 | 46 | 47 | 年,卷(期): 48 | 49 | 50 | 51 | 2011 19(17) 52 | 53 |   54 | 55 | 56 | 分类号: 57 | 58 | 59 | TP3-0  60 | 61 | 62 | 关键词: 63 | 64 | 65 | 66 | 计量标准 67 | 68 | 69 | 70 |    71 | 72 | 测量过程 73 | 74 | 75 | 76 |    77 | 78 | 统计控制 79 | 80 | 81 | 82 |    83 | 84 | 控制图 85 | 86 | 87 | 88 |    89 | 90 | measurement standards 91 | 92 | 93 | 94 |    95 | 96 | measurement process 97 | 98 | 99 | 100 |    101 | 102 | statistical control 103 | 104 | 105 | 106 |    107 | 108 | control charts 109 | 110 | 111 | 112 |   113 | 114 | 115 | 机标分类号: 116 | 117 | 118 | TB9 V24  119 | 120 | 121 | 机标关键词: 122 | 123 | 124 | 125 | 计量标准 126 | 127 | 128 | 测量过程控制 129 | 130 | 131 | 过程统计控制 132 | 133 | 134 | based 135 | 136 | 137 | Statistical control 138 | 139 | 140 | application example 141 | 142 | 143 | quality control 144 | 145 | 146 | control method 147 | 148 | 149 | 推广和应用 150 | 151 | 152 | 科学规范化 153 | 154 | 155 | appraisal 156 | 157 | 158 | 质量要求 159 | 160 | 161 | 实例应用 162 | 163 | 164 | 考核规范 165 | 166 | 167 | 证明 168 | 169 | 170 | 特点 171 | 172 | 173 | 钼业 174 | 175 | 176 | 公司 177 | 178 | 179 | 方法 180 | 181 |   182 | 183 | 184 | 基金项目: 185 | 186 | 187 |   188 | 189 | 190 | DOI: 191 | 192 | 193 | 194 | 10.3969/j.issn.1674-6236.2011.17.031 195 | 196 |   197 | 198 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/38.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 曲蕴慧 8 | 9 | 10 | 白新国 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 曲蕴慧(西安医学院公共课部计算机教研室,陕西西安,710021) 22 | 23 | 白新国(西安工程大学计算机科学学院,陕西西安,710048)  24 | 25 | 26 | 刊 名: 27 | 28 | 29 | 30 | 电子设计工程 31 | 32 |   33 | 34 | 35 | 36 | 37 | 英文刊名: 38 | 39 | 40 | 41 | Electronic Design Engineering 42 | 43 |   44 | 45 | 46 | 年,卷(期): 47 | 48 | 49 | 50 | 2011 19(19) 51 | 52 |   53 | 54 | 55 | 分类号: 56 | 57 | 58 | TP3-05  59 | 60 | 61 | 关键词: 62 | 63 | 64 | 65 | SOA 66 | 67 | 68 | 69 |    70 | 71 | JSP 72 | 73 | 74 | 75 |    76 | 77 | 信息管理 78 | 79 | 80 | 81 |    82 | 83 | 服务 84 | 85 | 86 | 87 |    88 | 89 | SOA 90 | 91 | 92 | 93 |    94 | 95 | JSP 96 | 97 | 98 | 99 |    100 | 101 | information management 102 | 103 | 104 | 105 |    106 | 107 | service 108 | 109 | 110 | 111 |   112 | 113 | 114 | 机标分类号: 115 | 116 | 117 | TP3 G43  118 | 119 | 120 | 机标关键词: 121 | 122 | 123 | 124 | SOA 125 | 126 | 127 | 毕业 128 | 129 | 130 | 信息管理系统 131 | 132 | 133 | 系统设计 134 | 135 | 136 | base 137 | 138 | 139 | information management system 140 | 141 | 142 | realization 143 | 144 | 145 | Web services 146 | 147 | 148 | frame model 149 | 150 | 151 | programming language 152 | 153 | 154 | 架构模型 155 | 156 | 157 | business process 158 | 159 | 160 | 服务集成 161 | 162 | 163 | JSP 164 | 165 | 166 | design 167 | 168 | 169 | transfer of 170 | 171 | 172 | paper 173 | 174 | 175 | Based 176 | 177 | 178 | 指导思想 179 | 180 | 181 | 业务流程 182 | 183 |   184 | 185 | 186 | 基金项目: 187 | 188 | 189 |   190 | 191 | 192 | DOI: 193 | 194 | 195 | 196 | 10.3969/j.issn.1674-6236.2011.19.013 197 | 198 |   199 | 200 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/39.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 何明升 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 哈尔滨工业大学,人文与社会科学学院,黑龙江,哈尔滨,150001  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 学术交流 26 | 27 |   28 | 29 | 30 | PKU 31 | 32 | 33 | CSSCI 34 | 35 | 36 | 37 | 38 | 英文刊名: 39 | 40 | 41 | 42 | ACADEMIC EXCHANGE 43 | 44 |   45 | 46 | 47 | 年,卷(期): 48 | 49 | 50 | 51 | 2004 (10) 52 | 53 |   54 | 55 | 56 | 分类号: 57 | 58 | 59 | TP3-05 F014.5  60 | 61 | 62 | 关键词: 63 | 64 | 65 | 66 | 互联网 67 | 68 | 69 | 70 |    71 | 72 | 网络消费 73 | 74 | 75 | 76 |    77 | 78 | 制度创新 79 | 80 | 81 | 82 |   83 | 84 | 85 | 机标分类号: 86 | 87 | 88 | F06 F0  89 | 90 | 91 | 机标关键词: 92 | 93 | 94 | 95 | 网络消费 96 | 97 | 98 | 制度创新 99 | 100 | 101 | 自我强化 102 | 103 | 104 | 制度稀缺 105 | 106 | 107 | 网络经济 108 | 109 | 110 | 社会地位 111 | 112 | 113 | 制度化 114 | 115 | 116 | 纯收益 117 | 118 | 119 | 创新者 120 | 121 | 122 | 效应 123 | 124 | 125 | 经历 126 | 127 |   128 | 129 | 130 | 基金项目: 131 | 132 | 133 | 国家社会科学基金  134 | 135 | 136 | DOI: 137 | 138 | 139 | 140 | 10.3969/j.issn.1000-8284.2004.10.023 141 | 142 |   143 | 144 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/4.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 赵红敏 8 | 9 |   10 | 11 | 12 | 学科专业: 13 | 14 | 15 | 16 | 材料物理与化学 17 | 18 |   19 | 20 | 21 | 授予学位: 22 | 23 | 24 | 硕士  25 | 26 | 27 | 学位授予单位: 28 | 29 | 30 | 31 | 天津大学 32 | 33 |   34 | 35 | 36 | 导师姓名: 37 | 38 | 39 | 40 | 林家逖 41 | 42 |   43 | 44 | 45 | 学位年度: 46 | 47 | 48 | 2002  49 | 50 | 51 | 研究方向: 52 | 53 | 54 |   55 | 56 | 57 | 语 种: 58 | 59 | 60 | chi  61 | 62 | 63 | 分类号: 64 | 65 | 66 | TP3-05  67 | 68 | 69 | 关键词: 70 | 71 | 72 | 73 | 量子计算机 74 | 75 | 76 | 77 |    78 | 79 | 冷槽离子 80 | 81 | 82 | 83 |    84 | 85 | 退相干 86 | 87 | 88 | 89 |    90 | 91 | 质心模式 92 | 93 | 94 | 95 |    96 | 97 | 呼吸模式 98 | 99 | 100 | 101 |    102 | 103 | 离子内态 104 | 105 | 106 | 107 |    108 | 109 | Lamb-Dicke参数 110 | 111 | 112 | 113 |    114 | 115 | Rabi频率 116 | 117 | 118 | 119 |   120 | 121 | 122 | 机标分类号: 123 | 124 | 125 |   126 | 127 | 128 | 机标关键词: 129 | 130 | 131 | 132 | 冷槽离子 133 | 134 |    135 | 136 | 量子计算机 137 | 138 |    139 | 140 | 量子位 141 | 142 |    143 | 144 | 声子 145 | 146 |    147 | 148 | 量子统计 149 | 150 |    151 | 152 | 函数方法 153 | 154 |    155 | 156 | 双时格林函数 157 | 158 |    159 | 160 | 热稳定性 161 | 162 |    163 | 164 | 子模型 165 | 166 |    167 | 168 | 离子相互作用 169 | 170 |    171 | 172 | 质心模式 173 | 174 |    175 | 176 | 运动规律 177 | 178 |    179 | 180 | 研究方向 181 | 182 |    183 | 184 | 温度效应 185 | 186 |    187 | 188 | 频率值 189 | 190 |    191 | 192 | 计算过程 193 | 194 |    195 | 196 | 激光冷却 197 | 198 |    199 | 200 | 工作原理 201 | 202 |    203 | 204 | 操作 205 | 206 |    207 | 208 | 装置 209 | 210 |   211 | 212 | 213 | 基金项目: 214 | 215 | 216 |   217 | 218 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/40.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 殷锋社 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 陕西工业职业技术学院,陕西咸阳,712000  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 电子设计工程 26 | 27 |   28 | 29 | 30 | 31 | 32 | 英文刊名: 33 | 34 | 35 | 36 | Electronic Design Engineering 37 | 38 |   39 | 40 | 41 | 年,卷(期): 42 | 43 | 44 | 45 | 2012 20(3) 46 | 47 |   48 | 49 | 50 | 分类号: 51 | 52 | 53 | TP3-05  54 | 55 | 56 | 关键词: 57 | 58 | 59 | 60 | 电子商务环境 61 | 62 | 63 | 64 |    65 | 66 | 多Agent 67 | 68 | 69 | 70 |    71 | 72 | 需求代理系统 73 | 74 | 75 | 76 |    77 | 78 | 个性化需求 79 | 80 | 81 | 82 |    83 | 84 | e-commerce environment 85 | 86 | 87 | 88 |    89 | 90 | multi-Agent 91 | 92 | 93 | 94 |    95 | 96 | demand agent system 97 | 98 | 99 | 100 |    101 | 102 | individual needs 103 | 104 | 105 | 106 |   107 | 108 | 109 | 机标分类号: 110 | 111 | 112 | TP3 F49  113 | 114 | 115 | 机标关键词: 116 | 117 | 118 | 119 | multi-Agent 120 | 121 | 122 | 消费者需求 123 | 124 | 125 | 需求代理 126 | 127 | 128 | 系统分析 129 | 130 | 131 | research 132 | 133 | 134 | analysis 135 | 136 | 137 | based 138 | 139 | 140 | 生命周期阶段 141 | 142 | 143 | different 144 | 145 | 146 | 电子商务环境 147 | 148 | 149 | agent system 150 | 151 | 152 | Multi-Agent 153 | 154 | 155 | 需求为导向 156 | 157 | 158 | 个性化需求 159 | 160 | 161 | life cycle 162 | 163 | 164 | individual 165 | 166 | 167 | e-commerce 168 | 169 | 170 | 需求特点 171 | 172 | 173 | 工作流程 174 | 175 | 176 | 个人偏好 177 | 178 |   179 | 180 | 181 | 基金项目: 182 | 183 | 184 | 陕西工业职业技术学院课题  185 | 186 | 187 | DOI: 188 | 189 | 190 | 191 | 10.3969/j.issn.1674-6236.2012.03.006 192 | 193 |   194 | 195 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/42.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 焦蕾 8 | 9 | 10 | 殷锋社 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 陕西工业职业技术学院,陕西咸阳,712000  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电子设计工程 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | Electronic Design Engineering 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2012 20(5) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 图片检索 64 | 65 | 66 | 67 |    68 | 69 | 搜索引擎 70 | 71 | 72 | 73 |    74 | 75 | 关键技术 76 | 77 | 78 | 79 |    80 | 81 | 总体结构图 82 | 83 | 84 | 85 |    86 | 87 | image retrieval 88 | 89 | 90 | 91 |    92 | 93 | search engine 94 | 95 | 96 | 97 |    98 | 99 | key technology 100 | 101 | 102 | 103 |    104 | 105 | system structure diagram 106 | 107 | 108 | 109 |   110 | 111 | 112 | 机标分类号: 113 | 114 | 115 | TP3 G25  116 | 117 | 118 | 机标关键词: 119 | 120 | 121 | 122 | 图像搜索引擎 123 | 124 | 125 | 搜索引擎检索 126 | 127 | 128 | 模式分析 129 | 130 | 131 | search engine 132 | 133 | 134 | image 135 | 136 | 137 | design 138 | 139 | 140 | information extraction 141 | 142 | 143 | 图片检索 144 | 145 | 146 | 检索模式 147 | 148 | 149 | analysis 150 | 151 | 152 | key technology 153 | 154 | 155 | realization 156 | 157 | 158 | 总体结构图 159 | 160 | 161 | structure 162 | 163 | 164 | 相关信息 165 | 166 | 167 | 提取信息 168 | 169 | 170 | 关键技术 171 | 172 | 173 | provided 174 | 175 | 176 | HTML文档 177 | 178 | 179 | Web图片 180 | 181 |   182 | 183 | 184 | 基金项目: 185 | 186 | 187 |   188 | 189 | 190 | DOI: 191 | 192 | 193 | 194 | 10.3969/j.issn.1674-6236.2012.05.051 195 | 196 |   197 | 198 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/5.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 张军林 8 | 9 | 10 | ZHANG Jun-lin 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 新华日报报业集团,江苏,南京,210000  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电脑知识与技术(学术交流) 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | COMPUTER KNOWLEDGE AND TECHNOLOGY 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2006 (1) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-05  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | 计算机技术 64 | 65 | 66 | 67 |    68 | 69 | 计算机排版 70 | 71 | 72 | 73 |    74 | 75 | 计算机制图 76 | 77 | 78 | 79 |    80 | 81 | 现代排版系统 82 | 83 | 84 | 85 |   86 | 87 | 88 | 机标分类号: 89 | 90 | 91 | G23 I20  92 | 93 | 94 | 机标关键词: 95 | 96 | 97 | 98 | 计算机技术 99 | 100 | 101 | 报刊出版 102 | 103 | 104 | 应用 105 | 106 | 107 | 出版周期 108 | 109 | 110 | 编辑加工 111 | 112 | 113 | 工作量 114 | 115 | 116 | 质量 117 | 118 | 119 | 制图 120 | 121 | 122 | 校对 123 | 124 | 125 | 投稿 126 | 127 | 128 | 缩短 129 | 130 | 131 | 排版 132 | 133 |   134 | 135 | 136 | 基金项目: 137 | 138 | 139 |   140 | 141 | 142 | DOI: 143 | 144 | 145 | 146 | 10.3969/j.issn.1009-3044.2006.01.095 147 | 148 |   149 | 150 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/6.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 杨璞 8 | 9 | 10 | 朱德权 11 | 12 | 13 | 徐菲 14 | 15 | 16 | Yang Pu 17 | 18 | 19 | Zhu Dequan 20 | 21 | 22 | Xu Fei 23 | 24 | 25 | 26 | 27 |   28 | 29 | 30 | 作者单位: 31 | 32 | 33 | 池州学院,信息传媒系,安徽,池州,247000  34 | 35 | 36 | 刊 名: 37 | 38 | 39 | 40 | 池州学院学报 41 | 42 |   43 | 44 | 45 | 46 | 47 | 英文刊名: 48 | 49 | 50 | 51 | JOURNAL OF CHIZHOU COLLEGE 52 | 53 |   54 | 55 | 56 | 年,卷(期): 57 | 58 | 59 | 60 | 2010 24(6) 61 | 62 |   63 | 64 | 65 | 分类号: 66 | 67 | 68 | TP3-05  69 | 70 | 71 | 关键词: 72 | 73 | 74 | 75 | 人脸 76 | 77 | 78 | 79 |    80 | 81 | 建模 82 | 83 | 84 | 85 |    86 | 87 | 综述 88 | 89 | 90 | 91 |    92 | 93 | 方法 94 | 95 | 96 | 97 |    98 | 99 | 真实感 100 | 101 | 102 | 103 |   104 | 105 | 106 | 机标分类号: 107 | 108 | 109 | TP3 X17  110 | 111 | 112 | 机标关键词: 113 | 114 | 115 | 116 | 真实感人脸 117 | 118 | 119 | 重建技术 120 | 121 | 122 | Faces 123 | 124 | 125 | Realistic 126 | 127 | 128 | 计算机图形学 129 | 130 | 131 | 研究方向 132 | 133 | 134 | 人脸建模 135 | 136 | 137 | 结构复杂 138 | 139 | 140 | 环境影响 141 | 142 | 143 | 学者 144 | 145 | 146 | 图像 147 | 148 | 149 | 提取 150 | 151 | 152 | 视频 153 | 154 | 155 | 生理 156 | 157 | 158 | 困难 159 | 160 | 161 | 光照 162 | 163 | 164 | 表情 165 | 166 |   167 | 168 | 169 | 基金项目: 170 | 171 | 172 | 池州学院科研项目  173 | 174 | 175 | DOI: 176 | 177 | 178 | 179 | 10.3969/j.issn.1674-1102.2010.06.006 180 | 181 |   182 | 183 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/7.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 龚强 8 | 9 | 10 | 11 | 12 |   13 | 14 | 15 | 作者单位: 16 | 17 | 18 | 黑龙江省信息产业厅,黑龙江,哈尔滨,150090  19 | 20 | 21 | 刊 名: 22 | 23 | 24 | 25 | 学术交流 26 | 27 |   28 | 29 | 30 | PKU 31 | 32 | 33 | CSSCI 34 | 35 | 36 | 37 | 38 | 英文刊名: 39 | 40 | 41 | 42 | ACADEMIC EXCHANGE 43 | 44 |   45 | 46 | 47 | 年,卷(期): 48 | 49 | 50 | 51 | 2005 (1) 52 | 53 |   54 | 55 | 56 | 分类号: 57 | 58 | 59 | TP3-05  60 | 61 | 62 | 关键词: 63 | 64 | 65 | 66 | 网格 67 | 68 | 69 | 70 |    71 | 72 | 应用 73 | 74 | 75 | 76 |    77 | 78 | 网格计算 79 | 80 | 81 | 82 |    83 | 84 | 绩效 85 | 86 | 87 | 88 |   89 | 90 | 91 | 机标分类号: 92 | 93 | 94 | TP3 TP1  95 | 96 | 97 | 机标关键词: 98 | 99 | 100 | 101 | 网格应用 102 | 103 | 104 | 应用前景 105 | 106 | 107 | 协作 108 | 109 | 110 | 协同工作 111 | 112 | 113 | 生活领域 114 | 115 | 116 | 社会经济 117 | 118 | 119 | 科学难题 120 | 121 | 122 | 科技发展 123 | 124 | 125 | 解决问题 126 | 127 | 128 | 共享 129 | 130 | 131 | 科学家 132 | 133 | 134 | 绩效 135 | 136 | 137 | 概念 138 | 139 | 140 | 方法 141 | 142 |   143 | 144 | 145 | 基金项目: 146 | 147 | 148 |   149 | 150 | 151 | DOI: 152 | 153 | 154 | 155 | 10.3969/j.issn.1000-8284.2005.01.031 156 | 157 |   158 | 159 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/8.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者:< 4 | 5 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/pro_keyword/9.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 作 者: 4 | 5 | 6 | 7 | 陈画 8 | 9 | 10 | CHEN Hua 11 | 12 | 13 | 14 | 15 |   16 | 17 | 18 | 作者单位: 19 | 20 | 21 | 广州大学松田学院,广东,广州,510403  22 | 23 | 24 | 刊 名: 25 | 26 | 27 | 28 | 电脑知识与技术(学术交流) 29 | 30 |   31 | 32 | 33 | 34 | 35 | 英文刊名: 36 | 37 | 38 | 39 | COMPUTER KNOWLEDGE AND TECHNOLOGY 40 | 41 |   42 | 43 | 44 | 年,卷(期): 45 | 46 | 47 | 48 | 2007 2(9) 49 | 50 |   51 | 52 | 53 | 分类号: 54 | 55 | 56 | TP3-0  57 | 58 | 59 | 关键词: 60 | 61 | 62 | 63 | Web服务 64 | 65 | 66 | 67 |    68 | 69 | 分布式计算 70 | 71 | 72 | 73 |    74 | 75 | 档案管理系统 76 | 77 | 78 | 79 |   80 | 81 | 82 | 机标分类号: 83 | 84 | 85 | TV6 TM3  86 | 87 | 88 | 机标关键词: 89 | 90 | 91 | 92 | 技术 93 | 94 | 95 | 丰满发电厂 96 | 97 | 98 | 企业档案管理系统 99 | 100 | 101 | 应用 102 | 103 | 104 | Power Plant 105 | 106 | 107 | Management System 108 | 109 | 110 | 解决方案 111 | 112 | 113 | Web服务 114 | 115 | 116 | 设计 117 | 118 |   119 | 120 | 121 | 基金项目: 122 | 123 | 124 |   125 | 126 | 127 | DOI: 128 | 129 | 130 | 131 | 10.3969/j.issn.1009-3044.2007.09.079 132 | 133 |   134 | 135 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/1.txt: -------------------------------------------------------------------------------- 1 | 云计算在电子政务中的应用 2 | 电子政务为信息的公开和共享创造了条件,将现代信息和通信技术运用到其管理和服务职能中,随着电子政务的发展,政府逐渐意识到电子政务集中建设的必要性及优越性.为了更好解决政府在电子政务及信息化办公过程中所带来的信息孤岛问题,服务器管理分散问题,维护及硬件成本过快增长等问题,云计算的出现,正是电子政务变革的大好机遇.云计算是国家“十二五”规划中的重点关注项目,它将成为当前电子政务建设必须重视的发展趋势.本文通过对云计算概念的描述,分析云计算在电子政务应用中的优缺点及其前景. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/10.txt: -------------------------------------------------------------------------------- 1 | 信息时代与教师角色的转化 Internet Era and Transformation of Teachers' Role 2 | 在信息时代新技术,给教育注入了新的生机和活力,也对教师提出了新的要求.如何通过教师角色的转化,使教师从知识的传播者转化为学生学习方法的指导者、变教材执行者为课程教学研究者、由学生品德的培养者变为学生自我设计未来生活的引导者、从教育教学管理者转变为人际关系的指导者、变单一传统教学手段为传统手段与多媒体教学手段相结合的应用者、变多媒体与网络结合,进行创新教学和协作学习的推动者.培养学生的自主创新意识,推动教育改革和学生的健康发展.已成为当今教育发展的必然趋势. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/11.txt: -------------------------------------------------------------------------------- 1 | 嵌入式系统学科定义的理论探讨 The study of definition about embedded system discipline 2 | 学科建设对于高校至关重要.学科分类是知识、技术体系的划分方法,学科定义清晰与否,直接关系到高校人才培养的目标定位和学科建设的质量.通过学科分类的方法,对新兴高技术学科专业——嵌入式系统专业的特点进行理论探讨,从高校中对嵌入式系统专业教学需求出发,对嵌入式系统专业的学科定义给出了一个较为全面定义. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/12.txt: -------------------------------------------------------------------------------- 1 | 企业计算机应用技术和信息化建设 2 | 在信息时代,计算机技术已经成为企业在社会立足和发展的关键,企业计算机应用技术和信息化建设在现在化企业建设中越来越重要.在此大背景下,该文对企业计算机应用技术和信息化建设的意义、建设的关键和如何建设提出了一些看法. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/13.txt: -------------------------------------------------------------------------------- 1 | 微机接口技术的新教学体系探讨 The Discussion of New Teaching System about Microconputer Interface Technique 2 | 该文提出接口技术的新教学体系,它的核心是一切接口技术概念源于CPU的工作:由CPU工作过程推出总线信号,再由总线信号推出接口芯片与总线的连接.这种教学体系有利于学生高屋建瓴的学习本课. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/14.txt: -------------------------------------------------------------------------------- 1 | 浅析Client-Side OLAP Briefly talking about Client-side OLAP 2 | 介绍为实现Client-side OLAP技术而创建本地数据立方体的2种方法,并总结了Client-side OLAP技术的优缺点. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/15.txt: -------------------------------------------------------------------------------- 1 | 高职《计算机基础》课程中的德育教育 2 | 德育教育是学校教育的一个重要环节,也是一项复杂的系统工程,需要学校各个部门各个环节共同参与.在课堂教学中对学生进行德育教育是教学的重要环节和基本内容,在《计算机基础》课程中如何利用课程自身特点和教学内容进行德育教育进行了探讨. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/16.txt: -------------------------------------------------------------------------------- 1 | 基于FOAGRNN的产品功能疲劳对客户资产影响的预测 2 | 为了预测产品开发阶段产品功能疲劳对客户资产的影响,提出了基于广义回归神经网络的预测方法.首先提出产品功能疲劳因素向量的概念,以描述产品功能疲劳的程度,并给出了获得该向量的数据处理方法.而后将果蝇算法优化的广义回归神经网络用于预测不同功能组合对客户资产的影响,为企业提供决策支持,以减轻或消除产品功能疲劳.实例表明,该方法能获得理想的结果. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/17.txt: -------------------------------------------------------------------------------- 1 | 虚拟现实建立动态场景的研究 A Study of Bilding Dynamic Scene by VRML 2 | 随着虚拟现实技术的发展,对虚拟现实场景不仅要求有逼真的效果,同时还要求有生动的交互功能,而VRML(Vitual Reality Modeling Language)与Java的结合是目前常用的交互式虚拟现实技术.文章系统介绍了虚拟现实建模语言VRML,采用JAVA做为脚本建立动态场景的原因并具体介绍了VRML与Java结合建立动态交互场景的两种方式,以及JSAI和EAI的区别. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/18.txt: -------------------------------------------------------------------------------- 1 | 高职院校电子商务专业发展的几点思考 Thoughts on E-commerce Speciality in Higher Vocational College 2 | 电子商务指应用电子技术进行的商务活动.目前,电子商务专业发展前景良好,大多数高职院校都开设了电子商务专业.本文综合分析了我国高职院校电子商务专业发展现状和存在一些问题,提出解决影响高职院校电子商务专业发展问题的几点建议. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/2.txt: -------------------------------------------------------------------------------- 1 | 我国地方政府网站建设存在的问题及分析 2 | 互联网的高速发展,延伸到世界的各个角落,不仅为公众信息交流提供了快捷方式,也为政府机关更好地为社会服务提供了良好的平台.地方政府开办政府网站通常是为了树立地方政府形象,宣传地方政府征集或是展示地方发展等等.本文针对我国地方政府网站建设中存在的问题,提出了针对性的建议,包括:明确网站的功能定位,做好网站总体设计,增强互动性,加强网站建设实用性,创新网站,加强网站宣传,提高公众的认知度. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/21.txt: -------------------------------------------------------------------------------- 1 | 网络游戏诠释中西方文化 2 | 网络游戏曾几何时掀起了一场又一场的争论,有人说它是精神毒品,严重危害未成年人的身心健康.它能麻痹人的精神,使人沉溺于虚拟世界无法自拔,严重脱离现实,甚至造成危害社会的严重问题,更有甚者丧失生命.还有另外一些人认为,适度的网络游戏可以放松精神,缓解生活工作压力.无论争论如何,网络游戏依然拥有着庞大的市场,它以一种特立独行的姿态展现在我们面前. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/22.txt: -------------------------------------------------------------------------------- 1 | 计算机教育中“计算机科学与技术导论”课程的作用 2 | 本文针对目前计算机科学与技术专业教育的快速发展,分析了“计算机科学与技术导论”课程在计算机教育中的重要性,“计算机科学与技术导论”课程的基本目标和教学内容。讨论了“计算机科学与技术导论”课程的建设,包括教学内容选择、教材选择和任课教师的选择。 3 | 4 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/23.txt: -------------------------------------------------------------------------------- 1 | 移动娱乐中所蕴含的文化元素——手机游戏不仅是一种娱乐方式,更是一种文化 2 | 伴随着智能化手机的发展,手机硬件设施的提升及IOS、Android系统的推出,手机变成为了一种娱乐设备,它不在只是通讯工具,更是人们寻求娱乐的一种方式.通过各种平台获取的游戏,让我们的上下班路途中不在枯燥、无味.《水果忍者》作为一款手机休闲游戏,在中国乃至全世界掀起了一股切水果热潮.如果你在路上看到某位帅哥或是靓女在不停的在手机屏幕上滑动手指,那么他/她一定是在疯狂的切割水果.《水果忍者》简单便捷的操作方式使玩家最大限度的体验了游戏的操作感,只需要轻轻滑动屏幕界面即可完成一切操作.这种游戏体验的优势是非智能手机所不能带来的.另外,每当玩家手起刀落将水果一分为二后所产生的水果汁液,更是为视觉感官带来了极强的冲击力.既然是水果忍者,游戏中自然包含了世界各地的各种水果,如:西瓜、凤梨、蓝莓、香蕉、猕猴桃等. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/24.txt: -------------------------------------------------------------------------------- 1 | “计算机仿真”课程教学改革与实践 Teaching Reform and Practice for Computer Simulation Course 2 | “计算机仿真”是电气类专业课程体系中的一门重要专业课.为了进一步提高教学质量,培养高素质创新人才.本文从课程教学内容体系改革、教学方式改革、课程考核方式和实践环节教学改革等方面提出了“计算机仿真”课程建设的改革与实践.教学实践表明该课程改革取得了良好的教学效果. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/25.txt: -------------------------------------------------------------------------------- 1 | 多级秘密信息隐藏方法 Multilevel secret information hiding method 2 | 针对普通的一级秘密信息隐藏的方法具有安全性低,视觉效果差的问题,本文提出了一种多级别信息隐藏的方法.该方法使一级秘密信息在一级密钥作用下成为宿主图像,提高了信息隐藏的安全性,再将宿主图像分成3×3的图像块,在二级密钥的控制下成功将二级秘密信息嵌入.采用图像置乱和LSB算法的结合方法,并在两级秘密信息的作用下,使得载密图像的抗攻击能力增强.实验结果表明,本算法得到的载密图像峰值信噪比高,提高了秘密信息的安全性. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/26.txt: -------------------------------------------------------------------------------- 1 | 基于标准数据集的异常检测技术综述与实验分析 A Review of Novelty Detection and Experimental Analysis Based on Benchmark Datasets 2 | 为了研究目前主流的异常检测算法,并了解基于相同数据集的异常检测算法之间性能的差异,首先简要分类综述现有异常检测技术,然后着重实验分析,选取5个具有代表性的异常检测算法,应用于10组不同维数和大小的标准数据集上,执行误差性能(FNR,FPR,AUC)对比,最后试验结果表明,基于统计的高斯混合(Gaussian Mixture)算法具有较大优势。 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/4.txt: -------------------------------------------------------------------------------- 1 | 冷槽离子量子计算机中的温度效应 2 | 该论文利用量子统计、量子格林函数和量子松原函数方法,系统的研究了两种不同条件下的冷槽离子量子计算机模型中的温度效应问题,主要工作概述如下:1 对量子计算机的能力、应用、构建、工作原理及其存在的问题做了一个总体的评述.2 总结了冷槽离子量子计算机的物理装置、槽中离子的运动规律、槽离子的激光冷却、实现门操作时激光同离子相互作用的形式、门运算的实现等方面的内容,分析了实现量子计算过程中存在的问题,提出了该文的研究方向.3 采用量子统计的方法,粗略的讨论了D'Helon模型中量子位态的热稳定性问题.4 考虑了声子态与量子位态的耦合,我们利用量子双时格林函数细化了上述工作.5 针对单声子在门操作中的特殊角色,我们用松原函数方法计算了Cirac和Zoller的冷槽离子模型中温度对质心声子数的影响.综合考虑槽频率对量子位内态稳定性和质心模式声子数的影响可知:实验中应选择一个合适的槽频率值兼顾二者的平衡. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/5.txt: -------------------------------------------------------------------------------- 1 | 浅论计算机技术在报刊出版中的应用 Shallowly Discusses Computer Technology in the Publication Application 2 | 本文通过计算机技术在作者投稿,编辑加工、排版、制图、校对、出版中的应用,说明计算机技术对缩短出版周期、减小编辑工作量、提高报刊质量的重要作用. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/6.txt: -------------------------------------------------------------------------------- 1 | 真实感人脸重建技术 A Review of Modeling of Realistic Faces 2 | 真实感人脸的建模,面临着人脸生理结构复杂,提取人脸的图像或者视频易受光照等环境影响,表情非常丰富等困难,因此在计算机图形学领域,吸引了许多学者进行研究,本文对近年来真实感人脸建模方面的研究进行了详细的综述,并对其未来的研究方向提出一些建议. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/7.txt: -------------------------------------------------------------------------------- 1 | 论网格应用与绩效 2 | 网格是科学家为解决当今世界许多科学难题提出的新概念.利用网格能够更好地解决影响当代科技发展以及社会进步的许多实际问题,在社会经济生活领域,也有着广阔的应用前景.网格绩效在于它改变了传统意义的共享协作,扩大了共享范围和协作方法,为真正意义的协同工作、解决问题提供了有力支持. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/8.txt: -------------------------------------------------------------------------------- 1 | 聚类分析方法研究及在中医药领域的应用探索 Cluster Analysis method the research and explore application in the field of Traditional-Chinese medicine 2 | 文章对聚类分析方法进行了简要介绍,并主要对其中的层次聚类方法进行了研究,将该方法引入到中医药领域中,以治疗糖尿病的中药为试验数据,对中药的性味作了聚类,初步取得了符合中医理论的结果,对数据挖掘在中医药中的应用做了有益的探索. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/data/title_and_abs/9.txt: -------------------------------------------------------------------------------- 1 | Web技术在丰满发电厂档案管理系统中的应用 Application of Web Technology in Archives Management System in Fengman Power Plant 2 | 本文论述了企业档案管理系统的分析和设计过程,研究并给出了基于Web服务的解决方案与相应的实现. 3 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/example.py: -------------------------------------------------------------------------------- 1 | # encoding:utf-8 2 | 3 | import sys 4 | import jieba 5 | import string 6 | import re 7 | from collections import Counter 8 | 9 | reload(sys) 10 | sys.setdefaultencoding('utf-8') # 设置默认编码为utf-8 11 | 12 | 13 | ## 计算词频的例子 14 | def com_tf(): 15 | f = open('data/文件名.txt', 'r') 16 | data = f.read() 17 | 18 | data_temp = data.decode('utf-8') # 转换为unicode编码形式 19 | data = ''.join(re.findall(u'[\u4e00-\u9fff]+', data_temp)) # 必须为unicode类型,取出所有中文字符 20 | # sts = data.translate(None, string.punctuation) # 删除英文的标点符号,中文标点不支持。 21 | 22 | data2 = jieba.cut(data) # 分词 23 | data3 = " ".join(data2) # 结果转换为字符串(列表转换为字符串) 24 | 25 | open('data/文件名.txt', 'w').write(data3) # 分词结果写入7temp.txt 26 | 27 | wlist = data3.split() # 将分词结果按空格切割为列表(字符串的切割) 28 | num_dict = Counter(wlist) # 统计词频 29 | 30 | # 统计结果写入result.txt(字典的遍历) 31 | for (k, v) in num_dict.items(): 32 | open('data/result.txt', 'a+').write(str(k) + ' ' + str(v) + '\n') # 将k,v转换为str类型 33 | 34 | 35 | if __name__ == '__main__': 36 | com_tf() 37 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/src/GrobalParament.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | 4 | # 定义的一些全局变量 5 | InputFormatList = ['utf-8'] # 输入文件的编码列表 6 | OutputFormatList = ['utf-8'] # 输出文件的编码列表 7 | pattern = "full" # 搜索模式:"full"为全文搜索模式,"keys"为关键词搜索模式 8 | n = 10 # 关键词搜索时的关键词数量 9 | ruler_list = [] # 不需要的字符 10 | result_file_num = 50 # 需要查找多少个相关文档 11 | out_to_file = True # 是否需要输出为txt 12 | # PreprocessResultDir="TF_IDF\\data"#预处理文件目录 13 | 14 | PreprocessResultDir = 'data_afterprocess' 15 | PreprocessResultName = "pro_res.txt" # 预处理文件名 16 | ResultFileNameDir = "title_and_abs" # 搜索结果文件目录 17 | ResultFileName = "result.txt" # 搜索结果文件名 18 | 19 | path = 'D:/Users/sangfor/Desktop/TextInfoExp-master/TextInfoExp-master/Part1_TF-IDF/' # 原始数据 20 | path1 = path + 'data/title_and_abs/' # 处理后的标题和摘要 21 | newpath = path + "data/pro_keyword/" # 处理后的关键词 22 | newpath2 = path 23 | 24 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/src/GrobalParament.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/NLP/Part1_TF-IDF/src/GrobalParament.pyc -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/src/get_TF_IDF.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | from __future__ import division 4 | import GrobalParament 5 | from utils import prepro_file 6 | import math 7 | 8 | 9 | def TF_IDF_Compute(file_import_url_temp): 10 | file_import_url = file_import_url_temp.replace('\\', '/') 11 | data_source = open(file_import_url, 'r') 12 | data = data_source.readline() 13 | word_in_afile_stat = {} 14 | word_in_allfiles_stat = {} 15 | files_num = 0 16 | while data != "": # 对文件pro_res.txt进行处理 17 | data_temp_1 = data.strip("\n").split("\t") # file name and key words of a file 18 | data_temp_2 = data_temp_1[1].split(",") # key words of a file 19 | # print data_temp_1[1] 20 | file_name = data_temp_1[0] 21 | data_temp_len = len(data_temp_2) 22 | files_num += 1 23 | data_dict = {} 24 | data_dict.clear() 25 | for word in data_temp_2: 26 | if word not in word_in_allfiles_stat: 27 | word_in_allfiles_stat[word] = 1 28 | data_dict[word] = 1 29 | else: 30 | if word not in data_dict: # 如果这个单词在这个文件中之前没有出现过 31 | word_in_allfiles_stat[word] += 1 32 | data_dict[word] = 1 33 | 34 | if not word_in_afile_stat.has_key(file_name): 35 | word_in_afile_stat[file_name] = {} 36 | if not word_in_afile_stat[file_name].has_key(word): 37 | word_in_afile_stat[file_name][word] = [] 38 | word_in_afile_stat[file_name][word].append(data_temp_2.count(word)) 39 | word_in_afile_stat[file_name][word].append(data_temp_len) 40 | data = data_source.readline() 41 | data_source.close() 42 | 43 | # filelist = os.listdir(newpath2) # 取得当前路径下的所有文件 44 | TF_IDF_last_result = [] 45 | if (word_in_afile_stat) and (word_in_allfiles_stat) and (files_num != 0): 46 | for filename in word_in_afile_stat.keys(): 47 | TF_IDF_result = {} 48 | TF_IDF_result.clear() 49 | for word in word_in_afile_stat[filename].keys(): 50 | word_n = word_in_afile_stat[filename][word][0] 51 | word_sum = word_in_afile_stat[filename][word][1] 52 | with_word_sum = word_in_allfiles_stat[word] 53 | TF_IDF_result[word] = ((word_n / word_sum)) * (math.log10(files_num / with_word_sum)) 54 | 55 | result_temp = sorted(TF_IDF_result.iteritems(), key=lambda x: x[1], reverse=True) 56 | # f1 = open(newpath2 + filename, "r") 57 | 58 | # line = f1.readline() 59 | TF_IDF_last_result.append(filename) 60 | TF_IDF_last_result.extend(result_temp[0:10]) 61 | 62 | # TF_IDF_last_result.append(line) 63 | TF_IDF_last_result.append('\n') 64 | 65 | f = open("results.txt", "a+") 66 | 67 | for s in TF_IDF_last_result: 68 | # print s 69 | for i in s: 70 | f.write(str(i)) 71 | f.write("\n") 72 | f.close() 73 | 74 | 75 | if __name__ == '__main__': 76 | PreResUrl = "pro_res.txt" 77 | prepro_file(GrobalParament.path1, PreResUrl) # 将所有文本分词,结果汇总到pro_res.txt 78 | TF_IDF_Compute(PreResUrl) # 获得TF_IDF结果 79 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/src/get_data.py: -------------------------------------------------------------------------------- 1 | # _*_ coding:utf-8 _*_ 2 | 3 | import os 4 | import sys 5 | from bs4 import BeautifulSoup 6 | import os 7 | import GrobalParament 8 | import codecs 9 | 10 | reload(sys) 11 | sys.setdefaultencoding("utf-8") 12 | 13 | #base_path = os.getcwd().replace('\\', '/') 14 | # print base_path 15 | 16 | base_path = GrobalParament.path 17 | path = 'D:/Users/sangfor/Desktop/TextInfoExp-master/TextInfoExp-master/Part1_TF-IDF/data/computer/' # 原始数据 18 | path1 = 'D:/Users/sangfor/Desktop/TextInfoExp-master/TextInfoExp-master/Part1_TF-IDF/data/title_and_abs/' # 处理后的标题和摘要 19 | newpath = 'D:/Users/sangfor/Desktop/TextInfoExp-master/TextInfoExp-master/Part1_TF-IDF/data/pro_keyword/' 20 | newpath2 = 'D:/Users/sangfor/Desktop/TextInfoExp-master/TextInfoExp-master/Part1_TF-IDF/data/keyword/' 21 | 22 | filelist = os.listdir(path) # 取得当前路径下的所有文件 23 | 24 | 25 | # 清洗出xml格式的文件中的标题和摘要信息 26 | def get_text(): 27 | abstracts = [] 28 | for files in filelist: 29 | filename = os.path.splitext(files)[0] # 取文件名 30 | soup = BeautifulSoup(open(path + filename + '.xml'), 'html.parser') # 解析网页 31 | b = soup.find("p", class_="abstracts") # 取得"p", class_="abstracts"为标签的内容 32 | # print b 33 | if b is None or b.string is None: 34 | continue 35 | else: 36 | abstracts.extend(soup.title.stripped_strings) 37 | s = b.string 38 | abstracts.extend(s) 39 | f = codecs.open(path1 + filename + ".txt", "w+", 'utf-8') # 写入txt文件 40 | for i in abstracts: 41 | f.write(i) 42 | f.close() 43 | abstracts = [] 44 | 45 | # getPro_keyword,清洗出xml文件中dl标签中的文本信息 46 | links = soup.find_all("dl") 47 | # print links 48 | for link in links: 49 | s1 = link.get_text() 50 | # print s1 51 | f = codecs.open(newpath + filename + ".txt", "w+",'utf-8') # 将得到的未处理的文字放在pro_keyword文件夹中 52 | for i in s1: 53 | f.write(i) 54 | f.close() 55 | 56 | 57 | # 对上一步得到的getPro_keyword文件夹中的文件进行进一步处理,得到每个文件的关键字 58 | def get_keyword(): 59 | # getKeyword 60 | filelist = os.listdir(newpath) 61 | for files in filelist: 62 | filename = os.path.splitext(files)[0] 63 | begin = 100000 64 | end = 10000 65 | f1 = open(newpath + filename + ".txt", "r") 66 | f2 = open(newpath2 + filename + '.txt', "w+") 67 | for (num, value) in enumerate(f1): 68 | if value.count("关键词") > 0: # 得到关键词的行号 69 | begin = num 70 | if value.count("基金项目") > 0 or value.count("机标分类号") > 0 or value.count("机标关键词") > 0 or value.count( 71 | "基金项目") > 0 or value.count("DOI") > 0: 72 | end = num 73 | if num > begin and num < end and value[:-1].strip(): 74 | f2.write(value.strip()) 75 | f2.write(" ") 76 | f1.close() 77 | f2.close() 78 | 79 | 80 | if __name__ == '__main__': 81 | get_text() 82 | # get_keyword() 83 | -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/src/utils.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/NLP/Part1_TF-IDF/src/utils.pyc -------------------------------------------------------------------------------- /NLP/Part1_TF-IDF/test.py: -------------------------------------------------------------------------------- 1 | # _*_ coding=utf-8 _*_ 2 | import re 3 | r = r'[^/\d]{2,}' 4 | temp = "13421222fhsjkhfkkjsdfhksh8888asjdgfjsgj432342kjsdfhkhfsk094ashgdjag213543" 5 | temp.replace('2','M') 6 | result = re.findall(r,temp) 7 | print result 8 | print temp 9 | 10 | file_dict = {'lisan':12,'lll':15,'dasa':23} 11 | re1 = file_dict['lisan'] 12 | print re1 13 | -------------------------------------------------------------------------------- /NLP/README.md: -------------------------------------------------------------------------------- 1 | # NLP的相关知识总结 2 | ## 1.NLP的数据特征表示问题 3 | * 数据表示是机器学习的核心问题,在过去的Machine Learning阶段,大量兴起特征工程,人工设计大量的特征解决数据的有效表示问题。 4 | 而到了Deep Learning,想都别想,end-2-end,一步到位,hyper-parameter自动帮你选择寻找关键的特征参数。 5 | ## 2.语音、图片、文本在深度学习中表达的方式 6 | * 在语音中,用音频频谱序列向量所构成的matrix作为前端输入喂给NN进行处理,good;在图像中,用图片的像素构成的matrix展平成vector后组成的vector序列喂给NN进行处理,good;那在自然语言处理中呢?噢你可能知道或者不知道,将每一个词用一个向量表示出来!想法是挺简单的,对,事实上就是这么简单,然而真有这么简单吗?可能没这么简单。 7 | * 图片和声音的处理比较低级,图像和语音领域最基本的是信号的数据,可以通过距离度量,判断信号是否相似,在判断两幅图片是否相似的时候,只需通过观察图片本身就能给出答案。但是语言是一种高级抽象的思维信息表达工具,具有高度抽象的特征,文本是符号数据,两个词只要字面不同,就难以刻画他们之间的联系,即使是“话筒”和“麦克风”这两个同义词,从字面很难看出他们的意思相同,判断文本语言的时候,还需要更多的背景知识才能做出回答 8 | * ***因此如何有效的表达出语言句子是决定NN能发挥出强大拟合计算能力的关键前提!*** 9 | ## 3.NLP词的表示方法类型 10 | * ***词的独热表示(one-hot representation)*** NLP中最直观,也是到目前为止最常用的词表示方式是 One-Hot Represention,这种方法把每个词表示为一个很长的向量。这个向量的维度是词表大小,其中大多数为0,只有一个维度为1,这个维度就代表了当前的词。 11 | 举个例子:“话筒”表示为[0 0 0 0 1 0 0 0 ...],“麦克”表示为[0 0 0 0 0 0 0 0 0 1 0 0 0...] 每一个词都是1立0群的感觉。这种one-hot编码格式如果采用稀疏方式存储的话,会比较简洁,也就是给每一个词分配一个数字ID。例如,我们可以把话筒记为3,麦克记为8(假设从0开始)。编程实现的话,用Hash表给每一个词分配一个编号就可以了。这种简洁的表达方式配合上最大熵、SVM、CRF等算法就可以很好地完成NLP的各种主流任务。 12 | * ***one-hot的缺点*** 1.向量的维度会随着句子的词的数量类型增大而不断增大。2.任意两个词之间都是孤立的,无法表示在语义层面上词与词之间的相关信息,这个问题对NLP处理影响是很大的。 13 | * ***词的分布式表示(distributed representation)*** 传统的独热表示仅仅将词符号化,不包含任何的语义信息。如何将语义融合到词表示中? 14 | 最早的分布假说主要是:上下文相似的词,其语义也相似。词的语义由其上下文决定。 15 | * 目前为止,基于分布假说的词表示方法,根据建模的不同,可以分为三类: 16 | * 1.基于矩阵的分布表示 17 | * 2.基于聚类的分布表示 18 | * 3.基于神经网络的分布表示 19 | * 尽管这些不同的方法使用了不同的技术手段获取词表示,但是由于这些方法都是基于分布假说,他们的核心都是由两部分组成: 20 | * 1.选择一种方式描述上下文 21 | * 2.选择一种模型刻画某个词与其上下文之间的关系 22 | ## 4.NLP语言模型 23 | * 在详细介绍词的分布式表示之前,需要将NLP中的一个关键概念描述清楚: ***语言模型*** 。 24 | ***语言模型*** 包括文法语言模型和统计语言模型。一般我们指的是统计语言模型。之所以需要将语言模型摆在词表示方法前边,是因为后面的表示方法马上要用到这一概念。 25 | * ***统计语言模型:*** 把语言(词的序列)看作一个随机事件,并赋予相应的概率来描述其属于某种语言集合的可能性。给定一个词汇集合V,对于V中的词构成的序列S={W1,...Wn}(属于V),统计语言模型富裕这个序列一个概率P(S),来衡量S符合自然语言的语法和语义规则的置信度。 26 | * 简单的说,语言模型就是计算一个句子的概率大小的这种模型。一个句子的打分概率越高,越说明他是更符合人说出来的语言的。 27 | ## 5.词嵌入的理解和总结 28 | * 假设我们的词汇表含有 10,000 个单词,词汇表里有 a,aaron,orange,zulu,可能还有一个未知词标记。我们要做的就是学习一个嵌入矩阵𝐸,它将是一个 29 | 300×10,000 的矩阵,如果你的词汇表里有 10,000 个,或者加上未知词就是 10,001 维。这个矩阵的各列代表的是词汇表中 10,000 个不同的单词所代表的不同向量 30 | 31 | * 词嵌入中最主要的一件事就是我们的目标是学习一个嵌入矩阵𝐸。在某些场合中你将会随机地初始化矩阵𝐸,然后使用梯度下降法来学习这个 300×10,000 的矩阵中的各个参数,𝐸乘以这个 one-hot 向量(上图编号 1 所示)会得到嵌入向量。再多说一点,当我们写这个等式(上图编号2 所示)的时候,写出这些符号是很方便的,代表用矩阵𝐸乘以 one-hot向量𝑂𝑗。但当你动手实现时,用大量的矩阵和向量相乘来计算它,效率是很低下的,因为 onehot向量是一个维度非常高的向量,并且几乎所有元素都是 0,所以矩阵向量相乘效率太低,因为我们要乘以一大堆的 0。所以在实践中你会使用一个专门的函数来单独查找矩阵𝐸的某列,而不是用通常的矩阵乘法来做,但是在画示意图时(上图所示,即矩阵𝐸乘以 one-hot 向量示意图),这样写比较方便。但是例如在 Keras 中就有一个嵌入层,然后我们用这个嵌入层更有效地从嵌入矩阵中提取出你需要的列,而不是对矩阵进行很慢很复杂的乘法运算。 32 | 33 | * 所以得出这种类比推理的结论的方法就是,当算法被问及 man 对 woman 相当于 king 对什么时,算法所做的就是计算𝑒man − 𝑒woman,然后找出一个向量也就是找出一个词,使得𝑒man − 𝑒woman≈ 𝑒king − 𝑒?,也就是说,当这个新词是 queen时,式子的左边会近似地等于右边。这种思想首先是被 Tomas Mikolov 和 Wen-tau Yih 还有Geoffrey Zweig 提出的,这是词嵌入领域影响力最为惊人和显著的成果之一,这种思想帮助了研究者们对词嵌入领域建立了更深刻的理解。 34 | * :余弦相似度 为了测量两个词的相似程度,我们需要一种方法来测量两个词的两 35 | 个 嵌 入 向 量 之 间 的 相 似 程 度 。 给 定 两 个向量 𝑢 和 𝑣 , 余 弦 相 似 度 定 义可以自行查找。其中 𝑢*𝑣 是两个向量的点积(或内积),||u||2是向量𝑢的范数(或长度),并且 𝜃 是向量𝑢和𝑣之间的角度。这种相似性取决于角度在向量𝑢和𝑣之间。如果向量𝑢和𝑣非常相似,它 们 的 余 弦 相 似 性 将 接 近 1; 如 果 它 们 不 相 似 , 则 余 弦 相 似 性 将 取 较 小 的 值。 36 | 37 | * ***词嵌入和迁移学习:*** 用词嵌入做迁移学习的步骤。 38 | * 第一步,先从大量的文本集中学习词嵌入。一个非常大的文本集,或者可以下载网上预训练好的词嵌入模型,网上你可以找到不少,词嵌入模型并且都有许可。 39 | * 第二步,你可以用这些词嵌入模型把它迁移到你的新的只有少量标注训练集的任务中,比如说用这个 300 维的词嵌入来表示你的单词。这样做的一个好处就是你可 以用更低维度的特征向量代替原来的 10000 维的 one-hot 向量,现在你可以用一个 300 维更加紧凑的向量。尽管 one-hot 向量很快计算,而学到的用 于词嵌入的 300 维的向量会更加紧凑。 40 | * 第三步,当你在你新的任务上训练模型时,在你的命名实体识别任务上,只有少量的标记数据集上,你可以自己选择要不要继续微调,用新的数据调整词嵌入。实际 中,只有这个第二步中有很大的数据集你才会这样做,如果你标记的数据集不是很大,通常我不会在微调词嵌入上费力气。 41 | ## 案例:采集豆瓣网的电影评论信息 42 | * ***主要流程如下*** 43 | * 1.分析豆瓣网的网页 44 | * 2.选择我们需要的数据进行抓取 45 | * 3.清理数据 46 | * 4.使用NLP中的WordCloud进行展示 47 | * 主要使用的库是 urllib BeautifulSoup jieba Wordcloud等 48 | * ***代码位置在----抓取数据到分词案例.py---*** 49 | * 最后通过词云生成的结果见下图: 50 | ![输出结果](https://github.com/1mrliu/AI_Learning_Competition/blob/master/NLP/result.png) 51 | * 通过这个案例,可以加深数据处理的思想,从数据的获取、清理、到最后使用自然语言处理的方式进行处理 52 | 53 | 54 | -------------------------------------------------------------------------------- /NLP/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/7/5 下午11:11' -------------------------------------------------------------------------------- /NLP/jieba/TF_IDF.py: -------------------------------------------------------------------------------- 1 | # _*_ encoding:utf-8 _*_ 2 | import jieba.analyse 3 | ''' 4 | @auther liudong 5 | 使用TF-IDF算法从文本中提取关键字 6 | extract_tags中的变量:{ 7 | topK:返回的关键字的数量 默认值是20 8 | allowPOS: 允许使用的指定词性的词。默认值为空,即不过滤 9 | withWeight:只有在allowPOS不为空的时候才可以使用 10 | 如果是 True,返回一个成对的list,其中的元素是pair(word,weight) 11 | 如果是 False,返回一个word的列表 12 | } 13 | 14 | ''' 15 | s = "云计算在电子政务中的应用\ 16 | 电子政务为信息的公开和共享创造了条件,将现代信息和通信技术运用到其管理和服务职能中,\ 17 | 随着电子政务的发展,政府逐渐意识到电子政务集中建设的必要性及优越性.为了更好解决政府\ 18 | 在电子政务及信息化办公过程中所带来的信息孤岛问题,服务器管理分散问题,维护及硬件成本过\ 19 | 快增长等问题,云计算的出现,正是电子政务变革的大好机遇.云计算是国家“十二五”规划中的重点\ 20 | 关注项目,它将成为当前电子政务建设必须重视的发展趋势.本文通过对云计算概念的描述,分析云计\ 21 | 算在电子政务应用中的优缺点及其前景.据半岛电视台援引叙利亚国家电视台称,叙利亚已经对美国、\ 22 | 英国、法国的空袭进行了反击。据介绍,在叙军武器库中,对西方最具威慑力的当属各型战术地对地弹\ 23 | 道导弹。尽管美英法是利用巡航导弹等武器发动远程空袭,但叙军要对等还击却几乎是“不可能完成的任务”。\ 24 | 目前叙军仍能作战的战机仍是老旧的苏制米格-29、米格-23、米格-21战斗机和苏-22、苏-24轰炸机,它们\ 25 | 在现代化的西方空军面前难有自保之力,因此叙军的远程反击只能依靠另一个撒手锏——地对地战术弹道导弹." 26 | seg = jieba.analyse.extract_tags(s, topK=20, withWeight=True) 27 | for tag,weight in seg: 28 | print "%s %s" %(tag,weight) 29 | cut = jieba.cut(s) 30 | words = list(cut) 31 | print len(words) 32 | 33 | 34 | ''' 35 | 输出结果: 36 | 电子政务 0.495686267737 37 | 叙军 0.302652341846 38 | 米格 0.168175681045 39 | 计算 0.141731945749 40 | 地对地 0.138037283271 41 | 空袭 0.113679705394 42 | 远程 0.102667309887 43 | 叙利亚 0.10217382322 44 | 信息 0.0997568485969 45 | 电视台 0.0968933023606 46 | 反击 0.0966262924485 47 | 战术 0.0897257285797 48 | 撒手锏 0.0777926565791 49 | 24 0.0756630854614 50 | 21 0.0756630854614 51 | 22 0.0756630854614 52 | 23 0.0756630854614 53 | 云计 0.0756630854614 54 | 29 0.0756630854614 55 | 法是 0.0756630854614 56 | 322 57 | ''' 58 | 59 | -------------------------------------------------------------------------------- /NLP/jieba/Text_Rank.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/7/5 下午11:39' 4 | import jieba.analyse 5 | ''' 6 | @auther liudong 7 | 使用Text-Rank算法从文本中提取关键字 8 | textrank中的变量:{ 9 | topK:返回的关键字的数量 默认值是20 10 | allowPOS: 允许使用的指定词性的词 eg. ['ns', 'n', 'vn', 'v'].。默认值为空,即不过滤 11 | withWeight:只有在allowPOS不为空的时候才可以使用 12 | 如果是 True,返回一个成对的list,其中的元素是pair(word,weight) 13 | 如果是 False,返回一个word的列表 14 | } 15 | 16 | ''' 17 | s = "云计算在电子政务中的应用\ 18 | 电子政务为信息的公开和共享创造了条件,将现代信息和通信技术运用到其管理和服务职能中,\ 19 | 随着电子政务的发展,政府逐渐意识到电子政务集中建设的必要性及优越性.为了更好解决政府\ 20 | 在电子政务及信息化办公过程中所带来的信息孤岛问题,服务器管理分散问题,维护及硬件成本过\ 21 | 快增长等问题,云计算的出现,正是电子政务变革的大好机遇.云计算是国家“十二五”规划中的重点\ 22 | 关注项目,它将成为当前电子政务建设必须重视的发展趋势.本文通过对云计算概念的描述,分析云计\ 23 | 算在电子政务应用中的优缺点及其前景.据半岛电视台援引叙利亚国家电视台称,叙利亚已经对美国、\ 24 | 英国、法国的空袭进行了反击。据介绍,在叙军武器库中,对西方最具威慑力的当属各型战术地对地弹\ 25 | 道导弹。尽管美英法是利用巡航导弹等武器发动远程空袭,但叙军要对等还击却几乎是“不可能完成的任务”。\ 26 | 目前叙军仍能作战的战机仍是老旧的苏制米格-29、米格-23、米格-21战斗机和苏-22、苏-24轰炸机,它们\ 27 | 在现代化的西方空军面前难有自保之力,因此叙军的远程反击只能依靠另一个撒手锏——地对地战术弹道导弹." 28 | seg = jieba.analyse.textrank(s, topK=20, withWeight=True) 29 | for tag,weight in seg: 30 | print ("%s %s" % (tag,weight)) 31 | cut = jieba.cut(s) 32 | words = list(cut) 33 | print (len(words)) 34 | ''' 35 | 输出结果: 36 | 电子政务 1.0 37 | 问题 0.611788038462 38 | 叙军 0.495698528044 39 | 管理 0.489203664223 40 | 电视台 0.461652835155 41 | 信息 0.440072040578 42 | 远程 0.434837490342 43 | 空袭 0.404859591012 44 | 国家 0.373817306539 45 | 计算 0.368289157426 46 | 战术 0.361834682119 47 | 叙利亚 0.358143898419 48 | 反击 0.345947146204 49 | 空军 0.343312441847 50 | 建设 0.3201001524 51 | 地对地 0.297429681529 52 | 政府 0.28293620811 53 | 服务器 0.276117423034 54 | 意识 0.264632362161 55 | 维护 0.260319523719 56 | 322 57 | ''' 58 | -------------------------------------------------------------------------------- /NLP/jieba/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/7/5 下午11:11' -------------------------------------------------------------------------------- /NLP/jieba/jieba_demo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/7/5 下午11:11' 4 | 5 | import jieba 6 | # 全模式 7 | seg_list = jieba.cut("7月2日,我开始了在深信服公司为期三个月的实习生活", cut_all=True) 8 | print("Full Mode:" + "/".join(seg_list)) 9 | 10 | # 精确模式 11 | seg_list = jieba.cut("7月2日,我开始了在深信服公司为期三个月的实习生活", cut_all=False) 12 | print("Default Mode:" + "/".join(seg_list)) 13 | 14 | # 默认是精确模式 15 | seg_list = jieba.cut("我来到了南山区智园A1栋上班") 16 | print(",".join(seg_list)) 17 | 18 | # 搜索引擎模式 19 | seg_list = jieba.cut_for_search("我本科毕业于河南财经政法大学,硕士就读于湖南大学信息科学与工程学院") 20 | print(",".join(seg_list)) 21 | -------------------------------------------------------------------------------- /NLP/result.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/NLP/result.png -------------------------------------------------------------------------------- /NLP/tf_idf/tf_idf.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2019/10/13 4:08 PM' 4 | 5 | from sklearn.feature_extraction.text import CountVectorizer 6 | from sklearn.feature_extraction.text import TfidfTransformer 7 | 8 | # 语料 9 | corpus = [ 10 | 'This is the first document.', 11 | 'This is the second document', 12 | 'And the third one', 13 | 'is this the first document', 14 | ] 15 | # 将文本中的词语转换为词频矩阵 16 | vectorizer = CountVectorizer() 17 | # 计算每个词语出现的次数 18 | X = vectorizer.fit_transform(corpus) 19 | # 获取词袋中所有文本关键词 20 | word = vectorizer.get_feature_names() 21 | 22 | # 类 23 | transformer = TfidfTransformer() 24 | 25 | # 将词频矩阵统计为TF-IDF值 26 | tfidf = transformer.fit_transform(X) 27 | # 查看数据结构 28 | # tfidf[i][j] 表示i类文本中的tf-idf权重 29 | print(tfidf.toarray()) 30 | # tf-idf的矩阵提取出来 元素[i][j] 表示j词在i类文本中的tf-idf权重 31 | weight = tfidf.toarray() 32 | # 第一个for遍历所有文本 33 | # 第二个for遍历某一类文本下的词语权重 34 | for i in range(len(weight)): 35 | print("====这输出第",i,"类文本的词语tf-idf权重") 36 | for j in range(len(word)): 37 | print(word[j],weight[i][j]) -------------------------------------------------------------------------------- /NLP/抓取数据到分词案例.py: -------------------------------------------------------------------------------- 1 | # _*_ coding:utf-8 _*_ 2 | from bs4 import BeautifulSoup 3 | from urllib import request 4 | import re 5 | import jieba 6 | import pandas as pd 7 | import numpy as np 8 | import matplotlib 9 | import matplotlib.pyplot as plt 10 | matplotlib.rcParams['figure.figsize'] = (10.0,5.0) 11 | from wordcloud import WordCloud 12 | 13 | 14 | 15 | resp = request.urlopen('https://movie.douban.com/nowplaying/hangzhou/') 16 | html_data = resp.read().decode('utf-8') 17 | # print(html_data) 18 | 19 | soup = BeautifulSoup(html_data,'html.parser') 20 | # print(soup) 21 | nowplaying_movie = soup.find_all('div', class_='mod-bd') 22 | nowplaying_movie_list = nowplaying_movie[0].find_all('li', class_='list-item') 23 | # print(nowplaying_movie_list[0]) 24 | nowplaying_list = [] 25 | for item in nowplaying_movie_list: 26 | nowplaying_dict = {} 27 | nowplaying_dict['id'] = item['data-subject'] 28 | for tag_img_item in item.find_all('img'): 29 | nowplaying_dict['name'] = tag_img_item['alt'] 30 | nowplaying_list.append(nowplaying_dict) 31 | 32 | print(nowplaying_list) 33 | 34 | # 对电影的短评进行处理 抽取短评的数据 35 | requrl = "https://movie.douban.com/subject/" + nowplaying_list[0]['id'] + '/comments'+ '?' + 'staus=p' 36 | resp = request.urlopen(requrl) 37 | html_data = resp.read().decode('utf-8') 38 | soup = BeautifulSoup(html_data,'html.parser') 39 | comment_div_lits = soup.find_all('div', class_='comment') 40 | # print(comment_div_lits) 41 | 42 | eachCommentList = [] 43 | for item in comment_div_lits: 44 | if item.find_all('span',class_="short")[0].string is not None: 45 | eachCommentList.append(item.find_all('span',class_="short")[0].string) 46 | print(eachCommentList) 47 | 48 | # 清理数据 49 | comments = '' 50 | for k in range(len(eachCommentList)): 51 | comments = comments + (str(eachCommentList[k])).strip() 52 | 53 | pattern = re.compile(r'[\u4e00-\u9fa5]+') 54 | filterdata = re.findall(pattern,comments) 55 | cleaned_comments = ''.join(filterdata) 56 | print(cleaned_comments) 57 | 58 | # 使用jieba进行分词 59 | segment = jieba.lcut(cleaned_comments) 60 | words_df = pd.DataFrame({'segment':segment}) 61 | print(words_df.head()) 62 | 63 | # 去除停用词 64 | stopwords = pd.read_csv('D:/Users/*****/Desktop/chineseStopWords.txt',sep="\t",names=['stopword'], encoding='gb2312') 65 | words_df = words_df[~words_df.segment.isin(stopwords.stopword)] 66 | print(words_df.head()) 67 | 68 | # 词频统计 69 | words_stat = words_df.groupby(by=['segment'])['segment'].agg({"计数":np.size}) 70 | words_stat = words_stat.reset_index().sort_values(by=['计数'],ascending=False) 71 | print(words_stat) 72 | 73 | # 码云统计 74 | # 其中simhei.ttf使用来指定字体的, 75 | # 可以在百度上输入simhei.ttf进行下载后,放入程序的根目录即可。 76 | wordcloud=WordCloud(font_path="D:/Users/****/Desktop/simhei.ttf",background_color="white",max_font_size=80) #指定字体类型、字体大小和字体颜色 77 | word_frequence = {x[0]:x[1] for x in words_stat.head(1000).values} 78 | word_frequence_list = [] 79 | for key in word_frequence: 80 | temp = (key,word_frequence[key]) 81 | word_frequence_list.append(temp) 82 | 83 | print(word_frequence_list) 84 | wordcloud = wordcloud.fit_words(dict(word_frequence_list)) 85 | plt.imshow(wordcloud) 86 | plt.savefig('D:/Users/****/Desktop/result.png') 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 记录做比赛和AI学习的相关知识 2 | ## Kaggle的比赛代码和思路 3 | * 1.Kaggle的比赛比较具有参考性 4 | * 2.Kernel可以获得好的思路和方法,适合初学入门 5 | * 3.Kaggle的平台资源更加齐全 6 | * 4.增加比赛的深度学习代码 7 | 8 | ## 天池的阿里妈妈的比赛 可以熟悉比赛流程 9 | * 1.数据预处理 10 | * 2.数据分析 11 | * 3.特征工程 12 | * 4.机器学习算法模型 13 | 14 | ## 深度学习(DL)和自然语言处理(NLP) 15 | * 1.Tensorflow 16 | * 2.卷积神经网络 CNN 17 | * 3.循环神经网络 RNN 18 | * 4.自然语言处理 NLP 19 | * 5.Keras高级封装 20 |   21 | -------------------------------------------------------------------------------- /TalkingData_Competition/TalkingdataKaggle.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """ 3 | Create:LiuDong 2018-3-8 4 | Update:LiuDong 2018-3-10 5 | 使用XGB算法实现 6 | """ 7 | import time 8 | import pandas as pd 9 | import numpy as np 10 | from sklearn.svm import SVC 11 | from sklearn.cross_validation import train_test_split 12 | import xgboost as xgb 13 | 14 | 15 | # 定义处理时间的函数 16 | def dataPreProcessTime(data): 17 | data['click_time'] = pd.to_datetime(data['click_time']).dt.date 18 | data['click_time'] = data['click_time'].apply(lambda x: x.strftime('%Y%m%d')).astype(int) 19 | return data 20 | 21 | # 1.加载数据 22 | start_time = time.time() 23 | 24 | train_data = pd.read_csv('/Users/liudong/Desktop/talkingdata/train_sample.csv') 25 | 26 | test_data = pd.read_csv('/Users/liudong/Desktop/talkingdata/test.csv') 27 | 28 | print('[{}] Finished to load data!'.format(time.time()-start_time)) 29 | 30 | 31 | # 2.对数据中的日期进行处理 32 | train_data = dataPreProcessTime(train_data) 33 | test_data = dataPreProcessTime(test_data) 34 | print(train_data.head(10)) 35 | 36 | train_Y = train_data[['is_attributed']].as_matrix() 37 | train_data.drop(['is_attributed', 'attributed_time'], axis=1, inplace=True) 38 | 39 | train_X = train_data[['ip', 'app', 'device', 'os', 'channel']].as_matrix() 40 | 41 | 42 | # svc = SVC(C=1.0, kernel='rbf', decision_function_shape='ovo') 43 | 44 | # svc = svc.fit(train_X,train_Y) 45 | 46 | 47 | 48 | test_X = test_data[['ip','app', 'device', 'os', 'channel']].as_matrix() 49 | 50 | # predictions = svc.predict(test_X).astype(np.double) 51 | 52 | sub = pd.DataFrame({'click_id':test_data['click_id'].as_matrix()}) 53 | test_data.drop('click_id', axis=1, inplace=True) 54 | 55 | # 3.开始训练XGBoost 56 | print('[{}] Start XGBoost Training'.format(time.time() - start_time)) 57 | params = {'eta': 0.1, 58 | 'max_depth': 4, 59 | 'subsample': 0.9, 60 | 'colsample_bytree': 0.7, 61 | 'colsample_bylevel':0.7, 62 | 'min_child_weight':100, 63 | 'alpha':4, 64 | 'objective': 'binary:logistic', 65 | 'eval_metric': 'auc', 66 | 'random_state': 99, 67 | 'silent': True} 68 | 69 | x1, x2, y1,y2 = train_test_split(train_data, train_Y, test_size=0.1, random_state=99) 70 | 71 | watchlist = [(xgb.DMatrix(x1, y1), 'train'), (xgb.DMatrix(x2, y2), 'valid')] 72 | model = xgb.train(params, xgb.DMatrix(x1, y1), 270, watchlist, maximize=True, verbose_eval=10) 73 | 74 | print('[{}] Finish XGBoost Training'.format(time.time() - start_time)) 75 | 76 | # 4.输出结果 77 | sub['is_attributed'] = model.predict(xgb.DMatrix(test_data)) 78 | name = 'xgb_sub' 79 | sub.to_csv('result_%s.csv' % name, index=False) 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /TalkingData_Competition/Talkingdata_Figure.py: -------------------------------------------------------------------------------- 1 | """ 2 | # 特征分析(统计学和绘图) 3 | 4 | """ 5 | import pandas as pd 6 | import gc 7 | 8 | dtypes = { 9 | 'ip' : 'uint32', 10 | 'app' : 'uint16', 11 | 'device' : 'uint16', 12 | 'os' : 'uint16', 13 | 'channel' : 'uint16', 14 | 'is_attributed' : 'uint8', 15 | 'click_id' : 'uint32' 16 | } 17 | 18 | print('loading train data...') 19 | train_df = pd.read_csv("/Users/liudong/Desktop/talkingdata/train_sample.csv", skiprows=range(1,144903891), nrows=40000000, dtype=dtypes, usecols=['ip','app','device','os', 'channel', 'click_time', 'is_attributed']) 20 | 21 | print('loading test data...') 22 | test_df = pd.read_csv("/Users/liudong/Desktop/talkingdata/test.csv", dtype=dtypes, usecols=['ip','app','device','os', 'channel', 'click_time', 'click_id']) 23 | 24 | len_train = len(train_df) 25 | train_df=train_df.append(test_df) 26 | 27 | del test_df 28 | gc.collect() 29 | 30 | print('Extracting new features...') 31 | train_df['hour'] = pd.to_datetime(train_df.click_time).dt.hour.astype('uint8') 32 | train_df['day'] = pd.to_datetime(train_df.click_time).dt.day.astype('uint8') 33 | 34 | gc.collect() 35 | print('grouping by ip-day-hour combination...') 36 | gp = train_df[['ip','day','hour','channel']].groupby(by=['ip','day','hour'])[['channel']].count().reset_index().rename(index=str, columns={'channel': 'ip_tcount'}) 37 | train_df = train_df.merge(gp, on=['ip','day','hour'], how='left') 38 | print(gp) 39 | print(train_df) 40 | del gp 41 | gc.collect() -------------------------------------------------------------------------------- /TalkingData_Competition/lightGBM_TalkingData.py: -------------------------------------------------------------------------------- 1 | """ 2 | Create:LiuDong 3 | Update:2018-3-11 4 | 使用比XGB效率更高的lightGBM方法实现这个 5 | """ 6 | import time 7 | import numpy as np 8 | import pandas as pd 9 | import lightgbm as lgb 10 | from sklearn.cross_validation import train_test_split 11 | 12 | 13 | # 1.加载数据 14 | start_time = time.time() 15 | dtypes ={ 16 | 'ip': 'uint32', 17 | 'app': 'uint16', 18 | 'device': 'uint16', 19 | 'os': 'uint16', 20 | 'channel': 'uint16', 21 | 'is_attributed': 'uint8', 22 | } 23 | 24 | train_data = pd.read_csv('/Users/liudong/Desktop/talkingdata/train_sample.csv',dtype=dtypes) 25 | 26 | test_data = pd.read_csv('/Users/liudong/Desktop/talkingdata/test.csv') 27 | print('[{}] Finished to load data!'.format(time.time()-start_time)) 28 | 29 | # 2.对数据中的日期进行处理 30 | # 处理训练集的数据 31 | train_data['day'] = pd.to_datetime(train_data['click_time']).dt.day.astype('uint8') 32 | train_data['hour'] = pd.to_datetime(train_data['click_time']).dt.hour.astype('uint8') 33 | train_data.drop(['click_time'], axis=1, inplace=True) 34 | 35 | # 处理测试集的数据 36 | print('Deal with the date ...') 37 | test_data['day'] = pd.to_datetime(test_data['click_time']).dt.day.astype('int') 38 | test_data['hour'] = pd.to_datetime(test_data['click_time']).dt.hour.astype('int') 39 | test_data.drop(['click_time'], axis=1, inplace=True) 40 | 41 | train_Y = train_data['is_attributed'] 42 | train_data.drop(['is_attributed', 'attributed_time'], axis=1, inplace=True) 43 | 44 | sub = pd.DataFrame() 45 | sub['click_id'] = test_data['click_id'].astype('uint32') 46 | # test_data.drop('click_id', axis=1, inplace=True) 47 | # 3.特征工程 48 | print(train_data.head(5)) 49 | print(test_data.head(5)) 50 | 51 | 52 | 53 | # 4.开始训练lightGBM 54 | print('[{}] Start lightGBM Training'.format(time.time() - start_time)) 55 | params = { 56 | 'num_leaves': 31, 57 | 'objective': 'binary', 58 | 'min_data_in_leaf': 200, 59 | 'learning_rate': 0.1, 60 | 'bagging_fraction': 0.85, 61 | 'feature_fraction': 0.8, 62 | 'bagging_freq': 3, 63 | 'metric': 'auc', 64 | 'num_threads': 4,} 65 | MAX_ROUNDS = 600 66 | x1, x2, y1, y2 = train_test_split(train_data, train_Y, test_size=0.1, random_state=99) 67 | 68 | dtrain = lgb.Dataset(x1, label=y1) 69 | dval = lgb.Dataset(x2, label=y2, reference=dtrain) 70 | print('Start...Train') 71 | model = lgb.train(params, dtrain, num_boost_round=MAX_ROUNDS, valid_sets=[dtrain, dval], 72 | early_stopping_rounds=1000, verbose_eval=10) 73 | print('[{}] Finish LightGBM Training'.format(time.time() - start_time)) 74 | 75 | # 4.输出结果 76 | sub['is_attributed'] = model.predict(test_data, num_iteration= model.best_iteration or MAX_ROUNDS) 77 | name = 'lightGBM' 78 | sub.to_csv('result_%s.csv' % name, index=False) 79 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /TalkingData_Competition/pandas_1M.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | # 用户信息 5 | unames = ['user_id','gender','age','occupation','zip'] 6 | # seq代表的是将数据按照连接符号进行分割 names= 是按照unames的顺序对输出的结果的列进行列名的 7 | users = pd.read_table('/Users/liudong/Desktop/ml-1m/users.dat', sep='::', header=None, names=unames) 8 | 9 | # 评分 10 | rname = ['user_id','movie_id','rating','timestamp'] 11 | ratings = pd.read_table('/Users/liudong/Desktop/ml-1m/ratings.dat', sep="::", header=None, names=rname) 12 | 13 | # 电影信息 14 | mname = ['movie_id', 'title', 'genres'] 15 | movies = pd.read_table('/Users/liudong/Desktop/ml-1m/movies.dat', sep='::', header=None, names=mname) 16 | 17 | 18 | # 将几个表的数据进行结合,相同的列会进行合并 19 | data = pd.merge(pd.merge(ratings, users),movies) 20 | print(data[:5]) 21 | # 22 | mean_ratings = pd.pivot_table(data, index='title', values='rating', columns='gender', aggfunc='mean') 23 | print(mean_ratings[:5]) 24 | 25 | # 获取电影名字的分组大小 26 | ratings_by_title = data.groupby('title').size() 27 | # print(ratings_by_title[:10]) 28 | 29 | # 将电影分组中数据大于250的数据提取出来 30 | active_titles = ratings_by_title.index[ratings_by_title >= 250] 31 | # print(active_titles[:10]) 32 | 33 | 34 | mean_ratings = mean_ratings.ix[active_titles] 35 | print(mean_ratings[:3]) 36 | 37 | 38 | # 女性最喜欢的电影降序排列 39 | top_female_ratings = mean_ratings.sort_index(by='F', ascending=False) 40 | print(top_female_ratings) 41 | 42 | # 男女性之间差异最大的电影 43 | mean_ratings['diff'] = mean_ratings['M'] - mean_ratings['F'] 44 | sorted_by_diff = mean_ratings.sort_index(by='diff') 45 | print(sorted_by_diff[:]) 46 | 47 | # 对行进行反序,并取出前十五行 48 | print(sorted_by_diff[::-1][:15]) 49 | 50 | # 根据电影名称分组的得分数据的标准差 51 | rating_std_by_title = data.groupby('title')['rating'].std() 52 | 53 | # 根据active_titles 进行过滤 54 | rating_std_by_title = rating_std_by_title.ix[active_titles] 55 | 56 | 57 | # 根据值对Series进行降序排列 58 | print(rating_std_by_title[:10]) 59 | 60 | print(rating_std_by_title.sort()) 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Tensorflow/CNN/7.1TF_deal_picture.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/1 上午10:48' 4 | import matplotlib.pyplot as plt 5 | import tensorflow as tf 6 | ''' 7 | TensorFLow中对图像的处理函数 8 | ''' 9 | # 需要把原文中的'r' 改为 'rb' 来使用,才可以达到预期的效果 10 | image_raw_data = tf.gfile.FastGFile("../CNN/cat.jpg", 'rb').read() 11 | with tf.Session() as sess: 12 | image_data = tf.image.decode_jpeg(image_raw_data) 13 | print(image_data.eval()) 14 | # 使用pyplot工具可视化得到的图像 15 | plt.imshow(image_data.eval()) 16 | plt.show() 17 | # 将表示一张图像的三维矩阵重新按照jpeg格式编码并存入文件中 可以得到和原始图像一样的图像 18 | encoded_image = tf.image.encode_jpeg(image_data) 19 | with tf.gfile.GFile("../CNN/cat.jpeg", "wb") as f: 20 | f.write(encoded_image.eval()) 21 | # 对原始图像数据进行初始化,数据处理为规范统一的类型 22 | image_data = tf.image.convert_image_dtype(image_data, dtype=tf.float32) 23 | resized = tf.image.resize_images(image_data, [300, 300], method=3) 24 | # method 0:双线性插值法 1:最近邻居法 2:双三次插值法 3:面积插值法 25 | plt.imshow(resized.eval ()) 26 | plt.show() 27 | # 对图像进行裁剪或者填充 28 | croped = tf.image.resize_image_with_crop_or_pad(image_data, 1000, 1000) 29 | padded = tf.image.resize_image_with_crop_or_pad (image_data, 3000, 3000) 30 | plt.imshow(croped.eval()) 31 | plt.show() 32 | plt.imshow(padded.eval()) 33 | plt.show() 34 | # 对图像进行翻转 上下翻转 35 | flipped = tf.image.flip_up_down(image_data) 36 | plt.imshow(flipped.eval()) 37 | plt.show() 38 | # 对图像进行左右翻转 39 | flipped = tf.image.flip_left_right(image_data) 40 | plt.imshow(flipped.eval()) 41 | plt.show() 42 | # 对图像对角线翻转 43 | flipped = tf.image.transpose_image(image_data) 44 | plt.imshow(flipped.eval ()) 45 | plt.show() 46 | 47 | # 图像色彩调整 48 | # 亮度调整的变暗 对比度减少到0.5倍 49 | adjusted = tf.image.adjust_brightness(image_data, -0.5) 50 | adjusted = tf.clip_by_value(adjusted, 0.0, 1.0) 51 | adjusted = tf.image.adjust_contrast(adjusted, 0.5) 52 | plt.imshow(adjusted.eval()) 53 | plt.show() 54 | # 亮度变得加亮 0.5 对比度增加5倍 55 | adjusted = tf.image.adjust_brightness(image_data, 0.5) 56 | adjusted = tf.image.random_brightness(image_data, max_delta=1) 57 | adjusted = tf.image.adjust_contrast(adjusted, 5) 58 | plt.imshow(adjusted.eval()) 59 | plt.show() 60 | 61 | # 处理标注框 62 | # 将图像缩小一点,这样可视化能让标注框更加清楚 63 | # 标注出两个框 一个大框 一个小框 64 | image_data = tf.image.resize_images(image_data, [180, 267], method=1) 65 | batched = tf.expand_dims( 66 | tf.image.convert_image_dtype(image_data, tf.float32), 0) 67 | boxes = tf.constant([[[0.05, 0.05, 0.9, 0.7], [0.35, 0.47, 0.5, 0.56]]]) 68 | result = tf.image.draw_bounding_boxes(batched, boxes) 69 | plt.imshow(result[0].eval()) 70 | plt.show() -------------------------------------------------------------------------------- /Tensorflow/CNN/7.2图像预处理完整案例.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/1 下午4:34' 4 | import tensorflow as tf 5 | 6 | import numpy as np 7 | import matplotlib.pyplot as plt 8 | 9 | # 随机调整图片的色彩,定义两种顺序 亮度 对比度 饱和度 色相 10 | def distort_color(image, color_ordering=0): 11 | if color_ordering == 0: 12 | image = tf.image.random_brightness(image, max_delta=32. / 225.) 13 | image = tf.image.random_saturation(image, lower=0.5, upper=1.5) 14 | image = tf.image.random_hue(image, max_delta=0.2) 15 | image = tf.image.random_contrast(image, lower=0.5, upper=1.5) 16 | else: 17 | image = tf.image.random_saturation (image, lower=0.5, upper=1.5) 18 | image = tf.image.random_brightness (image, max_delta=32. / 225.) 19 | image = tf.image.random_contrast (image, lower=0.5, upper=1.5) 20 | image = tf.image.random_hue (image, max_delta=0.2) 21 | return tf.clip_by_value(image, 0.0, 1.0) 22 | 23 | # 对照片进行预处理,将照片转换为神将网络的输入层数据 24 | def preprocess_for_train(image, height, width, bbox): 25 | if bbox is None: 26 | bbox = tf.constant([0.0, 0.0, 1.0, 1.0], 27 | dtype=tf.float32, shape=[1, 1, 4]) 28 | if image.dtype != tf.float32: 29 | image = tf.image.convert_image_dtype(image, dtype=tf.float32) 30 | # 随机截取图像,减少需要关注的物体大小对图像识别算法的影响 31 | bbox_begin, bbox_size, _ = tf.image.sample_distorted_bounding_box( 32 | tf.shape(image), bounding_boxes=bbox, min_object_covered=0.4) 33 | distorted_image = tf.slice(image, bbox_begin, bbox_size) 34 | # 将随机截取的图像调整为神经网络输入层的大小 大小调整的算法是随机选择的 35 | distorted_image = tf.image.resize_images( 36 | distorted_image, [height, width], method=np.random.randint(4)) 37 | # 随机左右翻转图像 38 | distorted_image = tf.image.random_flip_left_right(distorted_image) 39 | # 使用一种随机的顺序调整图像色彩 40 | distorted_image = distort_color(distorted_image, np.random.randint(2)) 41 | return distorted_image 42 | 43 | image_raw_data = tf.gfile.FastGFile("../CNN/cat.jpg", 'rb').read() 44 | with tf.Session() as sess: 45 | img_data = tf.image.decode_jpeg(image_raw_data) 46 | boxes = tf.constant([[[0.05, 0.05, 0.9, 0.7], [0.35, 0.47, 0.5, 0.56]]]) 47 | 48 | # 运行六次获得六种不同的效果 49 | for i in range(6): 50 | result = preprocess_for_train(img_data, 299, 299, boxes) 51 | plt.imshow(result.eval()) 52 | plt.show() 53 | 54 | -------------------------------------------------------------------------------- /Tensorflow/CNN/7.3队列操作.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/1 下午5:24' 4 | import tensorflow as tf 5 | import numpy as np 6 | import threading 7 | import time 8 | # 队列进行处理数据 9 | q = tf.FIFOQueue(2, "int32") 10 | init = q.enqueue_many(([0, 10],)) 11 | x = q.dequeue() 12 | y = x + 1 13 | q_inc = q.enqueue([y]) 14 | with tf.Session() as sess: 15 | init.run() 16 | for _ in range(5): 17 | v, _ = sess.run([x, q_inc]) 18 | print(v) 19 | 20 | # 线程中运行的程序,这个程序每隔一秒判断是否需要停止并打印自己的ID 21 | 22 | def MyLoop(coord, worker_id): 23 | # 使用tf.Coordinator类提供的协同工具判断当前线程是否需要停止 24 | while not coord.should_stop(): 25 | if np.random.rand() < 0.1: 26 | print("Stopping from id: %d\n" % worker_id) 27 | # 调用request_stop()函数来通知其他线程停止 28 | coord.request_stop() 29 | else: 30 | print("Working on id: %d\n" % worker_id) 31 | # 暂停一秒 32 | time.sleep(1) 33 | coord = tf.train.Coordinator() 34 | threads = [ threading.Thread(target=MyLoop, args=(coord, i, )) for i in range(5)] 35 | for t in threads: 36 | t.start() 37 | coord.join(threads) 38 | -------------------------------------------------------------------------------- /Tensorflow/CNN/7.4多线程操作.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/2 下午2:38' 4 | import tensorflow as tf 5 | 6 | # 声明一个先进先出的对列 7 | queue = tf.FIFOQueue(100, "float") 8 | 9 | # 定义对列的入队操作 10 | enqueue_op = queue.enqueue([tf.random_normal([1])]) 11 | 12 | qr = tf.train.QueueRunner(queue, [enqueue_op] * 5) 13 | 14 | tf.train.add_queue_runner(qr) 15 | # 定义出队操作 16 | out_tensor = queue.dequeue() 17 | 18 | with tf.Session() as sess: 19 | # 使用Coordinator来协同启动的线程 20 | coord = tf.train.Coordinator() 21 | threads = tf.train.start_queue_runners(sess=sess, coord=coord) 22 | for _ in range(3): 23 | print(sess.run(out_tensor)[0]) 24 | coord.request_stop() 25 | coord.join(threads) 26 | -------------------------------------------------------------------------------- /Tensorflow/CNN/8.1循环神经网络前向传播.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/2 下午4:01' 4 | import numpy as np 5 | 6 | # 定义RNN的参数 7 | X = [1, 2] 8 | state = [0.0, 0.0] 9 | # 分开不同输入部分的权重以方便操作 10 | w_cell_state = np.asarray([[0.1, 0.2], [0.3, 0.4]]) 11 | w_cell_input = np.asarray([[0.5, 0.5]]) 12 | b_cell = np.asarray([0.1, -0.1]) 13 | 14 | # 定义用于输出的全连接层参数 15 | w_output = np.asarray([[1.0], [2.0]]) 16 | b_output = 0.1 17 | 18 | # 按照时间顺序执行RNN的前向传播过程 19 | for i in range(len(X)): 20 | before_activation = np.dot(state, w_cell_state) + X[i] * w_cell_input + b_cell 21 | state = np.tanh(before_activation) 22 | 23 | # 根据当前状态计算最终输出 24 | final_output = np.dot(state, w_output) + b_output 25 | 26 | # 输出每个时刻的信息 27 | print("before activation:", before_activation) 28 | print("state:", state) 29 | print("output:", final_output) 30 | -------------------------------------------------------------------------------- /Tensorflow/CNN/8.2LSTM前向传播.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/2 下午4:48' 4 | import tensorflow as tf 5 | import numpy as np 6 | import matplotlib.pyplot as plt 7 | from tensorflow.examples.tutorials.mnist import input_data 8 | from PIL import Image 9 | 10 | config = tf.ConfigProto() 11 | sess = tf.Session(config=config) 12 | mnist = input_data.read_data_sets ('/path/to/MNIST_data', one_hot=True) 13 | print(mnist.train.images.shape) 14 | 15 | # 设置用到的参数 16 | lr = 1e-3 17 | # 在训练和测试的时候 想使用不同的batch_size 所以采用占位符的方式 18 | batch_size = tf.placeholder(tf.int32, []) 19 | # 输入数据是28维 一行 有28个像素 20 | input_size = 28 21 | # 时序持续时长为28 每做一次预测,需要先输入28行 22 | timestep_size = 28 23 | # 每个隐含层的节点数 24 | hidden_size = 64 25 | # LSTM的层数 26 | layer_num = 2 27 | # 最后输出的分类类别数量,如果是回归预测的呼声应该是1 28 | class_num = 10 29 | _X = tf.placeholder(tf.float32, [None, 784]) 30 | y = tf.placeholder(tf.float32, [None, class_num]) 31 | keep_prob = tf.placeholder(tf.float32) 32 | 33 | # 定义一个LSTM结构, 把784个点的字符信息还原成28*28的图片 34 | X = tf.reshape(_X, [-1, 28, 28]) 35 | def unit_lstm(): 36 | # 定义一层LSTM_CELL hiddensize 会自动匹配输入的X的维度 37 | lstm_cell = tf.nn.rnn_cell.BasicLSTMCell(num_units=hidden_size, forget_bias=1.0, state_is_tuple=True) 38 | # 添加dropout layer, 一般只设置output_keep_prob 39 | lstm_cell = tf.nn.rnn_cell.DropoutWrapper(cell=lstm_cell, input_keep_prob=1.0, output_keep_prob=keep_prob) 40 | return lstm_cell 41 | # 调用MultiRNNCell来实现多层 LSTM 42 | mlstm_cell = tf.nn.rnn_cell.MultiRNNCell([unit_lstm() for i in range(3)], state_is_tuple=True) 43 | 44 | # 使用全零来初始化state 45 | init_state = mlstm_cell.zero_state(batch_size, dtype=tf.float32) 46 | outputs, state = tf.nn.dynamic_rnn(mlstm_cell, inputs=X, initial_state=init_state, 47 | time_major=False) 48 | h_state = outputs[:, -1, :] 49 | 50 | # 设置loss function 和优化器 51 | W = tf.Variable(tf.truncated_normal([hidden_size, class_num], stddev=0.1), dtype=tf.float32) 52 | bias = tf.Variable(tf.constant(0.1, shape=[class_num]), dtype=tf.float32) 53 | y_pre = tf.nn.softmax(tf.matmul(h_state, W) + bias) 54 | # 损失和评估函数 55 | cross_entropy = -tf.reduce_mean(y * tf.log(y_pre)) 56 | train_op = tf.train.AdamOptimizer(lr).minimize(cross_entropy) 57 | correct_prediction = tf.equal(tf.argmax(y_pre, 1), tf.argmax(y, 1)) 58 | accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float")) 59 | 60 | # 开始训练 61 | sess = tf.Session() 62 | sess.run(tf.global_variables_initializer()) 63 | for i in range(1000): 64 | _batch_size = 128 65 | batch = mnist.train.next_batch(_batch_size) 66 | if (i+1)%200 == 0: 67 | train_accuracy = sess.run(accuracy, feed_dict={ 68 | _X: batch[0], y: batch[1], keep_prob: 1.0, batch_size: _batch_size 69 | }) 70 | print("step %d, training accuracy %g" % ((i+1), train_accuracy )) 71 | sess.run(train_op, feed_dict={_X: batch[0], y: batch[1], keep_prob: 0.5, 72 | batch_size: _batch_size}) 73 | images = mnist.test.images 74 | labels = mnist.test.labels 75 | print("test accuracy %g" % sess.run(accuracy,feed_dict={_X: images, y: labels, keep_prob: 1.0, 76 | batch_size: mnist.test.images.shape[0]})) 77 | 78 | current_y = mnist.train.labels[5] 79 | current_x = mnist.train.images[5] 80 | print(current_y) 81 | plt.show(current_x) 82 | 83 | # 将原始数据进行转换,变为模型能够识别 84 | current_x.shape = [-1, 784] 85 | current_y.shape = [-1, class_num] 86 | current_outputs = np.array(sess.run(outputs, feed_dict={ 87 | _X: current_x, y: current_y, keep_prob: 1.0,batch_size: 1})) 88 | current_outputs.shape = [28, hidden_size] 89 | 90 | # 计算模型里边的变量 91 | h_W = sess.run(W, feed_dict={_X: current_x,y: current_y, keep_prob: 1.0,batch_size: 1}) 92 | h_bias = sess.run(bias, feed_dict={_X: current_x,y: current_y, keep_prob: 1.0,batch_size: 1}) 93 | h_bias.shape = [-1, 10] 94 | 95 | # 识别过程 96 | bar_index = range(class_num) 97 | for i in range(current_outputs.shape[0]): 98 | plt.subplot(7, 4, i+1) 99 | current_h_shate = current_outputs[i, :].reshape([-1, hidden_size]) 100 | current_formula = tf.nn.softmax(tf.matmul(current_h_shate, h_W) + h_bias) 101 | pro = sess.run(current_formula) 102 | plt.bar(bar_index, pro[0], width=0.2) 103 | plt.axis('off') 104 | plt.show() -------------------------------------------------------------------------------- /Tensorflow/CNN/Convolutional_example.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/30 下午3:05' 4 | import tensorflow as tf 5 | ''' 6 | 通过tf.get_variable 的方式创建过滤器的权重变量和偏置项变量。上面介绍了卷积层的参数个数和过滤器的尺寸、 7 | 深度以及当前层节点矩阵的深度有关,所以这里声明的参数变量时一个四维矩阵,前面两个维度代表了过滤器的尺寸, 8 | 第三个维度表示当前层的深度,第四个维度表示过滤器的深度。 9 | ''' 10 | filter_weight = tf.get_variable( 11 | 'weights', [5, 5, 3, 16], 12 | initializer=tf.truncated_normal_initializer(stddev=0.1)) 13 | ''' 14 | 和卷积层的权重类似,当前层矩阵上不同位置的偏置项也是共享的,所以总共有下一层深度个不同的偏置项。 15 | 本样例中16为过滤器的深度,也是神经网络中下一层节点矩阵的深度。 16 | ''' 17 | biases = tf.get_variable( 18 | 'biases', [16], initializer=tf.constant_initializer(0.1)) 19 | 20 | conv = tf.nn.conv2d( 21 | input(), filter_weight, strides=[1, 1, 1, 1], padding='SAME') 22 | 23 | bias = tf.nn.bias_add(conv, biases) 24 | actived_conv = tf.nn.relu(bias) -------------------------------------------------------------------------------- /Tensorflow/CNN/Example_TF_TFslim.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/30 下午3:54' 4 | import tensorflow as tf 5 | ''' 6 | 举例对比: 7 | 使用TensorFlow实现一个卷积层 8 | 使用TensorFlow-Slim实现同样结构的神经网络 9 | ''' 10 | # 直接使用TensorFlow原始API实现卷积层 11 | scope_name = None 12 | with tf.variable_scope(scope_name): 13 | weights = tf.get_variable("weights", ...) 14 | biases = tf.get_variable("bias", ...) 15 | conv = tf.nn.conv2d(...) 16 | relu = tf.nn.relu(tf.nn.bias_add(conv, biases)) 17 | 18 | # 使用TensorFlow-Slim实现卷积层 一行实现前向传播算法 19 | # 首先加载slim模块 slim.conv2d函数中有三个参数 20 | # 第一个为节点矩阵 第二个为当前卷积层过滤器的深度 第三个为过滤器的尺寸 21 | # 可选的参数为步长 是否使用全0填充 激活函数的选择以及变量的命名空间 22 | slim = tf.contrib.slim() 23 | net = slim.conv2d(input, 32, [3, 3]) 24 | -------------------------------------------------------------------------------- /Tensorflow/CNN/PTB数据的batching方法.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/3 下午8:45' 4 | 5 | import numpy as np 6 | import tensorflow as tf 7 | 8 | # 使用单词编号表示的训练数据 9 | TRAIN_DATA = "ptb.train" 10 | TRAIN_BATCH_SIZE = 20 11 | TRAIN_NUM_STEP = 35 12 | 13 | # 从文件中读取数据,并返回包含单词编号的数组 14 | def read_data(file_path): 15 | with open(file_path, "r") as fin: 16 | # 将整个文档读进一个长字符 17 | id_string = ' '.join([line.strip() for line in fin.readlines()]) 18 | # 将获取的单词编号转换为整数 19 | id_list = [int(w) for w in id_string.split()] 20 | return id_list 21 | 22 | 23 | def make_batches(id_list, batch_size, num_step): 24 | # 计算总的batch数量 每个batch包含的单词数量是batch_size * num_step 25 | num_batches = (len(id_list) - 1) // (batch_size * num_step) 26 | data = np.array(id_list[: num_batches * batch_size * num_step]) 27 | data = np.reshape(data, [batch_size, num_batches * num_step]) 28 | # 沿着第二个维度将数据切分为 num_batches 个 batch, 存入一个数组 29 | data_batches = np.split(data, num_batches, axis=1) 30 | # 重复上述操作。每个位置向右移动一位 得到的是RNN每一步所需要预测的下一个单词 31 | label = np.array(id_list[1 : num_batches * batch_size * num_step + 1]) 32 | label = np.reshape (label, [batch_size, num_batches * num_step]) 33 | # 沿着第二个维度将数据切分为 num_batches 个 batch, 存入一个数组 34 | label_batches = np.split (label, num_batches, axis=1) 35 | # 返回一个长度为num_batches的数组,其中每个项包含一个data矩阵和一个label矩阵 36 | return list(zip(data_batches, label_batches)) 37 | 38 | def main(): 39 | train_batches = make_batches(read_data(TRAIN_DATA), TRAIN_BATCH_SIZE, TRAIN_NUM_STEP) 40 | 41 | if __name__ == "__main__": 42 | main() -------------------------------------------------------------------------------- /Tensorflow/CNN/PTB数据转换为单词编号.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/3 下午8:07' 4 | import codecs 5 | import sys 6 | # 转换train test valid 7 | RAW_DATA = "/Users/liudong/Desktop/simple-examples/data/ptb.valid.txt" 8 | VOCAB = "ptb.vocab" 9 | OUTPUT_DATA = "ptb.valid" 10 | 11 | 12 | # 读取词汇表 并建立词汇到单词编号的映射 13 | with codecs.open(VOCAB, "r", "utf-8") as f_vocab: 14 | vocab = [w.strip() for w in f_vocab.readlines()] 15 | word_to_id = {k: v for (k, v) in zip(vocab, range(len(vocab)))} 16 | 17 | 18 | # 如果出现了被删除的低频词,则替换为"" 19 | def get_id(word): 20 | return word_to_id[word] if word in word_to_id else word_to_id[""] 21 | 22 | fin = codecs.open(RAW_DATA, "r", "utf-8") 23 | fout = codecs.open(OUTPUT_DATA, 'w', 'utf-8') 24 | for line in fin: 25 | words = line.strip().split() + [""] # 读取单词并添加结束符 26 | # print(words) 27 | # 将每个单词替换为词汇表中的编号 28 | out_line = ' '.join([str(get_id(w)) for w in words]) + '\n' 29 | # print(out_line) 30 | fout.write(out_line) 31 | fin.close() 32 | fout.close() 33 | -------------------------------------------------------------------------------- /Tensorflow/CNN/PTB数据集预处理.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/3 下午4:59' 4 | """ 5 | PTB数据集预处理,生成词汇表 6 | """ 7 | import codecs 8 | import collections 9 | from operator import itemgetter 10 | 11 | # 训练集数据文件 12 | RAW_DATA = "/Users/liudong/Desktop/simple-examples/data/ptb.train.txt" 13 | # 输出的词汇表文件 14 | VOCAB_OUTPUT = "ptb.vocab" 15 | # 统计单词出现的频率 16 | counter = collections.Counter() 17 | with codecs.open(RAW_DATA, "r", "utf-8") as f: 18 | for line in f: 19 | for word in line.strip().split(): 20 | counter[word] += 1 21 | 22 | # 按照词频顺序对单词进行排序 23 | sorted_word_to_cnt = sorted(counter.items(), key=itemgetter(1), reverse=True) 24 | sorted_words = [x[0] for x in sorted_word_to_cnt] 25 | 26 | # 稍后会在文本换行处加上句子结束符"" 这里预先将它加入词汇表 27 | sorted_words = ["eos"] + sorted_words 28 | 29 | with codecs.open(VOCAB_OUTPUT, 'w', 'utf-8') as file_output: 30 | for word in sorted_words: 31 | file_output.write(word + "\n") -------------------------------------------------------------------------------- /Tensorflow/CNN/cat.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/CNN/cat.jpeg -------------------------------------------------------------------------------- /Tensorflow/CNN/cat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/CNN/cat.jpg -------------------------------------------------------------------------------- /Tensorflow/CNN/split_flowerdata.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/30 下午5:10' 4 | import glob 5 | import os.path 6 | import numpy as np 7 | import tensorflow as tf 8 | from tensorflow.python.platform import gfile 9 | ''' 10 | 将原始图像数据集划分为训练集、测试集、验证集 11 | ''' 12 | # 原始数据输入目录 13 | INPUT_DATA = '/Users/liudong/Desktop/flower_photos' 14 | # 输出文件地址 这里使用numpy的格式进行保存 15 | OUTPUT_FILE = '/Users/liudong/Desktop/flower_photos/flower_processed_data.npy' 16 | 17 | # 测试数据和验证数据的比例 18 | VALIDATION_PERCENTAGE = 10 19 | TEST_PERCENTAGE = 10 20 | 21 | 22 | def create_image_lists(sess, testing_percentage, validation_percentage): 23 | sub_dirs = [x[0] for x in os.walk(INPUT_DATA)] 24 | is_root_dir = True 25 | 26 | # 初始化各个数据集 27 | training_images = [] 28 | training_labels = [] 29 | testing_images = [] 30 | testing_labels = [] 31 | validation_images = [] 32 | validation_labels = [] 33 | current_label = 0 34 | 35 | # 读取所有的子目录 36 | for sub_dir in sub_dirs: 37 | if is_root_dir: 38 | is_root_dir = False 39 | continue 40 | # 获取一个子目录中所有的图片文件 41 | extensions = ['jpg', 'jpeg', 'JPG', 'JPEG'] 42 | file_list = [] 43 | dir_name = os.path.basename(sub_dir) 44 | for extension in extensions: 45 | file_glob = os.path.join(INPUT_DATA, dir_name, '*.' + extension) 46 | file_list.extend(glob.glob(file_glob)) 47 | if not file_list: 48 | continue 49 | 50 | # 处理图片数据 51 | for file_name in file_list: 52 | image_raw_data = gfile.FastGFile(file_name, 'rb').read() 53 | image = tf.image.decode_jpeg(image_raw_data) 54 | if image.dtype != tf.float32: 55 | image = tf.image.convert_image_dtype(image, dtype=tf.float32) 56 | image = tf.image.resize_images(image, [299, 299]) 57 | image_value = sess.run(image) 58 | 59 | # 随机划分数据集 60 | chance = np.random.randint(100) 61 | if chance < validation_percentage: 62 | validation_images.append(image_value) 63 | validation_labels.append(current_label) 64 | elif chance < (testing_percentage + validation_percentage): 65 | testing_images.append(image_value) 66 | testing_labels.append(current_label) 67 | else: 68 | training_images.append(image_value) 69 | training_labels.append(current_label) 70 | current_label += 1 71 | # 将训练数据随机打乱以获得较好的训练效果 72 | state = np.random.get_state() 73 | np.random.shuffle(training_images) 74 | np.random.set_state(state) 75 | np.random.shuffle(training_labels) 76 | return np.asarray([training_images, training_labels, 77 | validation_images, validation_labels, 78 | testing_images,testing_labels]) 79 | 80 | 81 | # 数据主整理程序 82 | def main(): 83 | with tf.Session() as sess: 84 | processed_data = create_image_lists( 85 | sess, TEST_PERCENTAGE, VALIDATION_PERCENTAGE) 86 | # 通过numpy格式保存处理后的数据 87 | np.save(OUTPUT_FILE, processed_data) 88 | if __name__ == '__main__': 89 | main() 90 | 91 | -------------------------------------------------------------------------------- /Tensorflow/CNN/深层循环神经网络.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/3 下午3:06' 4 | import tensorflow as tf 5 | 6 | # 定义一个基本的LSTM结构作为循环体的基础结构 7 | # 深层循环神经网络可以使用不同的循环体结构 8 | lstm_cell = tf.nn.rnn_cell.BasicLSTMCell 9 | lstm_size = 10 10 | number_of_layers = 5 11 | batch_size=12 12 | num_steps = 5 13 | # 通过 MultiRNNCell 类实现深层循环网络中每一个时刻的前向传播过程 14 | # number_of_layers 表示有多少层 15 | # 初始化 MultiRNNCell 否则TensorFlow会在每一层之间共享数据 16 | stacked_lstm = tf.nn.rnn_cell.MultiRNNCell( 17 | [lstm_cell(lstm_size) for _ in range(number_of_layers)]) 18 | # 和经典的循环神经网络一样,可以通过zero_state函数来获取初始状态 19 | state = stacked_lstm.zero_state(batch_size, tf.float32) 20 | 21 | # 计算每一时刻的前向传播结果 22 | for i in range(len(num_steps)): 23 | if i > 0: 24 | tf.get_variable_scope().reuse_variables() 25 | stacked_lstm_output, state = stacked_lstm(current_input, state) 26 | final_output = fully_connected(stacked_lstm_output) 27 | loss += calc_loss(final_output, expected_output) 28 | 29 | -------------------------------------------------------------------------------- /Tensorflow/Estimator/Estimator_全连接神经网络.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/5 上午11:06' 4 | import numpy as np 5 | import tensorflow as tf 6 | from tensorflow.examples.tutorials.mnist import input_data 7 | 8 | # 将TensorFlow的日志信息输出到屏幕 9 | tf.logging.set_verbosity(tf.logging.INFO) 10 | mnist = input_data.read_data_sets('/path/to/MNIST_data', one_hot=False) 11 | 12 | # 指定神经网络的输入层 这所有的输入都会拼接在一起作为整个神经网络的输入 13 | feature_columns = [tf.feature_column.numeric_column("image", shape=[784])] 14 | # 定义Estimator模型 15 | estimator = tf.estimator.DNNClassifier( 16 | feature_columns=feature_columns, 17 | hidden_units=[500], 18 | n_classes=10, 19 | optimizer=tf.train.AdamOptimizer(), 20 | model_dir="../Keras/log") 21 | # 定义数据输入 22 | train_input_fn = tf.estimator.inputs.numpy_input_fn( 23 | x={"image": mnist.train.images}, 24 | y=mnist.train.labels.astype(np.int32), 25 | num_epochs=None, 26 | batch_size=128, 27 | shuffle=True) 28 | # 训练模型 29 | estimator.train(input_fn=train_input_fn, steps=10000) 30 | # 定义测试时的数据输入 31 | test_input_fn = tf.estimator.inputs.numpy_input_fn( 32 | x={"image": mnist.test.images}, 33 | y=mnist.test.labels.astype(np.int32), 34 | num_epochs=1, 35 | batch_size=128, 36 | shuffle=False) 37 | 38 | # 通过evaluate评测训练好的模型的效果 39 | accuarcy_score = estimator.evaluate(input_fn=test_input_fn)["accuracy"] 40 | print("\nTest accuracy: %g %%" % (accuarcy_score*100)) 41 | 42 | 43 | -------------------------------------------------------------------------------- /Tensorflow/ExponentialMovingAverage.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/15 下午9:13' 4 | 5 | import tensorflow as tf 6 | # 定义了一个实数变量用于计算滑动平均,这个变量的初始值是0. 7 | # 手动制定了变量的类型为tf.float32 因为所有需要计算滑动平均的变量必须是实数型 8 | v1 = tf.Variable(0, dtype=tf.float32) 9 | # 这里step变量的模拟神经网络迭代的轮数,可以用于动态控制衰减率 10 | step = tf.Variable(0, trainable=False) 11 | 12 | # 定义一个滑动平均的类(class) 初始化时给定了衰减率(0.99)和控制衰减率的变量step 13 | ema = tf.train.ExponentialMovingAverage(0.99, step) 14 | # 定义一个更新变量滑动平均的操作。这里需要设置一个列表,每次执行这个操作时 15 | # 这个列表中的变量都会被更新 16 | maintain_averages_op = ema.apply([v1]) 17 | with tf.Session() as sess: 18 | # 初始化所有变量 19 | init_op = tf.global_variables_initializer() 20 | sess.run(init_op) 21 | 22 | # 通过ema.average(v1)获取滑动平均之后变量的取值 在初始化之后变量v1的值和v1的滑动平均都为0 23 | print(sess.run([v1, ema.average(v1)])) # [0.0, 0.0] 24 | 25 | # 更新变量v1的值到5 26 | sess.run(tf.assign(v1, 5)) 27 | # 更新v1的滑动平均值 衰减率为min{0.99, (1+step)/(10+step)=0.1}=0.1 28 | # 所以v1的滑动平均会被更新为0.1*0+0.9*5 =4.5 29 | sess.run(maintain_averages_op) 30 | print(sess.run([v1, ema.average(v1)])) # [5.0, 4.5] 31 | 32 | # 更新step的值为10000 33 | sess.run(tf.assign(step, 10000)) 34 | 35 | # 更新变量v1的值到10 36 | sess.run (tf.assign (v1, 10)) 37 | # 更新v1的滑动平均值 衰减率为min{0.99, (1+step)/(10+step)=0.99}=0.99 38 | # 所以v1的滑动平均会被更新为0.99*4.5+0.01*10 =4.555 39 | sess.run (maintain_averages_op) 40 | print(sess.run ([v1, ema.average (v1)])) # [10.0, 4.5549998] 41 | 42 | # 再次更新滑动平均值,得到的新滑动平均值为0.99*4.555+0.01*10=4.60945 43 | sess.run (maintain_averages_op) 44 | print(sess.run ([v1, ema.average (v1)])) # [10.0, 4.6094499] 45 | 46 | 47 | -------------------------------------------------------------------------------- /Tensorflow/Keras/Keras_LeNet5.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/4 下午4:47' 4 | """ 5 | Keras 实现LeNet-5模型 6 | """ 7 | import keras 8 | from keras.datasets import mnist 9 | from keras.models import Sequential 10 | from keras.layers import Dense, Flatten, Conv2D, MaxPooling2D 11 | from keras import backend as K 12 | 13 | num_classes = 10 14 | img_rows, img_cols = 28, 28 15 | 16 | # 通过Keras封装好的API加载mnist数据 其中trainX就是一个60000 * 28 * 28的数组,trainY为每张图片对应的数字 17 | (trainX, trainY), (testX, testY) = mnist.load_data() 18 | 19 | # 根据图像编码格式对要求来设置输入层的格式 20 | if K.image_data_format() == 'channels_first': 21 | trainX = trainX.reshape(trainX.shape[0], 1, img_rows, img_cols) 22 | trainY = testX.reshape(testX.shape[0], 1, img_rows, img_cols) 23 | # 因为MNIST中的图片是黑白的,所以第一维的取值为1 24 | input_shape = (1, img_rows, img_cols) 25 | else: 26 | trainX = trainX.reshape(trainX.shape[0], img_rows, img_cols, 1) 27 | testX = testX.reshape(testX.shape[0], img_rows, img_cols, 1) 28 | input_shape = (img_rows, img_cols, 1) 29 | 30 | # 将图像像素转化为0到1之间的实数 31 | trainX = trainX.astype('float32') 32 | testX = testX.astype('float32') 33 | trainX /= 255.0 34 | testX /= 255.0 35 | 36 | # 将标准答案转化为需要的格式(one-hot 编码) 37 | trainY = keras.utils.to_categorical(trainY, num_classes) 38 | testY = keras.utils.to_categorical(testY, num_classes) 39 | 40 | # s使用Keras API定义模型 41 | model = Sequential() 42 | # 一层深度为32 过滤器大小为 5*5的卷积层 43 | model.add(Conv2D(32, kernel_size=(5, 5), activation='relu', input_shape=input_shape)) 44 | # 一层过滤器大小为2*2的最大池化层 45 | model.add(MaxPooling2D(pool_size=(2, 2))) 46 | # 一层深度为64 过滤器大小为 5*5的卷积层 47 | model.add(Conv2D(64, (5, 5), activation='relu')) 48 | # 一层过滤器大小为2*2的最大池化层 49 | model.add(MaxPooling2D(pool_size=(2, 2))) 50 | # 将卷积层的输出拉直以后作为下面全连接层的输入 51 | model.add(Flatten()) 52 | # 全连接层 500个节点 53 | model.add(Dense(500, activation='relu')) 54 | # 全连接层,得到最后的输出 55 | model.add(Dense(num_classes, activation='softmax')) 56 | 57 | # 定义损失函数、优化函数和评测函数 58 | model.compile(loss=keras.losses.categorical_crossentropy, 59 | optimizer=keras.optimizers.SGD(), 60 | metrics=['accuracy']) 61 | # 类似TFLearn中的训练过程,给出训练数据、batch大小、训练轮数、验证数据, Keras可以自动完成模型训练过程 62 | model.fit(trainX, trainY, 63 | batch_size=128, 64 | epochs=20, 65 | validation_data=(testX, testY)) 66 | # 在测试数据上计算准确率 67 | score = model.evaluate(testX, testY) 68 | print('Test loss:', score[0]) 69 | print('Test accuarcy:', score[1]) -------------------------------------------------------------------------------- /Tensorflow/Keras/log/checkpoint: -------------------------------------------------------------------------------- 1 | model_checkpoint_path: "model.ckpt-20000" 2 | all_model_checkpoint_paths: "model.ckpt-1" 3 | all_model_checkpoint_paths: "model.ckpt-10000" 4 | all_model_checkpoint_paths: "model.ckpt-10001" 5 | all_model_checkpoint_paths: "model.ckpt-20000" 6 | -------------------------------------------------------------------------------- /Tensorflow/Keras/log/eval/events.out.tfevents.1525490421.liudongdeMacBook-Pro.local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/eval/events.out.tfevents.1525490421.liudongdeMacBook-Pro.local -------------------------------------------------------------------------------- /Tensorflow/Keras/log/events.out.tfevents.1525490369.liudongdeMacBook-Pro.local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/events.out.tfevents.1525490369.liudongdeMacBook-Pro.local -------------------------------------------------------------------------------- /Tensorflow/Keras/log/events.out.tfevents.1525499215.liudongdeMacBook-Pro.local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/events.out.tfevents.1525499215.liudongdeMacBook-Pro.local -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-1.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-1.data-00000-of-00001 -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-1.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-1.index -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-1.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-1.meta -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10000.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10000.data-00000-of-00001 -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10000.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10000.index -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10000.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10000.meta -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10001.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10001.data-00000-of-00001 -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10001.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10001.index -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-10001.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-10001.meta -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-20000.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-20000.data-00000-of-00001 -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-20000.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-20000.index -------------------------------------------------------------------------------- /Tensorflow/Keras/log/model.ckpt-20000.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Keras/log/model.ckpt-20000.meta -------------------------------------------------------------------------------- /Tensorflow/Keras/情感分析模型.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/6/22 下午2:49' 4 | 5 | from keras.preprocessing import sequence 6 | from keras.models import Sequential 7 | from keras.layers import Dense, Embedding 8 | from keras.layers import LSTM 9 | from keras.datasets import imdb 10 | ''' 11 | 自然语言处理-情感分析 12 | ''' 13 | # 最多所使用的单词数 14 | max_features = 20000 15 | 16 | # 循环神经网络的截断次数 17 | maxlen = 80 18 | batch_size = 32 19 | # 加载数据 20 | (trainX, trainY), (testX, testY) = imdb.load_data(num_words=max_features) 21 | print(len(trainX),'train sequences') 22 | print(len(testX), 'test sequences') 23 | 24 | trainX = sequence.pad_sequences(trainX, maxlen=maxlen) 25 | testX = sequence.pad_sequences(testX, maxlen=maxlen) 26 | 27 | print('trainX shape:', trainX.shape) 28 | print('testX shape:', testX.shape) 29 | 30 | # 构造模型 31 | model = Sequential() 32 | 33 | model.add(Embedding(max_features, 128)) 34 | model.add(LSTM(128, dropout=0.2, recurrent_dropout=0.2)) 35 | model.add(Dense(1, activation='sigmoid')) 36 | model.compile(loss='binary_crossentropy', 37 | optimizer='adam', 38 | metrics=['accuracy']) 39 | model.fit(trainX, trainY, 40 | batch_size=batch_size, 41 | epochs=15, 42 | validation_data=(testX,testY)) 43 | score = model.evaluate(testX, testY,batch_size=batch_size) 44 | print('Test loss:', score[0]) 45 | print('Test accuracy:', score[1]) 46 | 47 | -------------------------------------------------------------------------------- /Tensorflow/L2_5Layer_NeuralNetwork.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/9 下午8:14' 4 | 5 | 6 | import tensorflow as tf 7 | 8 | # 获取一层神经网络边上的权重,并将这个权重的L2正则化损失加入名称为'losses'的集合中 9 | def get_weight(shape,int): 10 | # 生成一个变量 11 | var = tf.Variable(tf.random_normal(shape), dtype= tf.float32) 12 | # add_to_collection 函数将整个新生成变量的L2正则化损失项加入集合 13 | # 这个函数的第一个参数'losses'是集合的名字,第二个参数是要加入这个集合的内容 14 | tf.add_to_collection('losses', tf.contrib.layers.l2_regularizer((int)(var))) 15 | # 返回生成的变量 16 | return var 17 | 18 | x = tf.placeholder(tf.float32, shape=(None, 2)) 19 | y_ = tf.placeholder(tf.float32, shape=(None, 1)) 20 | batch_size = 8 21 | # 定义了每一层网络中间节点的个数 22 | layer_dimension = [2,10,10,10,1] 23 | # 神经网络的层数 24 | n_layers = len(layer_dimension) 25 | 26 | # 这个变量维护前向传播时最深的节点,开始的时候就是输入层 27 | cur_layer = x 28 | 29 | # 当前层的节点个数 30 | in_dimension = layer_dimension[0] 31 | 32 | # 通过一个循环来生成一个五层全连接的神经网络 33 | for i in range(1, n_layers): 34 | # layer_dimensions[i]为下一层的节点个数 35 | out_dimension = layer_dimension[i] 36 | # 生成当前层中权重的变量,并将这个变量的L2正则化损失函数加入计算图上的集合 37 | weight = get_weight([in_dimension, out_dimension], 0.001) 38 | bias = tf.Variable(tf.constant(0.1, shape=[out_dimension])) 39 | # 使用Relu激活函数 40 | cur_layer = tf.nn.relu(tf.matmul(cur_layer, weight) + bias) 41 | # 进入下一层之前将下一层的节点个数更新为当前节点个数 42 | in_dimension = layer_dimension[i] 43 | 44 | # 在定义神经网络前向传播的同时已经将所有的L2正则化损失加入了图中的集合 45 | # 这里只需要计算刻画模型在训练数据上表现的损失函数 46 | mse_loss = tf.reduce_mean(tf.square(y_ - cur_layer)) 47 | 48 | # 将均方误差损失函数加入损失集合 49 | tf.add_to_collection('losses', mse_loss) 50 | 51 | # get_collection 返回一个列表,这个列表是所有这个集合中的元素。在这个样例中, 52 | # 这些元素就是损失函数的不同部分,将他们加起来就可以得到最终的损失函数 53 | loss = tf.add_n(tf.get_collection('losses')) 54 | print(loss) 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Tensorflow/LossFunction_NeuralNetwork.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/6 下午8:52' 4 | """ 5 | 损失函数对神经网络的影响 6 | 7 | """ 8 | 9 | import tensorflow as tf 10 | from numpy.random import RandomState 11 | 12 | batch_size = 8 13 | 14 | # 两个输入节点 15 | x = tf.placeholder(tf.float32, shape=(None, 2), name='x-input') 16 | 17 | # 回归问题 18 | y_ = tf.placeholder(tf.float32, shape=(None, 1), name='y-input') 19 | 20 | # 定义了一个单层的神经网络前向传播的过程,这里就是简单的加权和 21 | w1 = tf.Variable(tf.random_normal([2, 1], stddev=1, seed=1)) 22 | 23 | y = tf.matmul(x, w1) 24 | 25 | # 定义预测多了和预测少了的成本 26 | loss_less = 10 27 | loss_more = 1 28 | 29 | loss = tf.reduce_sum(tf.where(tf.greater(y, y_), 30 | (y - y_) * loss_more, 31 | (y_ - y) * loss_less),) 32 | 33 | train_step = tf.train.AdamOptimizer(0.001).minimize(loss) 34 | 35 | # 通过随机数生成一个模拟数据集 36 | rdm = RandomState(1) 37 | dataset_size = 128 38 | X = rdm.rand(dataset_size, 2) 39 | 40 | Y = [[x1 + x2 + rdm.rand()/10.0 - 0.05] for (x1, x2) in X] 41 | 42 | # 训练神经网络 43 | with tf.Session() as sess: 44 | init_op = tf.global_variables_initializer() 45 | sess.run(init_op) 46 | STEPS = 5000 47 | for i in range(STEPS): 48 | start = (i * batch_size) % dataset_size 49 | end = min(start+batch_size, dataset_size) 50 | sess.run(train_step, 51 | feed_dict={x: X[start:end],y_:Y[start:end]}) 52 | print(sess.run(w1)) 53 | -------------------------------------------------------------------------------- /Tensorflow/MNIST/mnist_eval.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import time 3 | import tensorflow as tf 4 | from tensorflow.examples.tutorials.mnist import input_data 5 | 6 | import mnist_inference 7 | import mnist_train 8 | __author__ = 'liudong' 9 | __date__ = '2018/4/26 下午3:34' 10 | ''' 11 | mnist_eval 定义了测试过程 12 | 完整的tensorflow模型 13 | 可扩展性好 针对变量越来越多的情况来使用 14 | 持久化模型 模型可以持续使用 15 | 训练过程中可以隔一顿时间保存数据,防止意外死机 16 | ''' 17 | # 每10秒加载一次最新的模型,并在测试数据上测试最新模型的准确率 18 | EVAL_INTERVAL_SECS = 10 19 | 20 | def evaluate(mnist): 21 | with tf.Graph().as_default() as g: 22 | # 定义输入输出的格式 23 | x = tf.placeholder( 24 | tf.float32, [None, mnist_inference.INPUT_NODE], name='x-input') 25 | y_ = tf.placeholder( 26 | tf.float32, [None, mnist_inference.OUTPUT_NODE], name='y-input') 27 | validate_feed = {x: mnist.validation.images, 28 | y_: mnist.validation.labels} 29 | y = mnist_inference.inference(x, None) 30 | 31 | correct_prediction = tf.equal(tf.argmax(y, 1), tf.argmax(y_, 1)) 32 | accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32)) 33 | 34 | variable_averages = tf.train.ExponentialMovingAverage( 35 | mnist_train.MOVING_AVERAGE_DECAY) 36 | variable_to_restore = variable_averages.variables_to_restore() 37 | saver = tf.train.Saver(variable_to_restore) 38 | 39 | while True: 40 | with tf.Session() as sess: 41 | ckpt = tf.train.get_checkpoint_state(mnist_train.MODEL_SAVE_PATH) 42 | if ckpt and ckpt.model_checkpoint_path: 43 | saver.restore(sess, ckpt.model_checkpoint_path) 44 | global_step = ckpt.model_checkpoint_path.split('/')[-1].split('-')[-1] 45 | accuracy_score = sess.run(accuracy,feed_dict=validate_feed) 46 | print("After %s training step(s), validation" 47 | "accuracy = %g" % (global_step, accuracy_score)) 48 | else: 49 | print("No checkpoint file found") 50 | return 51 | time.sleep(EVAL_INTERVAL_SECS) 52 | 53 | def main(argv=None): 54 | mnist = input_data.read_data_sets ('/path/to/MNIST_data', one_hot=True) 55 | evaluate(mnist) 56 | 57 | if __name__ =="__main__": 58 | tf.app.run() 59 | 60 | -------------------------------------------------------------------------------- /Tensorflow/MNIST/mnist_inference.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import tensorflow as tf 3 | __author__ = 'liudong' 4 | __date__ = '2018/4/26 下午3:31' 5 | ''' 6 | mnist_inference 定义了前向传播过程以及神经网络中的参数 7 | 完整的tensorflow模型 8 | 可扩展性好 针对变量越来越多的情况来使用 9 | 持久化模型 模型可以持续使用 10 | 训练过程中可以隔一顿时间保存数据,防止意外死机 11 | ''' 12 | 13 | INPUT_NODE = 784 14 | OUTPUT_NODE = 10 15 | LAYER1_NODE = 500 16 | 17 | def get_weight_variable(shape, regularizer): 18 | weights = tf.get_variable('weights',shape, 19 | initializer=tf.truncated_normal_initializer(stddev=0.1)) 20 | if regularizer != None: 21 | tf.add_to_collection('losses', regularizer(weights)) 22 | return weights 23 | 24 | # 定义神经网络的前向传播 25 | def inference(input_tensor, regularizer): 26 | # 第一层神经网络 并完成前向传播 27 | with tf.variable_scope('layer1'): 28 | weights = get_weight_variable([INPUT_NODE, LAYER1_NODE], regularizer) 29 | biases = tf.get_variable("biases", [LAYER1_NODE], 30 | initializer=tf.constant_initializer(0.0)) 31 | layer1 = tf.nn.relu(tf.matmul(input_tensor, weights) + biases) 32 | # 第二层神经网络 并完成前向传播 33 | with tf.variable_scope('layer2'): 34 | weights = get_weight_variable([LAYER1_NODE,OUTPUT_NODE], regularizer) 35 | biases = tf.get_variable('biases', [OUTPUT_NODE], 36 | initializer=tf.constant_initializer(0.0)) 37 | layer2 = tf.nn.relu(tf.matmul(layer1, weights) + biases) 38 | 39 | return layer2 40 | -------------------------------------------------------------------------------- /Tensorflow/MNIST/mnist_train.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import os 3 | import tensorflow as tf 4 | from tensorflow.examples.tutorials.mnist import input_data 5 | 6 | # 加载前向传播的函数和常量 7 | import mnist_inference 8 | __author__ = 'liudong' 9 | __date__ = '2018/4/26 下午3:33' 10 | ''' 11 | mnist_train 定义了神经网络的训练过程 12 | 完整的tensorflow模型 13 | 可扩展性好 针对变量越来越多的情况来使用 14 | 持久化模型 模型可以持续使用 15 | 训练过程中可以隔一顿时间保存数据,防止意外死机 16 | ''' 17 | 18 | BATCH_SIZE = 100 19 | LEARNING_RATE_BASE = 0.8 20 | LEARNING_RATE_DECAY = 0.99 21 | REGULARAZTION_RATE = 0.0001 22 | TRAINING_STEPS = 30000 23 | MOVING_AVERAGE_DECAY = 0.99 24 | 25 | # 定义模型的保存路径和文件名 26 | MODEL_SAVE_PATH = "/Users/liudong/Desktop/model" 27 | MODEL_NAME = "model.ckpt" 28 | 29 | 30 | def train(mnist): 31 | x = tf.placeholder(tf.float32,[None, mnist_inference.INPUT_NODE], 32 | name='x-input') 33 | y_ = tf.placeholder(tf.float32, [None, mnist_inference.OUTPUT_NODE], 34 | name='y-input') 35 | regularizer = tf.contrib.layers.l2_regularizer(REGULARAZTION_RATE) 36 | # 直接使用mnist_inference中定义的前向传播过程 37 | y = mnist_inference.inference(x, regularizer) 38 | global_step = tf.Variable(0, trainable=False) 39 | 40 | # 定义损失函数、学习率、滑动平均操作以及训练过程 41 | variable_averages = tf.train.ExponentialMovingAverage (MOVING_AVERAGE_DECAY, 42 | global_step) 43 | variable_average_op = variable_averages.apply (tf.trainable_variables ()) 44 | cross_entropy = tf.nn.sparse_softmax_cross_entropy_with_logits (logits=y, 45 | labels=tf.argmax (y_, 1)) 46 | cross_entropy_mean = tf.reduce_mean (cross_entropy) 47 | loss = cross_entropy_mean + tf.add_n(tf.get_collection("losses")) 48 | learning_rate = tf.train.exponential_decay ( 49 | LEARNING_RATE_BASE, 50 | global_step, 51 | mnist.train.num_examples / BATCH_SIZE, 52 | LEARNING_RATE_DECAY 53 | ) 54 | # loss 为交叉熵和L2正则化损失之和 55 | train_step = tf.train.GradientDescentOptimizer (learning_rate).minimize (loss, 56 | global_step=global_step) 57 | # cross_entropy_mean 为交叉熵的值 58 | with tf.control_dependencies ([train_step, variable_average_op]): 59 | train_op = tf.no_op (name='train') 60 | # 初始化Tensorflow持久化类 61 | saver = tf.train.Saver() 62 | with tf.Session() as sess: 63 | tf.global_variables_initializer().run() 64 | 65 | for i in range(TRAINING_STEPS): 66 | xs, ys = mnist.train.next_batch(BATCH_SIZE) 67 | _, loss_value, step = sess.run([train_op, loss, global_step], 68 | feed_dict={x: xs, y_: ys}) 69 | # 每一千轮保存一次 70 | if i % 1000 == 0: 71 | print("After %d training step(s), loss on training" 72 | "batch is %g" % (step, loss_value)) 73 | saver.save( 74 | sess, os.path.join(MODEL_SAVE_PATH, MODEL_NAME), 75 | global_step=global_step) 76 | def main(argv=None): 77 | mnist = input_data.read_data_sets ('/path/to/MNIST_data', one_hot=True) 78 | train(mnist) 79 | 80 | if __name__ == "__main__": 81 | tf.app.run() 82 | -------------------------------------------------------------------------------- /Tensorflow/Save_tf_Graph.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/26 下午2:30' 4 | 5 | import tensorflow as tf 6 | 7 | v1 = tf.Variable(tf.constant(1.0, shape=[1]), name="v1") 8 | v2 = tf.Variable(tf.constant(2.0, shape=[1]), name="v2") 9 | result = v1 + v2 10 | 11 | init_op = tf.global_variables_initializer() 12 | 13 | saver = tf.train.Saver() 14 | 15 | with tf.Session() as sess: 16 | ''' 17 | # 将模型保存到指定路径的文件夹 18 | sess.run(init_op) 19 | saver.save(sess, '/Users/liudong/Desktop/model/model.ckpt') 20 | ''' 21 | 22 | # 加载已经保存的模型 23 | saver.restore(sess, '/Users/liudong/Desktop/model/model.ckpt') 24 | print(sess.run(result)) 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Tensorflow/Tensorboard_可视化/TensorBoard简单例子.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/5 下午1:56' 4 | import tensorflow as tf 5 | 6 | 7 | # 定义一个简单的计算图,实现向量加法的操作 8 | input1 = tf.constant([1.0, 2.0, 3.0], name="input1") 9 | 10 | input2 = tf.Variable(tf.random_uniform([3]), name="input2") 11 | 12 | output = tf.add_n([input1, input2], name="add") 13 | 14 | session =tf.Session() 15 | writer = tf.summary.FileWriter('../Tensorboard_可视化/log', tf.get_default_graph()) 16 | init = tf.global_variables_initializer() 17 | writer.close() 18 | session.run(init) 19 | 20 | 21 | -------------------------------------------------------------------------------- /Tensorflow/Tensorboard_可视化/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/5/5 下午1:55' -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/.ipynb_checkpoints/01-Tensorflow入门-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 5, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import tensorflow as tf\n", 12 | "import os" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": 6, 18 | "metadata": { 19 | "collapsed": true 20 | }, 21 | "outputs": [], 22 | "source": [ 23 | "welcome = tf.constant(\"Welcome to Tensorflow world\")" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 7, 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "name": "stdout", 33 | "output_type": "stream", 34 | "text": [ 35 | "output: b'Welcome to Tensorflow world'\n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "with tf.Session() as sess:\n", 41 | " print(\"output:\", sess.run(welcome))" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 8, 47 | "metadata": { 48 | "collapsed": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "sess.close()" 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [] 59 | } 60 | ], 61 | "metadata": { 62 | "kernelspec": { 63 | "display_name": "Python 3", 64 | "language": "python", 65 | "name": "python3" 66 | }, 67 | "language_info": { 68 | "codemirror_mode": { 69 | "name": "ipython", 70 | "version": 3 71 | }, 72 | "file_extension": ".py", 73 | "mimetype": "text/x-python", 74 | "name": "python", 75 | "nbconvert_exporter": "python", 76 | "pygments_lexer": "ipython3", 77 | "version": "3.6.3" 78 | } 79 | }, 80 | "nbformat": 4, 81 | "nbformat_minor": 2 82 | } 83 | -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/.ipynb_checkpoints/02-Tensorflow-基本运算-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/.ipynb_checkpoints/03-Tensorflow-变量-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": {}, 7 | "outputs": [], 8 | "source": [ 9 | "import tensorflow as tf\n", 10 | "from tensorflow.python.framework import ops" 11 | ] 12 | }, 13 | { 14 | "cell_type": "code", 15 | "execution_count": 4, 16 | "metadata": {}, 17 | "outputs": [], 18 | "source": [ 19 | "# 创建三个变量 使用默认的值\n", 20 | "weights = tf.Variable(tf.random_normal([2,3], stddev=0.1),name=\"weiughts\")\n", 21 | "biases = tf.Variable(tf.zeros([3]),name=\"biases\")\n", 22 | "custom_variable = tf.Variable(tf.zeros([3]), name=\"custom\")\n", 23 | "\n", 24 | "# 将所有的变量的张量 store 并且放到list当中\n", 25 | "all_variable_list = ops.get_collection(ops.GraphKeys.GLOBAL_VARIABLES)" 26 | ] 27 | }, 28 | { 29 | "cell_type": "code", 30 | "execution_count": 5, 31 | "metadata": { 32 | "collapsed": true 33 | }, 34 | "outputs": [], 35 | "source": [ 36 | "# 选择性的使用部分的变量 去初始化\n", 37 | "variable_list_custom = [weights, custom_variable]\n", 38 | "\n", 39 | "# 初始化\n", 40 | "init_custom_op = tf.variables_initializer(var_list=variable_list_custom)" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 6, 46 | "metadata": { 47 | "collapsed": true 48 | }, 49 | "outputs": [], 50 | "source": [ 51 | "# 全局变量初始化\n", 52 | "# method 1\n", 53 | "init_all_op = tf.global_variables_initializer()\n", 54 | "\n", 55 | "# method 2\n", 56 | "init_all_op = tf.variables_initializer(var_list=all_variable_list)" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "execution_count": null, 62 | "metadata": { 63 | "collapsed": true 64 | }, 65 | "outputs": [], 66 | "source": [ 67 | "# 初始化其他的变量 使用已有的变量进行初始化\n", 68 | "WeightsNew = tf.Variable(weights.initial_value(), name=\"WeightsNew\")\n", 69 | "\n", 70 | "# 初始化上边的变量\n", 71 | "init_WeightsNew_op = tf.variables_initializer(var_list=[WeightsNew])" 72 | ] 73 | } 74 | ], 75 | "metadata": { 76 | "kernelspec": { 77 | "display_name": "Python 3", 78 | "language": "python", 79 | "name": "python3" 80 | }, 81 | "language_info": { 82 | "codemirror_mode": { 83 | "name": "ipython", 84 | "version": 3 85 | }, 86 | "file_extension": ".py", 87 | "mimetype": "text/x-python", 88 | "name": "python", 89 | "nbconvert_exporter": "python", 90 | "pygments_lexer": "ipython3", 91 | "version": "3.6.3" 92 | } 93 | }, 94 | "nbformat": 4, 95 | "nbformat_minor": 2 96 | } 97 | -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/01-Tensorflow入门.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 5, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import tensorflow as tf\n", 12 | "import os" 13 | ] 14 | }, 15 | { 16 | "cell_type": "code", 17 | "execution_count": 6, 18 | "metadata": { 19 | "collapsed": true 20 | }, 21 | "outputs": [], 22 | "source": [ 23 | "welcome = tf.constant(\"Welcome to Tensorflow world\")" 24 | ] 25 | }, 26 | { 27 | "cell_type": "code", 28 | "execution_count": 7, 29 | "metadata": {}, 30 | "outputs": [ 31 | { 32 | "name": "stdout", 33 | "output_type": "stream", 34 | "text": [ 35 | "output: b'Welcome to Tensorflow world'\n" 36 | ] 37 | } 38 | ], 39 | "source": [ 40 | "with tf.Session() as sess:\n", 41 | " print(\"output:\", sess.run(welcome))" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 8, 47 | "metadata": { 48 | "collapsed": true 49 | }, 50 | "outputs": [], 51 | "source": [ 52 | "sess.close()" 53 | ] 54 | }, 55 | { 56 | "cell_type": "markdown", 57 | "metadata": {}, 58 | "source": [] 59 | } 60 | ], 61 | "metadata": { 62 | "kernelspec": { 63 | "display_name": "Python 3", 64 | "language": "python", 65 | "name": "python3" 66 | }, 67 | "language_info": { 68 | "codemirror_mode": { 69 | "name": "ipython", 70 | "version": 3 71 | }, 72 | "file_extension": ".py", 73 | "mimetype": "text/x-python", 74 | "name": "python", 75 | "nbconvert_exporter": "python", 76 | "pygments_lexer": "ipython3", 77 | "version": "3.6.3" 78 | } 79 | }, 80 | "nbformat": 4, 81 | "nbformat_minor": 2 82 | } 83 | -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/02-Tensorflow-基本运算.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 2, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "from __future__ import print_function\n", 12 | "import tensorflow as tf\n", 13 | "import os" 14 | ] 15 | }, 16 | { 17 | "cell_type": "code", 18 | "execution_count": 3, 19 | "metadata": { 20 | "collapsed": true 21 | }, 22 | "outputs": [], 23 | "source": [ 24 | "# 定义常量\n", 25 | "a = tf.constant(5.0, name=\"a\")\n", 26 | "b = tf.constant(10.0, name=\"b\") " 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 4, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "# 基本的操作方法\n", 38 | "x = tf.add(a,b,name=\"add\")\n", 39 | "y = tf.div(a,b,name=\"divide\")" 40 | ] 41 | }, 42 | { 43 | "cell_type": "code", 44 | "execution_count": 5, 45 | "metadata": {}, 46 | "outputs": [ 47 | { 48 | "name": "stdout", 49 | "output_type": "stream", 50 | "text": [ 51 | "a= 5.0\n", 52 | "b= 10.0\n", 53 | "a + b = 15.0\n", 54 | "a/b = 0.5\n" 55 | ] 56 | } 57 | ], 58 | "source": [ 59 | "with tf.Session() as sess:\n", 60 | " print(\"a=\",sess.run(a))\n", 61 | " print(\"b=\",sess.run(b))\n", 62 | " print(\"a + b =\",sess.run(x))\n", 63 | " print(\"a/b = \",sess.run(y))" 64 | ] 65 | }, 66 | { 67 | "cell_type": "code", 68 | "execution_count": null, 69 | "metadata": { 70 | "collapsed": true 71 | }, 72 | "outputs": [], 73 | "source": [ 74 | "# 关闭session\n", 75 | "sess.close()" 76 | ] 77 | } 78 | ], 79 | "metadata": { 80 | "kernelspec": { 81 | "display_name": "Python 3", 82 | "language": "python", 83 | "name": "python3" 84 | }, 85 | "language_info": { 86 | "codemirror_mode": { 87 | "name": "ipython", 88 | "version": 3 89 | }, 90 | "file_extension": ".py", 91 | "mimetype": "text/x-python", 92 | "name": "python", 93 | "nbconvert_exporter": "python", 94 | "pygments_lexer": "ipython3", 95 | "version": "3.6.3" 96 | } 97 | }, 98 | "nbformat": 4, 99 | "nbformat_minor": 2 100 | } 101 | -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/MNIST_data/t10k-images-idx3-ubyte.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Tensorflow_turtorial/MNIST_data/t10k-images-idx3-ubyte.gz -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/MNIST_data/t10k-labels-idx1-ubyte.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Tensorflow_turtorial/MNIST_data/t10k-labels-idx1-ubyte.gz -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/MNIST_data/train-images-idx3-ubyte.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Tensorflow_turtorial/MNIST_data/train-images-idx3-ubyte.gz -------------------------------------------------------------------------------- /Tensorflow/Tensorflow_turtorial/MNIST_data/train-labels-idx1-ubyte.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/Tensorflow_turtorial/MNIST_data/train-labels-idx1-ubyte.gz -------------------------------------------------------------------------------- /Tensorflow/checkpoints/checkpoint: -------------------------------------------------------------------------------- 1 | model_checkpoint_path: "i600_1512.ckpt" 2 | all_model_checkpoint_paths: "i200_1512.ckpt" 3 | all_model_checkpoint_paths: "i400_1512.ckpt" 4 | all_model_checkpoint_paths: "i600_1512.ckpt" 5 | -------------------------------------------------------------------------------- /Tensorflow/checkpoints/i200_1512.ckpt.data-00000-of-00001: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/checkpoints/i200_1512.ckpt.data-00000-of-00001 -------------------------------------------------------------------------------- /Tensorflow/checkpoints/i200_1512.ckpt.index: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/checkpoints/i200_1512.ckpt.index -------------------------------------------------------------------------------- /Tensorflow/checkpoints/i200_1512.ckpt.meta: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tensorflow/checkpoints/i200_1512.ckpt.meta -------------------------------------------------------------------------------- /Tensorflow/neural_network.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # 通过变量实现神经网络的参数并实现前向传播的过程 3 | @auther liudong 4 | @ 2018-4-2 5 | ''' 6 | import tensorflow as tf 7 | 8 | # 声明w1、w2两个变量 通过设置seed参数设定了随机种子 9 | # 这样可以保证每次运算得到的结果是一样的 10 | w1 = tf.Variable(tf.random_normal((2, 3), stddev=1, seed=1)) 11 | w2 = tf.Variable(tf.random_normal((3, 1), stddev=1, seed=1)) 12 | 13 | # 暂时将输入的特征向量定义为一个常量 x为一个1*2的矩阵 14 | x = tf.constant([[0.7, 0.9]]) 15 | 16 | # 通过前向传播算法获得神经网络的输出 17 | a = tf.matmul(x, w1) 18 | y = tf.matmul(a, w2) 19 | 20 | 21 | sess = tf.Session() 22 | 23 | # 首先对w1, w2进行初始化 24 | sess.run(w1.initializer) 25 | sess.run(w2.initializer) 26 | 27 | # 输出结果 28 | print(sess.run(y)) 29 | sess.close() 30 | -------------------------------------------------------------------------------- /Tensorflow/placeholder_network.py: -------------------------------------------------------------------------------- 1 | ''' 2 | 使用placeholder实现前向传播算法 3 | 4 | ''' 5 | import tensorflow as tf 6 | 7 | # 声明w1、w2两个变量 8 | 9 | w1 = tf.Variable(tf.random_normal((2, 3), stddev=1, seed=1)) 10 | w2 = tf.Variable(tf.random_normal((3, 1), stddev=1, seed=1)) 11 | 12 | # 定义placeholder 作为存放输入数据的地方 这里的维度不一定要定义 13 | # 如果维度是确定的,那么给出维度可以降低出错的概率 14 | x = tf.placeholder(tf.float32, shape=(3, 2), name='input') 15 | 16 | # 通过前向传播算法获得神经网络的输出 17 | a = tf.matmul(x, w1) 18 | y = tf.matmul(a, w2) 19 | 20 | 21 | sess = tf.Session() 22 | 23 | # 首先对w1, w2进行初始化 24 | init_op = tf.global_variables_initializer() 25 | sess.run(init_op) 26 | 27 | # 输出结果 28 | 29 | print(sess.run(y, feed_dict={x: [[0.7, 0.9], [0.1, 0.4], [0.5, 0.8]]})) 30 | sess.close() 31 | -------------------------------------------------------------------------------- /Tensorflow/tensorflow学习笔记.md: -------------------------------------------------------------------------------- 1 | ## 1.logits参数的介绍 2 | ### tensorflow中求交叉熵的函数中有logits变量: 3 | ``` 4 | # 计算交叉熵的函数 5 | tf.nn.softmax_cross_entropy_with_logits( 6 | _sentinel=None, 7 | labels=None, 8 | logits=None, 9 | dim=-1, 10 | name=None 11 | ) 12 | ``` 13 | #### logits本身是一个函数,它可以把某个概率从[0,1]映射为 [-inf,+inf] (正负无穷),函数化描述形式为:logits=ln(p/(1-p))。因此我们可以把logits视为原生态的、未经缩放的,可视为一种未归一化的概率,例如[4,1,2]。softmax的作用就是,把一个系数从[-inf,+inf]映射到[0,1],同时所有参与映射的值累计之和等于一,变成[0.95,0.05,0]。经过softmax就可以当做概率来用。logits作为softmax的输入,经过softmax的加工,就变成归一化的概率,然后和labels代表的概率分布进行计算之间的交叉熵。 14 | ``` 15 | import tensorflow as tf 16 | 17 | labels = [[0.2,0.3,0.5], 18 | [0.1,0.6,0.3]] 19 | logits = [[4,1,-2], 20 | [0.1,1,3]] 21 | 22 | logits_scaled = tf.nn.softmax(logits) 23 | # 已经淘汰 result = tf.nn.softmax_cross_entropy_with_logits(labels=labels, logits=logits) 24 | result = tf.nn.softmax_cross_entropy_with_logits_v2(labels=labels, logits=logits) 25 | with tf.Session() as sess: 26 | print (sess.run(logits_scaled)) 27 | print (sess.run(result)) 28 | ``` 29 | 运行结果: 30 | ``` 31 | [[0.95033026 0.04731416 0.00235563] 32 | [0.04622407 0.11369288 0.84008306]] 33 | [3.9509459 1.6642545] 34 | ``` 35 | ### 注意事项: 36 | 1.如果labels的每一行是one-hot表示,也就是只有一个地方为1(或者说100%),其他地方为0(或者说0%),还可以使用tf.sparse_softmax_cross_entropy_with_logits()。之所以用100%和0%描述,就是让它看起来像一个概率分布。 37 | 2.参数labels,logits必须有相同的形状 [batch_size, num_classes] 和相同的类型(float16, float32, float64)中的一种,否则交叉熵无法计算。 38 | -------------------------------------------------------------------------------- /Tensorflow/tflow.py: -------------------------------------------------------------------------------- 1 | import tensorflow as tf 2 | 3 | g1 = tf.Graph() 4 | with g1.as_default(): 5 | v = tf.get_variable("v", initializer=tf.zeros_initializer(), shape=[1] ) 6 | 7 | g2 = tf.Graph() 8 | with g2.as_default(): 9 | v = tf.get_variable("v", initializer=tf.ones_initializer(), shape=[1]) 10 | 11 | with tf.Session(graph=g1) as sess: 12 | tf.global_variables_initializer().run() 13 | with tf.variable_scope("", reuse=True): 14 | print(sess.run(tf.get_variable("v"))) 15 | 16 | with tf.Session(graph=g2) as sess: 17 | tf.global_variables_initializer().run() 18 | with tf.variable_scope("", reuse=True): 19 | print(sess.run(tf.get_variable("v"))) 20 | -------------------------------------------------------------------------------- /Tensorflow/twoClassify_neuralNetwork.py: -------------------------------------------------------------------------------- 1 | ''' 2 | # 一个完整的-----训练神经网络解决二分类问题的 3 | # 前向传播和反向传播都有 4 | # @ 5 | ''' 6 | import tensorflow as tf 7 | # 使用Numpy工具包生成模拟数据集 8 | from numpy.random import RandomState 9 | 10 | # 定义训练数据集的大小 11 | batch_size = 8 12 | 13 | # 定义神经网络的参数 14 | w1 = tf.Variable(tf.random_normal((2, 3), stddev=1, seed=1)) 15 | w2 = tf.Variable(tf.random_normal((3, 1), stddev=1, seed=1)) 16 | 17 | x = tf.placeholder(tf.float32, shape=(None, 2), name='x-input') 18 | y_ = tf.placeholder(tf.float32, shape=(None, 1), name='y-input') 19 | 20 | a = tf.matmul(x, w1) 21 | y = tf.matmul(a, w2) 22 | 23 | # 定义损失函数和反向传播算法 24 | # 使用sigmoid 函数将y转换为0~1之间的数值。 转换后y可以代表预测是正样本的概率,1-y代表预测是负样本的概率 25 | # cross_entropy 定义了真实值和预测值之间的交叉熵 26 | # 0.001是学习率 27 | y = tf.sigmoid(y) 28 | # clip_by_value 将值限制在 1e-10和1.0之间 29 | # tf.log 对张量中的元素取对数 30 | # * 代表元素之间直接相乘 31 | cross_entropy = -tf.reduce_mean(y_ * tf.log(tf.clip_by_value(y, 1e-10, 1.0)) 32 | + (1-y)* tf.log(tf.clip_by_value(1-y, 1e-10, 1.0))) 33 | train_step = tf.train.AdamOptimizer(0.001).minimize(cross_entropy) 34 | 35 | # 通过随机数生成一个模拟数据集 36 | rdm = RandomState() 37 | dataset_size = 128 38 | X = rdm.rand(dataset_size, 2) 39 | print(X) 40 | 41 | Y = [[int(x1+x2 < 1)] for (x1, x2) in X] 42 | 43 | # 创建一个会话来运行TensorFlow 程序 44 | with tf.Session() as sess: 45 | init_op = tf.global_variables_initializer() 46 | # 初始化变量 47 | sess.run(init_op) 48 | print(sess.run(w1)) 49 | print(sess.run(w2)) 50 | 51 | # 设定训练的轮数 52 | STEPS = 4000 53 | for i in range(STEPS): 54 | # 每次选取batch_size个样本进行训练 55 | start = (i * batch_size) % dataset_size 56 | end = min(start+batch_size, dataset_size) 57 | 58 | # 通过选取的样本训练神经网络并更新参数 59 | sess.run(train_step, feed_dict={x: X[start:end], y_: Y[start:end]}) 60 | if i % 1000 == 0: 61 | # 每隔一段时间计算在所有数据上的 交叉熵 62 | total_cross_entropy = sess.run(cross_entropy, feed_dict={x:X, y_:Y}) 63 | print("After %d training step(s), cross entropy on all data is %g " %(i, total_cross_entropy)) 64 | 65 | print(sess.run(w1)) 66 | print(sess.run(w2)) 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Tianchi_Competition/Alimama/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/17 下午8:51' -------------------------------------------------------------------------------- /Tianchi_Competition/Alimama/__pycache__/BPNN.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tianchi_Competition/Alimama/__pycache__/BPNN.cpython-36.pyc -------------------------------------------------------------------------------- /Tianchi_Competition/Alimama/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tianchi_Competition/Alimama/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /Tianchi_Competition/Alimama/data_figure.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/7 上午11:38' 4 | 5 | import pandas as pd 6 | import matplotlib.pyplot as plt 7 | import seaborn as sns 8 | from sklearn import preprocessing 9 | 10 | 11 | data = pd.read_csv('result.csv') 12 | data.drop_duplicates(inplace=True) 13 | data = pd.DataFrame(data) 14 | lbl = preprocessing.LabelEncoder() 15 | 16 | for i in range(1, 3): 17 | data['item_category_list' + str(i)] = lbl.fit_transform(data['item_category_list'].map( 18 | lambda x: str(str(x).split(';')[i]) if len(str(x).split(';')) > i else '')) # item_category_list的第0列全部都一样 19 | def deal_user_star_level(data): 20 | data['user_start_level'] = data['user_star_level'].apply(lambda x: int(x-3000)) 21 | return data 22 | deal_user_star_level(data) 23 | 24 | print(data.describe()) 25 | print(data.head(5)) 26 | data.drop(['item_category_list'], axis=1, inplace=True) 27 | data.drop(['item_property_list'], axis=1, inplace=True) 28 | data.drop(['predict_category_property'], axis=1, inplace=True) 29 | features = [ # item 30 | 'item_id', 'item_city_id', 'item_price_level', 31 | 'item_sales_level','item_collected_level', 'item_pv_level', 32 | # user 33 | 'user_id','user_gender_id','user_age_level','user_occupation_id', 34 | 'user_star_level', 35 | # shop 36 | 'shop_id','shop_review_num_level', 'shop_review_positive_rate', 'shop_star_level', 37 | ] 38 | data = data[features] 39 | data_corr = data.corr(min_periods=10) 40 | result = data.groupby('item_price_level')['item_city_id'].describe() 41 | print(result) 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | # # 画出特征相关性的热力图 52 | # sns.set() 53 | # a = plt.figure('特征相关性热力图') 54 | # ax = plt.subplot(111) 55 | # heat_map = sns.heatmap(data_corr, vmin=-1, vmax=1, annot=True, square=True) 56 | # plt.plot(50,50) 57 | # plt.show() 58 | # plt.close() -------------------------------------------------------------------------------- /Tianchi_Competition/Zhengqi_beginner/model_train.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/10/15 7:46 PM' 4 | 5 | import pandas as pd 6 | from sklearn.model_selection import train_test_split 7 | import lightgbm as lgb 8 | 9 | train_data = pd.read_csv("/Users/liudong/Desktop/Zhengqi_train.txt",sep="\t") 10 | test_data = pd.read_csv("/Users/liudong/Desktop/Zhengqi_test.txt",sep="\t") 11 | # print(train_data.head()) 12 | # print(test_data.head()) 13 | train_Y = train_data['target'] 14 | train_X = train_data.drop(['target'],axis=1) 15 | 16 | # train_X, val_X, train_Y, val_Y = train_test_split(train_data,Y,test_size=0.3,random_state=42) 17 | # print(train_X.head()) 18 | clf = lgb.LGBMClassifier() 19 | clf.fit(train_X,train_Y.astype(int)) 20 | predict_result = clf.predict(test_data) 21 | result = pd.DataFrame({'target':predict_result}) 22 | result.to_csv('./result1.txt',index=False) -------------------------------------------------------------------------------- /Tianchi_Competition/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | __author__ = 'liudong' 3 | __date__ = '2018/4/17 下午8:52' -------------------------------------------------------------------------------- /Tianchi_Competition/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/1mrliu/AI_Learning_Competition/f8ef183273393b7eab32f6a9a1b941ee77797bd5/Tianchi_Competition/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /XGBoost保存和加载模型: -------------------------------------------------------------------------------- 1 | # 啊uther 2 | import xgboost as xgb 3 | from xgboost import XGBClassifier 4 | from sklearn.preprocessing import LabelEncoder 5 | 6 | 7 | xgb_clf = XGBClassifier() 8 | # 调用模型 9 | booster = xgb.Booster() 10 | booster.load_model('xgb.model') 11 | xgb_clf._Booster = booster 12 | xgb_clf._le = LabelEncoder().fit([0,1]) 13 | preds = xgb_clf.predict(test_X) 14 | # 保存模型 15 | xgb_clf.save_model('xgb.model') 16 | 17 | 参考解决办法链接: 18 | https://github.com/dmlc/xgboost/issues/2073 19 | https://www.cnblogs.com/sench/p/10134094.html 20 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate --------------------------------------------------------------------------------