当前位置: 首页 > news >正文

初学者求教怎样做网站深圳fpc人才网官网

初学者求教怎样做网站,深圳fpc人才网官网,在手机上建网站,房地产市场信息管理平台鲜为人知的6个黑科技网站Pandas is the go-to Python library for data analysis and manipulation. It provides numerous functions and methods that expedice the data analysis process.Pandas是用于数据分析和处理的Python库。 它提供了加速数据分析过程的众多功能和方法…鲜为人知的6个黑科技网站Pandas is the go-to Python library for data analysis and manipulation. It provides numerous functions and methods that expedice the data analysis process. Pandas是用于数据分析和处理的Python库。 它提供了加速数据分析过程的众多功能和方法。 When it comes to data visualization, pandas is not the prominent choice because there exist great visualization libraries such as matplotlib, seaborn, and plotly. 在数据可视化方面大熊猫并不是首选因为存在强大的可视化库例如matplotlibseaborn和plotly。 With that being said, we cannot just ignore the plotting tools of pandas. They help to discover relations within dataframes or series and syntax is pretty simple. Very informative plots can be created with just one line of code. 话虽如此我们不能仅仅忽略熊猫的绘图工具。 它们有助于发现数据框或序列中的关系语法非常简单。 只需一行代码就可以创建非常有用的图。 In this post, we will cover 6 plotting tools of pandas which definitely add value to the exploratory data analysis process. 在本文中我们将介绍6种熊猫绘图工具这些工具肯定会为探索性数据分析过程增添价值。 The first step to create a great machine learning model is to explore and understand the structure and relations within the data. 创建出色的机器学习模型的第一步是探索和理解数据内的结构和关系。 These 6 plotting tools will help you understand the data better: 这6种绘图工具将帮助您更好地理解数据 Scatter matrix plot 散点图 Density plot 密度图 Andrews curves 安德鲁斯曲线 Parallel coordinates 平行坐标 Lag plots 滞后图 Autocorrelation plot 自相关图 I will use a diabetes dataset available on kaggle. Let’s first read the dataset into a pandas dataframe. 我将使用kaggle上提供的糖尿病数据集 。 首先让我们将数据集读入pandas数据框。 import pandas as pdimport numpy as npimport matplotlib.pyplot as plt%matplotlib inlinedf pd.read_csv(/content/diabetes.csv)print(df.shape)df.head()The dataset contains 8 numerical features and a target variable indicating if the person has diabetes. 该数据集包含8个数字特征和一个指示该人是否患有糖尿病的目标变量。 1.散点图 (1. Scatter matrix plot) Scatter plots are typically used to explore the correlation between two variables (or features). The values of data points are shown using the cartesian coordinates. 散点图通常用于探索两个变量(或特征)之间的相关性。 使用笛卡尔坐标显示数据点的值。 Scatter plot matrix produces a grid of scatter plots with just one line of code. 散点图矩阵仅用一行代码即可生成散点图的网格。 from pandas.plotting import scatter_matrixsubset df[[Glucose,BloodPressure,Insulin,Age]]scatter_matrix(subset, figsize(10,10), diagonalhist)I’ve selected a subset of the dataframe with 4 features for demonstration purposes. The diagonal shows the histogram of each variable but we can change it to show kde plot by setting diagonal parameter as ‘kde’. 为了演示目的我选择了具有4个功能的数据框的子集。 对角线显示每个变量的直方图但我们可以通过将对角线参数设置为 kde 来更改它以显示kde图。 2.密度图 (2. Density plot) We can produce density plots using kde() function on series or dataframe. 我们可以在系列或数据框上使用kde()函数生成密度图。 subset df[[Glucose,BloodPressure,BMI]]subset.plot.kde(figsize(12,6), alpha1)We are able to see the distribution of features with one line of code. Alpha parameter is used to adjust the darkness of lines. 我们可以用一行代码看到功能的分布。 Alpha参数用于调整线条的暗度。 3.安德鲁斯曲线 (3. Andrews curves) Andrews curves, named after the statistician David F. Andrews, is a tool to plot multivariate data with lots of curves. The curves are created using the attributes (features) of samples as coefficients of Fourier series. 以统计学家大卫·安德鲁斯(David F. 使用样本的属性(特征)作为傅立叶级数的系数来创建曲线。 We get an overview of clustering of different classes by coloring the curves that belong to each class differently. 我们通过对属于每个类别的曲线进行不同的着色来获得对不同类别的聚类的概述。 from pandas.plotting import andrews_curvesplt.figure(figsize(12,8))subset df[[Glucose,BloodPressure,BMI, Outcome]]andrews_curves(subset, Outcome, colormapPaired)We need to pass a dataframe and name of the variable that hold class information. Colormap parameter is optional. There seems to be a clear distinction (with some exceptions) between 2 classes based on the features in subset. 我们需要传递一个保存类信息的数据框和变量名。 Colormap参数是可选的。 根据子集中的功能两个类之间似乎有明显的区别(有些例外)。 4.平行坐标 (4. Parallel coordinates) Parallel coordinates is another tool for plotting multivariate data. Let’s first create the plot and then talk about what it tells us. 平行坐标是另一个用于绘制多元数据的工具。 让我们首先创建情节然后谈论它告诉我们的内容。 from pandas.plotting import parallel_coordinatescols [Glucose,BloodPressure,BMI, Age]plt.figure(figsize(12,8))parallel_coordinates(df,Outcome,color[Blue,Gray],colscols)We first import parallel_coordinates from pandas plotting tools. Then create a list of columns to use. Then a matplotlib figure is created. The last line creates parallel coordinates plot. We pass a dataframe and name of the class variable. Color parameter is optional and used to determine colors for each class. Finally cols parameter is used to select columns to be used in the plot. If not specified, all columns are used. 我们首先从熊猫绘图工具导入parallel_coordinates 。 然后创建要使用的列的列表。 然后创建一个matplotlib图形。 最后一行创建平行坐标图。 我们传递一个数据框和类变量的名称。 Color参数是可选的用于确定每个类的颜色。 最后 cols参数用于选择要在绘图中使用的列。 如果未指定则使用所有列。 Each column is represented with a vertical line. The horizontal lines represent data points (rows in dataframe). We get an overview of how classes are separated according to features. “Glucose” variable seems to a good predictor to separate these two classes. On the other hand, lines of different classes overlap on “BloodPressure” which indicates it does not perform well in separating the classes. 每列均以垂直线表示。 水平线代表数据点(数据帧中的行)。 我们对如何根据功能分离类进行了概述。 “葡萄糖”变量似乎是区分这两个类别的良好预测指标。 另一方面不同类别的行在“ BloodPressure”上重叠这表明在分隔类别时效果不佳。 5.滞后图 (5. Lag plot) Lag plots are used to check the randomness in a data set or time series. If a structure is displayed in lag plot, we can conclude that the data is not random. 滞后图用于检查数据集或时间序列中的随机性。 如果在滞后图中显示结构则可以得出结论数据不是随机的。 from pandas.plotting import lag_plotplt.figure(figsize(10,6))lag_plot(df)There is no structure in our data set that indicates randomness. 我们的数据集中没有任何结构表明随机性。 Let’s see an example of non-random data. I will use the synthetic sample in pandas documentation page. 让我们看一个非随机数据的例子。 我将在pandas文档页面中使用合成样本。 spacing np.linspace(-99 * np.pi, 99 * np.pi, num1000)data pd.Series(0.1 * np.random.rand(1000) 0.9 * np.sin(spacing))plt.figure(figsize(10,6))lag_plot(data)We can clearly see a structure on lag plot so the data is not random. 我们可以清楚地看到滞后图上的结构因此数据不是随机的。 6.自相关图 (6. Autocorrelation plot) Autocorrelation plots are used to check the randomness in time series. They are produced by calculating the autocorrelations for data values at varying time lags. 自相关图用于检查时间序列中的随机性。 它们是通过计算在不同时滞下数据值的自相关来产生的。 Lag is the time difference. If the autocorrelations are very close to zero for all time lags, the time series is random. 滞后是时差。 如果对于所有时滞自相关都非常接近零则时间序列是随机的。 If we observe one or more significantly non-zero autocorrelations, then we can conclude that time series is not random. 如果我们观察到一个或多个显着的非零自相关则可以得出时间序列不是随机的结论。 Let’s first create a random time series and see the autocorrelation plot. 我们首先创建一个随机时间序列然后查看自相关图。 noise pd.Series(np.random.randn(250)*100)noise.plot(figsize(12,6))This time series is clearly random. The autocorrelation plot of this time series: 这个时间序列显然是随机的。 该时间序列的自相关图 from pandas.plotting import autocorrelation_plotplt.figure(figsize(12,6))autocorrelation_plot(noise)As expected, all autocorrelation values are very close to zero. 不出所料所有自相关值都非常接近零。 Let’s do an example of non-random time series. The plot below shows a very simple upward trend. 让我们举一个非随机时间序列的例子。 下图显示了非常简单的上升趋势。 upward pd.Series(np.arange(100))upward.plot(figsize(10,6))plt.grid()The autocorrelation plot for this time series: 此时间序列的自相关图 plt.figure(figsize(12,6))autocorrelation_plot(upward)This autocorrelation clearly indicates a non-random time series as there are many significantly non-zero values. 由于存在许多明显的非零值因此这种自相关清楚地指示了非随机时间序列。 It is very easy to visually check the non-randomness of simple upward and downward trends. However, in real life data sets, we are likely to see highly complex time series. We may not able see the trends or seasonality in those series. In such cases, autocorrelation plots are very helpful for time series analysis. 直观地检查简单的向上和向下趋势的非随机性非常容易。 但是在现实生活中的数据集中我们可能会看到非常复杂的时间序列。 我们可能看不到那些系列的趋势或季节性。 在这种情况下自相关图对于时间序列分析非常有帮助。 Pandas provide two more plotting tools which are bootstap plot and RadViz. They can also be used in exploratory data analysis process. 熊猫提供了另外两种绘图工具即引导绘图和RadViz 。 它们也可以用于探索性数据分析过程。 Thank you for reading. Please let me know if you have any feedback. 感谢您的阅读。 如果您有任何反馈意见请告诉我。 翻译自: https://towardsdatascience.com/6-lesser-known-pandas-plotting-tools-fda5adb232ef鲜为人知的6个黑科技网站
http://www.pierceye.com/news/705819/

相关文章:

  • 成都网站定制中心知名的中文域名网站有哪些
  • 福州长乐网站建设网站流量统计分析
  • 四川网站建设公司 登录六盘水市诚信网站建设公司
  • 优秀包装设计网站软件工程师工作
  • 舟山建设信息港网站泉州百度网络推广
  • 网站流量宝镜像别人网站做排名的好处
  • 如何学习网站建设app网络营销方案设计题
  • 高端品牌网站建设明细报价报腾讯云 win wordpress
  • 云南建设网站网站建设公司现在还挣钱吗
  • 濮阳微信网站建设没有数据库的网站
  • 网站开发与没计是做什么贵阳查房子备案的网站
  • 做网站学不需要做后台管理系统mean网站开发
  • 网页网站公司如何做备份游戏型网站开发
  • 网站排名必做阶段性seo策略软文写作是什么意思
  • 网站域名商渭南哪家公司可以做网站
  • 医院网站asp源码加强机关网站建设
  • wordpress建手机站网站建设规划大纲
  • 同个主体新增网站备案施工企业副总经理竞聘
  • 视频网站后台设计针式个人知识库管理系统
  • 外围网站开发网页制作对联
  • 深圳福永网站建设网站多个用户怎样建设
  • 百度网站排名怎么提高wordpress页面全屏的插件
  • 企业网站优化方式wordpress 外链播放器
  • 设计衣服的网站久久诗歌网
  • 上海网站营销it运维网
  • 一起做网店广州站怎么推广软件让别人下载
  • 王晴儿网站建设方案wordpress媒体库 ftp
  • 乡村建设网站自己的网站做防伪码
  • 企业网站托管新乡企业网站建设
  • 移动网站开发课程设计莱芜四中网站