- 博客(62)
- 收藏
- 关注
原创 【特征工程】特征选择Feature Selection
正好在写这部分,就顺带练习一下吧。一如既往地,来源:https://towardsdatascience.com/feature-selection-techniques-1bfab5fe0784数据集:https://www.kaggle.com/uciml/mushroom-classification减少特征数量的好处有:准确性提高。减少过度拟合。加快训练速度。改进数据可视化...
2020-01-06 21:42:10
514
原创 【基础概念】Matplotlib里的plt.xxx(), or ax.xxx()
侵删,来源:https://towardsdatascience.com/plt-xxx-or-ax-xxx-that-is-the-question-in-matplotlib-8580acf42f44坑坑坑,等有空再看。
2020-01-05 20:43:40
510
原创 【资料】Model evaluation, model selection, and algorithm selection in machine learning
Model evaluation, model selection, and algorithm selection in machine learningDo you know how to choose the right machine learning algorithm among 7 different types?
2019-12-27 09:51:04
518
转载 【基础概念】P-values的解释
无授权,自留,侵删:P-values Explained By Data Scientist四个部分:Hypothesis TestingNormal DistributionWhat is P-value?Statistical Significance1.Hypothesis Testing首先了解一下hypothesis testing ,在这里, p-value 被用来...
2019-12-24 21:59:16
4919
原创 【gis学习】把从栅格中获取的投影坐标转换为经纬度
获取相应坐标系import gdalimport numpy as npfrom osgeo import osrdataset = gdal.Open("C:\\Users\\Nihil\\Desktop\\Arcgisdata\\HPDEM.tif")adfGeoTransform = dataset.GetGeoTransform()get_ref = dataset.GetS...
2019-12-18 11:06:34
1872
原创 【gis学习】GDAL获取栅格数据各个像素对应的经纬度
参考:GDAL获取栅格数据各个像素对应的经纬度(Python版)gdal GetGeoTransform解释 GetProjectionRef//如果图像不含地理坐标信息,默认返回值是:(0,1,0,0,0,1)//In a north up image,//左上角点坐标(padfGeoTransform[0],padfGeoTransform[3]);//padfGeoTransfor...
2019-12-18 10:18:57
7137
7
原创 【语言分析】看看我为了不写英语作业都做了些什么
Text Mining in Python: Steps and Examples词性标注(Part-of-speech tagging)词性标注(Part-of-speech tagging)(自然语言处理文档系列)Penn Treebank词性标记集import pandas as pdimport numpy as npimport osimport nltk.corpus...
2019-12-14 22:57:59
206
原创 【特征工程】(资料)使用Xgboost筛选特征重要性
资料:Using XGBoost For Feature SelectionFeature Importance and Feature Selection With XGBoost in Python
2019-12-14 16:42:10
951
原创 【资料】Divide dataset
Is there a rule-of-thumb for how to best divide data into training and validation sets? Is an even 50/50 split advisable
2019-12-13 15:51:23
230
原创 【CASE】芝加哥犯罪率数据集(CatBoostClassifier)
参考:top 2% based on CatBoostClassifier导入库与数据import numpy as npimport pandas as pdpd.set_option("display.max_columns", None)from sklearn.preprocessing import LabelEncoder, OrdinalEncoder, OneHotEnc...
2019-12-12 15:32:22
2967
1
原创 【特征工程】在机器学习中使用地理空间数据(转载)
原文:Working with Geospatial Data in Machine Learning如何使用地理空间类数据。首先通过可视化数据集(坐标点)来获得有价值的信息,然后,提出用于提取和创造新特征的不同方法,这些新特征将优化模型的建立。数据集来自:New York City Taxi Fare Prediction由于数据集实在太大,我只使用了测试集。import num...
2019-12-11 22:15:21
2294
原创 【特征工程】处理经纬度的9种方法/技巧(转载)
转载加修改:Feature engineering: all I learnt about Geo-spatial features1. 极坐标法Add two new features of Polar coordinates to the datasetx = Longitude;y = Latituderot_x = x * cosθ + y * sinθrot_y = x *...
2019-12-11 17:01:34
6887
原创 【Pandas操作】之列名
1. 参考:Pandas中修改DataFrame列名创建一个DataFrameimport pandas as pda = pd.DataFrame({'A':[1,2,3], 'B':[4,5,6], 'C':[7,8,9]})print(a) A B C0 1 4 71 2 5 82 3 6 9方法1,直接赋值缺点:必须把所有的列名都写上,否则...
2019-12-10 09:11:13
1216
原创 【特征处理】Label Encoding与One Hot
其实Catboost自带处理类别数据的功能。但还是学习一下。Label Encoding与One Hot的区别-201805131.两类模型:(A)逻辑回归,SVM。对数值大小是敏感的,即变量间的数值大小本身是有比较意义的。(B)树模型。对数值变化不敏感,数值存在的意义更多的是为了排序,即0.1,0.2,0.3与1,2,3是没有区别的,这部分模型绝大部分是。2.两类类别变量:2.1...
2019-12-09 16:01:43
512
原创 【基础概念】什么是benchmark model?
阅读文献的时候提到多次,决定还是存一些资料。What is a benchmark model?Benchmarking Predictive Models基准测试流程可能需要运行多次,并使用一个聚合平滑度量 smoothed measure(如中值median value)进行比较为了Benchmarking Models,set.seed,random.seed等的意义就出现了...
2019-12-09 14:56:01
4682
原创 把文本里含有某个关键词的赋值1,其余赋值为0
依旧是芝加哥犯罪的demo:dataset['Block'] = dataset['Address'].str.contains('block', case=False)dataset['Block'] = dataset['Block'].map(lambda x: 1 if x == True else 0)print(dataset.Block.head())0 01 ...
2019-12-08 22:36:21
804
原创 【特征处理】时间序列的一些处理
其余几个Demo讲清楚了,其实我就单拎出来。以消费者数据为例#%%import pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport numpy as npimport repd.set_option('display.max_columns', 1000)pd.set_option('dis...
2019-12-08 21:53:48
358
原创 关于数据泄露
关注这个主要是之前看了nature那篇地震预测的纷争,希望自己以后能绕开。存一些资料。一些文章:你可能过于高估了机器学习算法能力,带你解读鲜为人知的数据泄露问题Kaggle上关于data leakage的详细介绍以及提出的一些避免方法How Data Leakage Impacts Machine Learning Models(一个详细解释)八卦:Nature论文预测余震只是炒作?...
2019-12-08 21:11:36
221
原创 芝加哥犯罪率数据集(数据分析与特征处理)
参照:SF-Crime Analysis & PredictionCrime Scene Exploration and Model Fit主要是因为这个数据集包含了时间序列和坐标点。练习一下特征处理。数据分析导入库#%%%matplotlib inlineimport numpy as np import pandas as pdimport mathimport s...
2019-12-08 16:42:35
7053
1
原创 .shape[0]
import numpy as npimport pandas as pdc= np.array(([[1,1],[1,2],[1,3],[1,4]]))c = pd.DataFrame(c)print(c) 0 10 1 11 1 22 1 33 1 4print(c.shape[0])4
2019-12-08 14:27:05
1585
1
原创 Python安装Geopandas库
没想到装这个比配置pytorch还麻烦。Step1 查看属性import wheel.pep425tags as wprint(w.get_supported())[('cp37', 'cp37m', 'win_amd64'), ('cp37', 'none', 'win_amd64'), ('cp37', 'none', 'any'), ('cp3', 'none', 'any'), ...
2019-12-07 16:53:05
844
原创 利用Shap解释Xgboost(或者别的)模型
Shap的一些介绍:SHAP包算法解析shap的中文解析知乎的翻译ps,sklearn库的模型可以用lime模块解析本文参考利用SHAP解释Xgboost模型数据集
2019-12-07 16:33:07
14282
7
原创 LabelEncoer,类别特征转换为数值特征,transform的使用
demo参照E-Commerce Data那篇对country类别的处理。换个简单的数据集Demo:import pandas as pdimport numpy as npdf = pd.DataFrame({"Person": ["John", "Myla", "Lewis", "John", "Myla"], ...
2019-12-07 10:27:50
864
原创 pandas.Series.str.contains(筛选)
https://blog.youkuaiyun.com/weixin_43615654/article/details/103419171这篇里用到了一个Str的contains函数,查了一下用法。pandas.Series.str.containsReturns: Series or Index of boolean valuesA Series or Index of boolean value...
2019-12-07 09:42:47
978
原创 Pandas的count()与value_counts()区别
pandas.DataFrame.count函数方法的使用count计算每列或每行的非NA单元格。值None,NaN,NaT和可选的numpy.inf(取决于pandas.options.mode.use_inf_as_na)被视为NA。demo:import pandas as pdimport numpy as npdf = pd.DataFrame({"Person":...
2019-12-06 15:44:47
6642
原创 kaggle上面的E-Commerce Data数据集练习(可视化与部分特征工程)
接上篇:https://editor.youkuaiyun.com/md/?articleId=103394900Part 2 特征工程及可视化一种处理时间数据的方法data.insert(loc = 2, column='year_month',value=data['InvoiceDate'].map(lambda x:100*x.year+x.month))data.insert(loc = ...
2019-12-06 11:27:25
1831
1
原创 kaggle上面的E-Commerce Data数据集练习(数据处理)
熟练一下pandas和数据处理项目地址参考:Python数据清洗指南Customer Segmentation with XGBoost (97.92%)项目描述:这是一个跨国数据集,包含2010年12月1日至2011年12月9日期间英国注册的非商店在线零售的所有交易。该公司主要销售独特的万能礼品。公司的许多客户都是批发商。Part 1 分析数据和清洗数据导入数据data = pd...
2019-12-04 21:46:52
3573
原创 pandas数据处理练习(数据集:犯罪率)
导入库import pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport numpy as npdata = pd.read_csv("C:\\Users\\Nihil\\Documents\\pythonlearn\\data\\random\\crimerate.csv")data.drop(...
2019-12-04 17:30:34
840
1
原创 categorical_features_indices = np.where(X.dtypes != np.float)[0]的含义
参考:CatBoost: A machine learning library to handle categorical (CAT) data automatically数据类型:X = train.drop(['Item_Outlet_Sales'], axis=1)y = train.Item_Outlet_Salesfrom sklearn.model_selection imp...
2019-12-01 20:25:04
1267
原创 特征处理与可视化资料
数据分析思维训练—泰坦尼克生还者预测鳄梨价格分析——Python数据可视化This notebook demos Python data visualizations on the Iris dataset特征处理的小case
2019-11-30 18:02:31
120
原创 宝可梦数据集的练习(预测模型)
仍然是参照:https://www.kesci.com/home/project/5b02bf4b57e80961e67c3b06先根据原文做,之后再做改动吧预测模型采用算法:1)Logistic Regression2)Support Vector Machines(Linear and radial)3)Random Forest4)K-Nearest Neighbours5)...
2019-11-30 17:18:17
3388
原创 数据共线性处理——用seaborn的方式(1),顺便也存些seaborn的资料
参考:https://zhuanlan.zhihu.com/p/50736139https://www.jiqizhixin.com/articles/2019-01-30-15https://lanpeihui.top/2018/09/27/%E7%89%B9%E5%BE%81%E9%80%89%E6%8B%A9%E5%AE%9E%E8%B7%B5/http://codingdict.co...
2019-11-28 11:29:43
464
原创 宝可梦数据集的练习(数据和特征的分析)
不想干正事练习点别的。来自kaggle项目:Visualizing Pokémon Stats with SeabornEDA-Pokemon目录Part1: 探索性数据分析:1)特征分析.2)发现特征间的关系和趋势Part2: 特征工程和数据清洗:1)移除多余的特征2)数据类型的转换Part3: 预测模型1)基本算法2)交叉验证3)集成算法4)重要特征抽取Par...
2019-11-27 22:16:30
5279
原创 特征输出重要性的排序
几个参考:模型输出特征重要性排序在 Python 中使用 XGBoost 的特征重要性和特征选择关于seaborn作图barplot&countplot&pointplotPython Seaborn综合指南1.用matplotlibimport pandas as pdfrom xgboost import XGBClassifierfrom xgboost i...
2019-11-27 20:51:46
5255
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人