我支持一项业务,客户每月支付各种服务费用。我想使用基于客户的机器学习'各种服务的历史使用并预测未来的使用(增加或减少)。
我使用了两个类创建了一个模型,它使用历史月1服务用法和0月用法来预测增长或下降。但我想开始使用所有历史信息,而不仅仅是m-1。
我怎么能这样做?我可以继续添加(M-2,M-3,M-4)列吗?如果是这样的话我将会有数百列。
我是机器学习的新手,我不确定哪种算法对我正在进行的分析类型有用。
以下是我拥有的原始表格的示例:
Customer Name | MonthName | Service | Usage
------------- | ---------------|---------|------
Customer1 | January, 2017 |Service2 |$400
Customer1 | January, 2017 |Service1 |$300
Customer1 | January, 2017 |Service3 |$0
Customer1 | December, 2017 |Service2 |$600
Customer1 | December, 2017 |Service1 |$500
Customer1 | December, 2017 |Service3 |$700
Customer1 | November, 2016 |Service1 |$500
Customer1 | November, 2016 |Service2 |$50
Customer1 | October, 2016 |Service1 |$800
Customer2 | January, 2017 |Service2 |$400
Customer2 | January, 2017 |Service1 |$800
Customer2 | December, 2017 |Service2 |$600
Customer2 | December, 2017 |Service1 |$500
Customer2 | November, 2016 |Service1 |$500
Customer2 | November, 2016 |Service2 |$50
Customer2 | October, 2016 |Service1 |$800
这是我现在用来提出2类模型的表格:
+----------------+------------------+-----------------+-----------------+-----------------+-----------+-----------+-----------+-----------+-------+--------------------+
| Customer Name | MonthName | Service1 - M-1 | Service2 - M-1 | Service3 - M-1 | Usage M-1 | Service1 | Service2 | Service3 | Usage | Usage Decline Flag |
+----------------+------------------+-----------------+-----------------+-----------------+-----------+-----------+-----------+-----------+-------+--------------------+
| Customer1 | October, 2016 | 0 | 0 | 0 | 0 | 800 | | | 800 | 0 |
| Customer1 | November, 2016 | 800 | | | 800 | 500 | 50 | | 550 | 1 |
| Customer1 | December, 2017 | 500 | 50 | | 550 | 500 | 600 | 700 | 1800 | 0 |
| Customer1 | January, 2017 | 500 | 600 | 700 | 1800 | 300 | 400 | 0 | 700 | 1 |
| Customer2 | October, 2016 | 0 | 0 | 0 | 0 | 1600 | | | 1600 | 0 |
| Customer2 | November, 2016 | 1600 | | | 1600 | 500 | 100 | | 600 | 1 |
| Customer2 | December, 2017 | 500 | 100 | | 600 | 500 | 600 | | 1100 | 0 |
| Customer2 | January, 2017 | 500 | 600 | | 1100 | 800 | 400 | | 1200 | 0 |
+----------------+------------------+-----------------+-----------------+-----------------+-----------+-----------+-----------+-----------+-------+--------------------+
答案 0 :(得分:0)
试试这个 - 以下代码可以将行转换为列,以便在前几天进行销售 - https://gallery.cortanaintelligence.com/CustomModule/Generate-Lag-Features-1 - 此代码的源代码 - https://gist.github.com/nk773/a2ed7cd0ce8020647f5e7711f749b3b5