- 大数据分析教程
- 大数据分析 - 首页
- 大数据分析 - 概述
- 大数据分析 - 特点
- 大数据分析 - 数据生命周期
- 大数据分析 - 架构
- 大数据分析 - 方法论
- 大数据分析 - 核心交付成果
- 大数据采用与规划注意事项
- 大数据分析 - 主要利益相关者
- 大数据分析 - 数据分析师
- 大数据分析 - 数据科学家
- 大数据分析有用资源
- 大数据分析 - 快速指南
- 大数据分析 - 资源
- 大数据分析 - 讨论
大数据分析 - 数据探索
探索性数据分析是由John Tuckey (1977)提出的一个概念,它代表着统计学领域的一种新视角。Tuckey的想法是,在传统的统计学中,数据并没有被图形化地探索,而只是被用来检验假设。第一次尝试开发工具是在斯坦福大学进行的,该项目被称为prim9。该工具能够将数据可视化到九个维度,因此能够提供数据的多元视角。
近年来,探索性数据分析已成为必不可少的一部分,并已纳入大数据分析生命周期。能够找到洞察力并能够在组织中有效地进行沟通的能力,是强大的EDA能力的驱动力。
基于Tuckey的想法,贝尔实验室开发了S编程语言,以便为进行统计提供交互式界面。S的目标是提供具有易于使用的语言的广泛图形功能。在当今大数据环境下,基于S编程语言的R是目前最流行的分析软件。
以下程序演示了探索性数据分析的使用。
以下是探索性数据分析的示例。此代码也可在part1/eda/exploratory_data_analysis.R文件中找到。
library(nycflights13)
library(ggplot2)
library(data.table)
library(reshape2)
# Using the code from the previous section
# This computes the mean arrival and departure delays by carrier.
DT <- as.data.table(flights)
mean2 = DT[, list(mean_departure_delay = mean(dep_delay, na.rm = TRUE),
mean_arrival_delay = mean(arr_delay, na.rm = TRUE)),
by = carrier]
# In order to plot data in R usign ggplot, it is normally needed to reshape the data
# We want to have the data in long format for plotting with ggplot
dt = melt(mean2, id.vars = ’carrier’)
# Take a look at the first rows
print(head(dt))
# Take a look at the help for ?geom_point and geom_line to find similar examples
# Here we take the carrier code as the x axis
# the value from the dt data.table goes in the y axis
# The variable column represents the color
p = ggplot(dt, aes(x = carrier, y = value, color = variable, group = variable)) +
geom_point() + # Plots points
geom_line() + # Plots lines
theme_bw() + # Uses a white background
labs(list(title = 'Mean arrival and departure delay by carrier',
x = 'Carrier', y = 'Mean delay'))
print(p)
# Save the plot to disk
ggsave('mean_delay_by_carrier.png', p,
width = 10.4, height = 5.07)
代码应该生成如下所示的图像:
广告