使用DolphinDB进行淘宝用户行为分析

本页是一篇教程文章:介绍作者与发布日期,概述 DolphinDB 的定位,并说明使用淘宝用户行为数据集开展分析的目标与数据来源。

Source: https://dolphindb.cn/blogs/63

What this page covers

技能认证特训营第二期限时报名活动

页面顶部包含活动提示与限时报名链接,用于引导参与与获取优惠信息。

使用DolphinDB进行淘宝用户行为分析(文章信息与概述)

本节给出文章信息,并概述 DolphinDB 定位、教程目的、数据集来源与总体分析目标。

数据与环境封装(Docker + DolphinDB DFS 表结构与分区)

本节说明将 DolphinDB 与数据集封装到 Docker,并介绍 DFS 库、user 表的数据范围、规模、分区方式与字段/行为含义。

字段与行为类型(摘要)

下载docker部署包

本节给出 Docker 部署包获取与部署步骤,包括解压、导入镜像、启动容器、访问 Notebook,以及 license 过期处理。

用户行为分析(总体量、转化、UV、按日/时段统计与Map-Reduce示例)

本节通过 DolphinDB 查询统计总体记录量与 PV/UV 等指标,并展示跳失率、转化率与付费用户占比的示例计算,以及按天/按时段的统计方法(含函数封装与 Map-Reduce)。

商品分析(商品规模、销量/浏览Top、行为汇总与转化观察)

本节统计商品数量与购买分布,并给出销量 Top 与浏览 Top 的示例结果,以及对浏览与购买转化差异的观察。

扩展练习与使用声明

本节提供扩展练习方向,并声明教程用途限制。

Facts Index

Entity Attribute Value Confidence
Blog postauthorJunxihigh
Blog postpublication_date2021-08-05high
DolphinDBpositioning新一代的高性能分布式时序数据库(time-series database),同时具有丰富的数据分析和分布式计算功能medium
Tutorialuse_case使用DolphinDB对淘宝APP的用户行为数据进行分析,以进一步分析业务问题high
DatasetsourceUser Behavior Data from Taobao for Recommendation(阿里云天池数据集)high
Environmentpackaging本教程将DolphinDB及数据集封装到docker中high
DolphinDB Docker packagecontains_database分布式数据库 dfs://user_behaviorhigh
dfs://user_behavior.user tabledata_time_range2017年11月25日到2017年12月3日high
dfs://user_behavior.user tabledata_scale将近一百万淘宝APP用户的行为记录(描述性)medium
dfs://user_behavior.user tablepartitioning_scheme组合分区:第一层按日期分区(每天一个分区),第二层按userID哈希分区;共180个分区high
user table schemacore_fieldsuserID、itemID、categoryID、behavior(pv/buy/cart/fav)、behaveTime(时间戳)medium
Behavior typepv_meaning浏览商品详情页high
Behavior typebuy_meaning商品购买high
Behavior typecart_meaning将商品加入购物车high
Behavior typefav_meaning收藏商品high
Docker environmentprerequisite使用前确保docker环境已经部署好;提供docker安装教程链接 https://docs.docker.com/install/high
Deployment packagedownload_urlhttp://www.dolphindb.cn/downloads/bigdata.tar.gzhigh
Deployment stepunpack_commandgunzip bigdata.tar.gzhigh
Deployment stepimport_image_commandcat bigdata.tar | docker import - my/bigdata:v1high
Deployment steplist_images_commanddocker imageshigh
Deployment steprun_container_commanddocker run -dt -p 8888:8848 --name test <image id> /bin/bash ./dolphindb/start.shhigh
DolphinDB Notebookaccess浏览器访问 本机IP地址:8888(如 localhost:8888)进入DolphinDB Notebook;后续代码在Notebook中执行high
DolphinDB Docker licensevalid_until2019年9月1日high
License replacementinstructions若license过期:到DolphinDB官网下载社区版,用社区版license替换 bigdata.tar/dolphindb/dolphindb.lichigh
DolphinDB community edition downloadurlhttp://www.dolphindb.cn/alone/alone.php?id=10high
DolphinDB login examplecredentialslogin("admin","123456")high
user tablerecord_count98,914,533high
Taobao app (dataset period)page_views_PV88,596,903high
Taobao app (dataset period)unique_visitors_UV987,984high
DolphinDB execdifference_from_selectselect总返回表;exec选择一列返回向量;与聚合函数一起使用返回标量;与pivot by一起使用返回矩阵,便于后续计算high
Users with exactly one behavior recordcount92high
Jump rate (onceUserNum/UV*100)value_percent0.009312high
Taobao app user stickinessinterpretation只浏览一次离开的用户占比几乎可忽略不计,说明淘宝有足够吸引力让用户停留在APP中low
Intent actions (fav+cart)count8,318,654high
Conversion rate (fav+cart)/PV*100value_percent9.389328high
Buy actionscount1,998,976high
Conversion rate buy/PV*100value_percent2.256259high
Conversion rate buy/(fav+cart)*100value_percent24.030041high
Purchase intent vs immediate purchaseinterpretation大部分用户会把中意的商品收藏或加入购物车,但不一定会立即购买low
Paid user rate (buy UV / total UV)value_percent67.852313high
Taobao app purchasing behaviorinterpretation这9天中付费用户占67.8%,说明大部分用户会在淘宝APP上购物low
DolphinDB iifdefinition条件运算符 iif(cond, trueResult, falseResult),cond通常是布尔表达式high
Daily traffic patternobservation周五、周六和周日(2017.11.25、2017.11.26、2017.12.02、2017.12.03)访问量明显增加medium
Method 1 (time-slice queries)approach分别统计各个时间段数据再合并(示例:2017.11.29多个时间区间查询并unionAll)high
Code reusefunction_exampledef calculateBehavior(startTime,endTime){ ... where behaveTime between startTime : endTime }high
Method 2 (Map-Reduce)approach通过DolphinDB Map-Reduce框架:repartitionDS按时间范围生成数据源,mr并行应用caculate函数并unionAll合并结果(示例:2017.11.29)high
Weekday time-of-day usage patternobservation工作日凌晨(0点到6点)使用率最高,其次是下午(14点到16点)medium
Weekend behavior computation examplesexamples提供周六2017.11.25与周日2017.11.26的repartitionDS + mr计算示例(SatBehavior, SunBehavior)high
Weekend vs weekday app usageobservation周六和周日各时间段使用率都比工作日高;周末使用高峰是凌晨(0点到6点)medium
Distinct items in periodcount4,142,583high
Top-selling itemitem_id_and_buy_countitemID=3122135,购买次数=1,408high
Items bought exactly oncecount_and_share370,747种商品只被购买一次,占所有商品的8.94%high
Distribution of purchases across itemsobservation购买次数越多,涉及到的商品数量越少medium
Most-viewed itemitem_id_and_page_viewsitemID=812879,浏览次数=29,720high
Most-viewed item (812879)sales_note销量仅为135,未进入销量前20high
Top-selling item (3122135)page_views_and_conversion浏览量为1777;未进入浏览量前20;从浏览到购买的转化率高达79.2%medium
Top-selling item (3122135)interpretation可能是刚需用品,用户不需要太多浏览就决定购买low
Extension exercisesexercise_list(1)2017.11.25每小时购买率(购买次数/总行为次数*100%);(2)购买次数最多的用户及其购买最多的商品;(3)商品3122135各时段购买次数;(4)每类别每行为次数;(5)每类别销量最高商品high
Tutorialusage_notice本教程仅供学习使用high