CN112434021A - 一种基于时间序列用水数据的用户特征构造方法 - Google Patents
一种基于时间序列用水数据的用户特征构造方法 Download PDFInfo
- Publication number
- CN112434021A CN112434021A CN202011434685.2A CN202011434685A CN112434021A CN 112434021 A CN112434021 A CN 112434021A CN 202011434685 A CN202011434685 A CN 202011434685A CN 112434021 A CN112434021 A CN 112434021A
- Authority
- CN
- China
- Prior art keywords
- data
- water
- water consumption
- month
- user
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 title claims abstract description 140
- 238000010276 construction Methods 0.000 title claims abstract description 8
- 238000004140 cleaning Methods 0.000 claims abstract description 8
- 230000002159 abnormal effect Effects 0.000 claims description 22
- 238000000034 method Methods 0.000 claims description 9
- 238000012545 processing Methods 0.000 claims description 6
- 238000006243 chemical reaction Methods 0.000 claims description 5
- 238000004364 calculation method Methods 0.000 claims description 3
- 238000013507 mapping Methods 0.000 claims description 3
- 238000012216 screening Methods 0.000 claims description 3
- 230000017105 transposition Effects 0.000 abstract description 5
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 238000000265 homogenisation Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000007635 classification algorithm Methods 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000001303 quality assessment method Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/21—Design, administration or maintenance of databases
- G06F16/215—Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2458—Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
- G06F16/2474—Sequence data queries, e.g. querying versioned data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/06—Energy or water supply
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Business, Economics & Management (AREA)
- Economics (AREA)
- Software Systems (AREA)
- Health & Medical Sciences (AREA)
- Tourism & Hospitality (AREA)
- Marketing (AREA)
- General Business, Economics & Management (AREA)
- Public Health (AREA)
- General Health & Medical Sciences (AREA)
- Strategic Management (AREA)
- Primary Health Care (AREA)
- Water Supply & Treatment (AREA)
- Quality & Reliability (AREA)
- Fuzzy Systems (AREA)
- Mathematical Physics (AREA)
- Probability & Statistics with Applications (AREA)
- Human Resources & Organizations (AREA)
- Computational Linguistics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
本发明涉及一种基于时间序列用水数据的用户特征构造方法,包括步骤:定期将时间序列用水数据录入服务器MySQL数据库,并将该用水数据定期保存,形成用水数据表;对原始一维用水数据X进行数据清洗;对所有单月的稀疏用水数据进行转置,建立单月用水量数据表。本发明的有益效果是:通过对一维稀疏用水数据的转换,可以得到以用户为对象的特征数据集,最终可以对用水用户类型分类问题、用水用户生成内容大数据平台等提供有力的数据基础。一般的用水用户生成信息维度单一、数据粗糙,不具备参考和使用价值,本发明可以通过数据清洗、数据库数据转置、特征工程的方式提供标准的以用户为数据对象的数据集。
Description
技术领域
本发明属于机器学习分类算法下的数据处理领域,尤其涉及一种基于时间序列用水数据的用户特征构造方法。
背景技术
用水用户数据处理及分析一直是企业难以解决的问题,而以用户为数据对象的规范化数据集在供水企业盈利、用户生成内容(UGC)大数据平台等方面起着极为关键的作用。用户的用水性质评定指的是,通过用户的用水量及用水性质,将用水用户信息上传至区域供水系统。对于盈利性质的用水行为来说,企业会收取更高的单价费用;对于普通的居民用水来说,企业会提供更低的价位。而当前供水企业提供的用水数据往往比较稀疏,是一维的单月用水数据,数据维度比较单一,无法衡量用水用户的用水性质。
发明内容
本发明的目的是克服现有技术中的不足,提供一种基于时间序列用水数据的用户特征构造方法。
这种基于时间序列用水数据的用户特征构造方法,包括以下步骤:
S1、定期将时间序列用水数据录入服务器MySQL数据库,并将该用水数据定期保存,形成用水数据表;
S2、对原始一维用水数据X进行数据清洗;
S2.1、缺失值补偿:将数据为空处的数据取-1作为标注;
S2.2、异常值替换:对单月的数据做异常值判定,若超过正常值范围,则将异常值调整为正常值的边界值;单月的数据指一个文件里面只有用户一个月的这一个数据。
S2.3、对负值数据统一取反,并判定该取反后的数据是否为异常值,若为异常值,则执行步骤S2.2中的异常值替换;
S3、对所有单月的稀疏用水数据进行转置,建立单月用水量数据表;转置后的数据对象为单个用户在指定月份内的用水量;需要处理的数据是一个用户12个月的数据,所以需要转置,将12个文件中所有用户对应的那1个数据,转置为不同用户12个月内的12列数据。
上式(1)至式(3)中,为样本常规特征的均值,i为月份数,n为月份总数,Xi为第i个月的用水量,S为样本常规特征的均一化标准差;F为样本常规特征的均一化波动比;Max(Xi)为第i个月用水量的最大值,Min(Xi)为第i个月用水量的最小值;
S5、构造用水特征;
S6、转换物理地址信息为经纬度信息,并均一化映射到当前用水区。
作为优选,步骤S1中将时间序列用水数据录入服务器数据库的周期及保存该数据的周期均为一个月。
作为优选,步骤S1中用水数据表包括必需字段和自由字段;其中必需字段是单表必须具有的字段内容,自由字段可以是其他的额外备注信息;必需字段内容为:账号ID(id)、用户地址(address)和当月实际用水量(usage_amount);自由字段内容为用水单位名称(name)、用户原始标签(usage_type)、用水单价(price)和当前月份(month)。
作为优选,步骤S2.2具体包括以下步骤:
S2.2.1、处理数据得到数据主体,数据主体包括核心数据和主体数据:对单月体量为N的数据X,计算其中位数得到Xmid,计算其上四分位线为下四分位线为介于上四分位线和下四分位线之间的数据为核心数据,核心部分的数据占整体数据的1/2;还取上下四分位线外1.5IQR部分的数据作为主体数据;主体数据的上限为主体数据的下限为S2.2.2、筛选用水数据的正常值,将超过正常值的数据统一调整为正常值的边界值:将超过主体数据上限的数据统一重置为将低于主体数据的下限的数据统一重置为
作为优选,步骤S4中样本常规特征均为除去单月用量为0后有效值的计算值。
作为优选,步骤S4中所有参与式(1)至式(3)中计算的数据均非零,若所有单月用水量均为0,则样本常规特征的均值、样本常规特征的均一化标准差、样本常规特征的中位数M、月用水量的最大值、月用水量最小值均取0,均一化波动比取1。
作为优选,步骤S5中零用水量月份数、当前用水均值、指定用水类型均值差和用水量波动比。
本发明的有益效果是:本发明通过对一维稀疏用水数据的转换,可以得到以用户为对象的特征数据集,最终可以对用水用户类型分类问题、用水用户生成内容(UGC)大数据平台等提供有力的数据基础。一般的用水用户生成信息维度单一、数据粗糙,不具备参考和使用价值,本发明可以通过数据清洗、数据库数据转置、特征工程的方式提供标准的以用户为数据对象的数据集。
附图说明
图1为数据主体图。
具体实施方式
下面结合实施例对本发明做进一步描述。下述实施例的说明只是用于帮助理解本发明。应当指出,对于本技术领域的普通人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干修饰,这些改进和修饰也落入本发明权利要求的保护范围内。
本发明针对企业的用水数据稀疏分散、数据维度单一无法形成以用户为对象的数据维度问题,提供一种基于单一维度时间序列用水数据的用户多维特征构造方法,为用水用户分类问题提供数据增强的方法。
供水单位可以提供的用水数据是一维且散乱的,一般是单月所在区域所有用户的当月用水量,如果需要以用户为对象做数据分析的任务,需要做严格统一的数据清洗和转置工作。本发明中,原始数据可由供水单位或其他第三方媒介例如网络连接的蓝牙、WIFI硬件设备直接提供,上传到服务器,服务器对原始数据进行数据清洗和数据转置后,通过特征工程的方式得到最终的可使用数据,供不同的研究模型和用水单位做下一步的使用。
作为一种实施例,一种基于时间序列用水数据的用户特征构造方法,包括以下步骤:
S1、每月定期将时间序列用水数据录入服务器MySQL数据库,并将该用水数据按月保存,形成用水数据表;用水数据表包括必需字段和自由字段;其中必需字段是单表必须具有的字段内容,自由字段可以是其他的额外备注信息;必需字段内容为:账号ID(id)、用户地址(address)和当月实际用水量(usage_amount);自由字段内容为用水单位名称(name)、用户原始标签(usage_type)、用水单价(price)和当前月份(month)。其含义见下表1和下表2:
表1用水数据表必需字段表
必需字段 | |
id | 用户唯一ID |
address | 用户地址 |
usage_amount | 该月实际用水量(吨) |
表2用水数据表自由字段表
自由字段 | |
name | 用水单位名称 |
usage_type | 用户原始标签 |
price | 用水单价 |
month | 当前月份 |
S2、对原始一维用水数据X进行数据清洗;
S2.1、缺失值补偿:将数据为空处的数据取-1作为标注;
S2.2、异常值替换:对单月的数据做异常值判定,若超过正常值范围,则将异常值调整为正常值的边界值;
S2.3、对负值数据统一取反,并判定该取反后的数据是否为异常值,若为异常值,则执行步骤S2.2中的异常值替换;
S3、原始数据经过缺失值和异常值处理后,需要对一维用水数据进行转置处理,原始数据的存储方式可以是单个txt格式文件或者csv格式文件,但最终需要将数据保存到MySQL数据以做后期的转置处理;对单月一位的稀疏用水数据进行转置,建立至少6个月的单月用水量数据表;转置后的数据对象为单个用户在指定月份内的用水量;原始数据字段(仅展示必需字段的部分)如下表3:
表3原始数据字段表
id | 用户唯一ID |
address | 用户地址 |
usage_amount | 该月实际用水量(吨) |
原始数据的衡量维度为月份,经过转置处理后的表格字段如下表4(仅展示必需字段的部分):
表4经过转置处理后的表格字段表
id | 用户唯一ID |
name | 用户标识 |
usage_type | 用水类型 |
usage01 | 1月用水量 |
usage02 | 2月用水量 |
usage03 | 3月用水量 |
usage04 | 4月用水量 |
usage05 | 5月用水量 |
usage06 | 6月用水量 |
… |
上式(1)至式(3)中,为样本常规特征的均值,i为月份数,n为月份总数,Xi为第i个月的用水量,S为样本常规特征的均一化标准差;F为样本常规特征的均一化波动比;Max(Xi)为第i个月用水量的最大值,Min(Xi)为第i个月用水量的最小值;样本常规特征的均值均一化标准差S和均一化波动比F的定义方式如下表5:
表5样本常规特征的定义表
转置后的数据生成的特征较少,可以通过特征工程生成新的有效特征。生成的特征需涵盖均值,均一化方差,中位数,最大值,最小值,均一化波动比。所有参与计算的数据要求为非0,如果某个用户的所有单月用水数据均为0值,则均值,均一化方差,中位数,最大值,最小值取0值,均一化波动比取1。
S5、构造用水特征;
S6、通过高德地图api转换物理地址信息为经纬度信息,并均一化映射到当前用水区。
步骤S2.2具体包括以下步骤:
S2.2.1、处理数据得到如图1所示的数据主体,数据主体包括核心数据和主体数据:对单月体量为N的数据X,计算其中位数得到Xmid,计算其上四分位线为下四分位线为介于上四分位线和下四分位线之间的数据为核心数据,核心部分的数据占整体数据的1/2;还取上下四分位线外1.5IQR部分的数据作为主体数据;主体数据的上限为 主体数据的下限为S2.2.2、筛选用水数据的正常值,将超过正常值的数据统一调整为正常值的边界值:将超过主体数据上限的数据统一重置为将低于主体数据的下限的数据统一重置为
步骤S4中样本常规特征均为除去单月用量为0后有效值的计算值。
步骤S5中零用水量月份数、当前用水均值、指定用水类型均值差和用水量波动比。
Claims (7)
1.一种基于时间序列用水数据的用户特征构造方法,其特征在于,包括以下步骤:
S1、定期将时间序列用水数据录入服务器数据库,并将该用水数据定期保存,形成用水数据表;
S2、对原始一维用水数据X进行数据清洗;
S2.1、缺失值补偿:将数据为空处的数据取-1作为标注;
S2.2、异常值替换:对单月的数据做异常值判定,若超过正常值范围,则将异常值调整为正常值的边界值;
S2.3、对负值数据统一取反,并判定该取反后的数据是否为异常值,若为异常值,则执行步骤S2.2中的异常值替换;
S3、对所有单月的稀疏用水数据进行转置,建立单月用水量数据表;转置后的数据对象为单个用户在指定月份内的用水量;
上式(1)至式(3)中,为样本常规特征的均值,i为月份数,n为月份总数,Xi为第i个月的用水量,S为样本常规特征的均一化标准差;F为样本常规特征的均一化波动比;Max(Xi)为第i个月用水量的最大值,Min(Xi)为第i个月用水量的最小值;
S5、构造用水特征;
S6、转换物理地址信息为经纬度信息,并均一化映射到当前用水区。
2.根据权利要求1所述基于时间序列用水数据的用户特征构造方法,其特征在于:步骤S1中将时间序列用水数据录入服务器数据库的周期及保存该数据的周期均为一个月。
3.根据权利要求1所述基于时间序列用水数据的用户特征构造方法,其特征在于:步骤S1中用水数据表包括必需字段和自由字段;必需字段内容为:账号ID、用户地址和实际用水量;自由字段内容为用水单位名称、用户原始标签、用水单价和当前月份。
5.根据权利要求1所述基于时间序列用水数据的用户特征构造方法,其特征在于:步骤S4中样本常规特征均为除去单月用量为0后有效值的计算值。
6.根据权利要求1所述基于时间序列用水数据的用户特征构造方法,其特征在于:步骤S4中所有参与式(1)至式(3)中计算的数据均非零,若所有单月用水量均为0,则样本常规特征的均值、样本常规特征的均一化标准差、样本常规特征的中位数M、月用水量的最大值、月用水量最小值均取0,均一化波动比取1。
7.根据权利要求1所述基于时间序列用水数据的用户特征构造方法,其特征在于:步骤S5中零用水量月份数、当前用水均值、指定用水类型均值差和用水量波动比。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011434685.2A CN112434021A (zh) | 2020-12-10 | 2020-12-10 | 一种基于时间序列用水数据的用户特征构造方法 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011434685.2A CN112434021A (zh) | 2020-12-10 | 2020-12-10 | 一种基于时间序列用水数据的用户特征构造方法 |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112434021A true CN112434021A (zh) | 2021-03-02 |
Family
ID=74690989
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011434685.2A Pending CN112434021A (zh) | 2020-12-10 | 2020-12-10 | 一种基于时间序列用水数据的用户特征构造方法 |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112434021A (zh) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130324444A1 (en) * | 2012-06-01 | 2013-12-05 | Timothy Lesko | System and method for delivering treatment fluid |
CN109902120A (zh) * | 2019-01-16 | 2019-06-18 | 中山大学 | 一种面向栅格文本降水数据的可视化分析方法 |
CN111291076A (zh) * | 2020-01-16 | 2020-06-16 | 江苏禹治流域管理技术研究院有限公司 | 基于大数据的异常用水监测报警系统及其构建方法 |
CN111415192A (zh) * | 2020-02-27 | 2020-07-14 | 重庆森鑫炬科技有限公司 | 基于大数据的用户用水性质预测方法 |
-
2020
- 2020-12-10 CN CN202011434685.2A patent/CN112434021A/zh active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20130324444A1 (en) * | 2012-06-01 | 2013-12-05 | Timothy Lesko | System and method for delivering treatment fluid |
CN109902120A (zh) * | 2019-01-16 | 2019-06-18 | 中山大学 | 一种面向栅格文本降水数据的可视化分析方法 |
CN111291076A (zh) * | 2020-01-16 | 2020-06-16 | 江苏禹治流域管理技术研究院有限公司 | 基于大数据的异常用水监测报警系统及其构建方法 |
CN111415192A (zh) * | 2020-02-27 | 2020-07-14 | 重庆森鑫炬科技有限公司 | 基于大数据的用户用水性质预测方法 |
Non-Patent Citations (1)
Title |
---|
钟方雷等: "面向需水管理的居民用水行为研究进展", 《水科学进展》 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Mishra et al. | Seasonality in tourism and forecasting foreign tourist arrivals in India | |
Kumar et al. | Evaluation of technical efficiency in Indian sugar industry: An application of full cumulative data envelopment analysis | |
Vítová et al. | Determinants of tourism flows in small island developing states (SIDS) | |
Dyakova et al. | Bulgarian stock market relative predictability: BSE-Sofia stocks and South East European markets | |
Xu et al. | Prediction of extremal expectile based on regression models with heteroscedastic extremes | |
Strumickas et al. | Research of management accounting changes in Lithuanian business organizations | |
Bondarenko et al. | Analysis of the performance efficiency of the largest corporations in Russia | |
Sukrianingrum et al. | The effect of systematic risk and unsystematic risk on expected return of optimal portfolio | |
CN112434021A (zh) | 一种基于时间序列用水数据的用户特征构造方法 | |
CN112330030A (zh) | 业扩物资需求预测系统及方法 | |
Tolikas et al. | The distribution of the extreme daily share returns in the Athens stock exchange | |
Trinh | Economic policy uncertainty and corporate investment efficiency: evidence from Australian energy companies | |
Chupryna et al. | Substantiation and Development of Comprehensive Measures to Improve the Activities of Construction Companies | |
Sriyono et al. | Managerial Innovations in Structure Capital and Important Decisions in Determining the Profit Management of Plantation Company: Empirical Evidence in ASEAN Countries | |
Cho et al. | An assessment of inflation targeting in a quantitative monetary business cycle framework: evidence from four early adopters | |
Puspita et al. | The Role of Population, Inflation and Economic Growth of Local Tax Revenues in East Java Province, Indonesia | |
Malau et al. | The Effect Of Labor Force, Investment, Labor Absorption On Gross Regional Domestic Products Of North Sumatra Province Agriculture | |
Li | Efficiency and Potential of China’s Timber and Wood Products Exports to RCEP Members: A Stochastic Frontier Gravity Analysis | |
Samanta et al. | Measuring Market Risk-An Application of Value-at-risk to Select Government Bonds in India | |
CN114493296A (zh) | 用于评价乡村发展水平的电力指数的获取方法及装置 | |
Pysar | Methodology of assessing investment attractiveness of Ukrainian gas producers | |
Verikios et al. | Microeconomic reform and income distribution: the case of Australian ports and rail freight | |
Zeng et al. | Comprehensive Evaluation of Sustainable Development of Real Estate Industry Based on Information Entropy Weight Method | |
Huang et al. | Research on Relationship Between Rural Residents' Income and Electricity Consumption Features | |
Marsiati et al. | THE INFLUENCE OF GROWTH OPPORTUNITIES, CAPITAL STRUCTURE, PROFITABILITY, AND DIVIDEND POLICY ON FIRM VALUE (In Pharmaceutical Companies Listed on the Indonesia Stock Exchange 2014-2022) |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
AD01 | Patent right deemed abandoned | ||
AD01 | Patent right deemed abandoned |
Effective date of abandoning: 20221111 |