在本文中,我们将带你了解AddBusinessDays和GetBusinessDays在这篇文章中,同时我们还将给您一些技巧,以帮助您实现更有效的ABAPBusinessswitc和businessf
在本文中,我们将带你了解AddBusinessDays和GetBusinessDays在这篇文章中,同时我们还将给您一些技巧,以帮助您实现更有效的ABAP Business switc 和 business function 简介、Adobe LiveCycle Designer for SAP Business ByDesign、Au business、Build machine learning-powered business intelligence analyses using Amazon QuickSight。
本文目录一览:- AddBusinessDays和GetBusinessDays
- ABAP Business switc 和 business function 简介
- Adobe LiveCycle Designer for SAP Business ByDesign
- Au business
- Build machine learning-powered business intelligence analyses using Amazon QuickSight
AddBusinessDays和GetBusinessDays
我需要找到2个优雅的完整实现
public static DateTime AddBusinessDays(this DateTime date, int days){ // code here}andpublic static int GetBusinessDays(this DateTime start, DateTime end){ // code here}
最好是O(1)(无循环)。
编辑:工作日是指工作日(星期一,星期二,星期三,星期四,星期五)。没有假期,只有周末除外。
我已经有了一些看起来可行的丑陋解决方案,但是我想知道是否有优雅的方法可以做到这一点。谢谢
这是我到目前为止所写的。它在所有情况下均有效,并且也具有负面效果。仍然需要GetBusinessDays实施
public static DateTime AddBusinessDays(this DateTime startDate, int businessDays){ int direction = Math.Sign(businessDays); if(direction == 1) { if(startDate.DayOfWeek == DayOfWeek.Saturday) { startDate = startDate.AddDays(2); businessDays = businessDays - 1; } else if(startDate.DayOfWeek == DayOfWeek.Sunday) { startDate = startDate.AddDays(1); businessDays = businessDays - 1; } } else { if(startDate.DayOfWeek == DayOfWeek.Saturday) { startDate = startDate.AddDays(-1); businessDays = businessDays + 1; } else if(startDate.DayOfWeek == DayOfWeek.Sunday) { startDate = startDate.AddDays(-2); businessDays = businessDays + 1; } } int initialDayOfWeek = (int)startDate.DayOfWeek; int weeksBase = Math.Abs(businessDays / 5); int addDays = Math.Abs(businessDays % 5); if((direction == 1 && addDays + initialDayOfWeek > 5) || (direction == -1 && addDays >= initialDayOfWeek)) { addDays += 2; } int totalDays = (weeksBase * 7) + addDays; return startDate.AddDays(totalDays * direction);}
答案1
小编典典您的第一个功能的最新尝试:
public static DateTime AddBusinessDays(DateTime date, int days){ if (days < 0) { throw new ArgumentException("days cannot be negative", "days"); } if (days == 0) return date; if (date.DayOfWeek == DayOfWeek.Saturday) { date = date.AddDays(2); days -= 1; } else if (date.DayOfWeek == DayOfWeek.Sunday) { date = date.AddDays(1); days -= 1; } date = date.AddDays(days / 5 * 7); int extraDays = days % 5; if ((int)date.DayOfWeek + extraDays > 5) { extraDays += 2; } return date.AddDays(extraDays);}
第二个函数GetBusinessDays可以实现如下:
public static int GetBusinessDays(DateTime start, DateTime end){ if (start.DayOfWeek == DayOfWeek.Saturday) { start = start.AddDays(2); } else if (start.DayOfWeek == DayOfWeek.Sunday) { start = start.AddDays(1); } if (end.DayOfWeek == DayOfWeek.Saturday) { end = end.AddDays(-1); } else if (end.DayOfWeek == DayOfWeek.Sunday) { end = end.AddDays(-2); } int diff = (int)end.Subtract(start).TotalDays; int result = diff / 7 * 5 + diff % 7; if (end.DayOfWeek < start.DayOfWeek) { return result - 2; } else{ return result; }}
ABAP Business switc 和 business function 简介
Created by Jerry Wang, last modified on Jun 28, 2014
- 创建一个 package,该 package 里包含的 ABAP objects 将会受到 business function 的控制。比如新建一个 customizing activity 并将其存储在该 package 下,则 business function 打开时,该 activity 可见,否则不可见。
- tcode SFW1, 创建一个新的 business switch:
将 step1 创建的 package assign 给该 business switch。
此处还需要将该 switch assign 给 business function,因此需要在下一步骤新建一个 business function
- tcode SFW2,创建一个新的 business function, 类型选择为 G:
将 step2 创建的 business switch assign 进来:
回到 SFW1 里查看 switch 状态为 off:
4. 使用 ABAP class CL_ABAP_SWITCH 在代码里检查 switch 状态.
F 代表 off
使用 tcode SFW5 通过激活 business function 的方式来激活 switch.
点击 checkbox 来激活 business function:
激活以后:
再回到 SFW1 检查 status 已经变成 on:
如果有 ABAP class 存储在被 switch 控制的 package 内,即使 switch 关掉,该 ABAP 也能够被正常调用。
但是如果一个 BAdI implementation 存储在被 switch 控制的 package 内,switch 就可以控制该 BAdI implementation runtime 时是否被调用:
即使 Implementation is active 的 checkbox 勾上,但是当 switch 关掉时,该 BAdI implementation 仍然是处于 deactivate 状态的。
本文同步分享在 博客 “汪子熙”(CSDN)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与 “OSC 源创计划”,欢迎正在阅读的你也加入,一起分享。
Adobe LiveCycle Designer for SAP Business ByDesign
1. 登陆到你的ByD系统
2.到系统的下载中心并且打开“安装所有系统的附加软件”,路径是“应用和用户管理”->“业务灵活性”->“下载中心“->“安装所有系统的附加软件”
3.选择安装下面两个软件
4.找到你的表单模板进行下载
5.下载
6.然后解压
7.打开这个的前提时你要装
这个软件
8.打开文件来到这个界面
9.选择数据源
右键选择 new date connection
10.选择xml 文件
最后点击OK 就好了
这里提供一个学习的网站:
http://help.adobe.com/en_US/livecycle/9.0/samples/lc_sample_selfpaced.html.
Au business
http://www.business.auckland.ac.nz/people/t-arthanari
http://www.business.auckland.ac.nz/people/f-beltran
http://www.business.auckland.ac.nz/people/jh-chan
http://www.business.auckland.ac.nz/people/aeh-chua
http://www.business.auckland.ac.nz/people/u-dantin
http://www.business.auckland.ac.nz/people/a-eberhard
http://www.business.auckland.ac.nz/people/b-gallupe
http://www.business.auckland.ac.nz/people/l-gardner
http://www.business.auckland.ac.nz/people/l-janczewski
http://www.business.auckland.ac.nz/people/jyt-lee
http://www.business.auckland.ac.nz/people/akt-li
http://www.business.auckland.ac.nz/people/c-mail
http://www.business.auckland.ac.nz/people/r-mogre
http://www.business.auckland.ac.nz/people/g-murphy
http://www.business.auckland.ac.nz/people/m-myers
http://www.business.auckland.ac.nz/people/l-oliver
http://www.business.auckland.ac.nz/people/t-olsen
http://www.business.auckland.ac.nz/people/v-pavlov
http://www.business.auckland.ac.nz/people/a-peiris
http://www.business.auckland.ac.nz/people/g-peko
http://www.business.auckland.ac.nz/people/l-robinson
http://www.business.auckland.ac.nz/people/d-sheridan
http://www.business.auckland.ac.nz/people/k-singh
http://www.business.auckland.ac.nz/people/a-srinivasan
http://www.business.auckland.ac.nz/people/d-sundaram
http://www.business.auckland.ac.nz/people/k-tilvawala
http://www.business.auckland.ac.nz/people/r-tiong
http://www.business.auckland.ac.nz/people/a-tripathi
http://www.business.auckland.ac.nz/people/d-white
http://www.business.auckland.ac.nz/people/onathan-ye
http://www.business.auckland.ac.nz/people/d-alexander
http://www.business.auckland.ac.nz/people/c-ansley
http://www.business.auckland.ac.nz/people/d-askarany
http://www.business.auckland.ac.nz/people/aber071
http://www.business.auckland.ac.nz/people/h-berkman
http://www.business.auckland.ac.nz/people/s-narayan
http://www.business.auckland.ac.nz/people/s-cahan
http://www.business.auckland.ac.nz/people/j-carneiro
http://www.business.auckland.ac.nz/people/li-chen
http://www.business.auckland.ac.nz/people/c-chen
http://www.business.auckland.ac.nz/people/c-chow
http://www.business.auckland.ac.nz/people/ch-clarke
http://www.business.auckland.ac.nz/people/l-eljahel
http://www.business.auckland.ac.nz/people/d-emanuel
http://www.business.auckland.ac.nz/people/p-geertsema
http://www.business.auckland.ac.nz/people/j-harrison
http://www.business.auckland.ac.nz/people/d-hay
http://www.business.auckland.ac.nz/people/d-jeter
http://www.business.auckland.ac.nz/people/r-knechel
http://www.business.auckland.ac.nz/people/tan-lee
http://www.business.auckland.ac.nz/people/byong-lee
http://www.business.auckland.ac.nz/people/sabella-li
http://www.business.auckland.ac.nz/people/zli136
http://www.business.auckland.ac.nz/people/tk-li
http://www.business.auckland.ac.nz/people/s-loh
http://www.business.auckland.ac.nz/people/helen-lu
http://www.business.auckland.ac.nz/people/d-margaritis
http://www.business.auckland.ac.nz/people/a-marsden
http://www.business.auckland.ac.nz/people/d-mayes
http://www.business.auckland.ac.nz/people/h-newall
http://www.business.auckland.ac.nz/people/f-ng
http://www.business.auckland.ac.nz/people/w-ogrady
http://www.business.auckland.ac.nz/people/spar681
http://www.business.auckland.ac.nz/people/apri524
http://www.business.auckland.ac.nz/people/martin-putterill
http://www.business.auckland.ac.nz/people/g-rechtschaffen
http://www.business.auckland.ac.nz/people/p-rouse
http://www.business.auckland.ac.nz/people/b-spicer
http://www.business.auckland.ac.nz/people/sione-taufa
http://www.business.auckland.ac.nz/people/ftem041
http://www.business.auckland.ac.nz/people/g-treasure
http://www.business.auckland.ac.nz/people/y-wang
http://www.business.auckland.ac.nz/people/karis-wang
http://www.business.auckland.ac.nz/people/r-wilton
http://www.business.auckland.ac.nz/people/n-wong
http://www.business.auckland.ac.nz/people/mben003
http://www.business.auckland.ac.nz/people/e-biddle
http://www.business.auckland.ac.nz/people/t-bohne
http://www.business.auckland.ac.nz/people/j-bonny
http://www.business.auckland.ac.nz/people/p-boxall
http://www.business.auckland.ac.nz/people/b-burmester
http://www.business.auckland.ac.nz/people/l-callagher
http://www.business.auckland.ac.nz/people/b-carroll
http://www.business.auckland.ac.nz/people/m-cikaliuk
http://www.business.auckland.ac.nz/people/h-nicholson
http://www.business.auckland.ac.nz/people/l-erakovic
http://www.business.auckland.ac.nz/people/j-grabowski
http://www.business.auckland.ac.nz/people/nham161
http://www.business.auckland.ac.nz/people/n-haworth
http://www.business.auckland.ac.nz/people/c-houkamau
http://www.business.auckland.ac.nz/people/k-husted
http://www.business.auckland.ac.nz/people/a-hutchison
http://www.business.auckland.ac.nz/people/k-inkson
http://www.business.auckland.ac.nz/people/onathan-king
http://www.business.auckland.ac.nz/people/ra-mcdonald
http://www.business.auckland.ac.nz/people/r-mcnaughton
http://www.business.auckland.ac.nz/people/s-michailova
http://www.business.auckland.ac.nz/people/p-mulla
http://www.business.auckland.ac.nz/people/andrew-patterson
http://www.business.auckland.ac.nz/people/b-plester
http://www.business.auckland.ac.nz/people/k-whittaker
http://www.business.auckland.ac.nz/people/d-shepherd
http://www.business.auckland.ac.nz/people/f-siedlok
http://www.business.auckland.ac.nz/people/p-smith
http://www.business.auckland.ac.nz/people/c-spiller
http://www.business.auckland.ac.nz/people/c-stringer
http://www.business.auckland.ac.nz/people/s-sum
http://www.business.auckland.ac.nz/people/m-tibbles
http://www.business.auckland.ac.nz/people/h-whittaker
http://www.business.auckland.ac.nz/people/r-wolfgramm
http://www.business.auckland.ac.nz/people/p-woodfield
http://www.business.auckland.ac.nz/people/cr-woods
http://www.business.auckland.ac.nz/people/p-zamborsky
http://www.business.auckland.ac.nz/people/t-agee
http://www.business.auckland.ac.nz/people/c-bentham
http://www.business.auckland.ac.nz/people/m-bowker
http://www.business.auckland.ac.nz/people/r-brodie
http://www.business.auckland.ac.nz/people/r-brookes
http://www.business.auckland.ac.nz/people/mbuc022
http://www.business.auckland.ac.nz/people/d-conroy
http://www.business.auckland.ac.nz/people/p-danaher
http://www.business.auckland.ac.nz/people/y-deng
http://www.business.auckland.ac.nz/people/j-fehrer
http://www.business.auckland.ac.nz/people/k-fernandez
http://www.business.auckland.ac.nz/people/l-hollebeek
http://www.business.auckland.ac.nz/people/m-hoong
http://www.business.auckland.ac.nz/people/m-hunting
http://www.business.auckland.ac.nz/people/su-jung
http://www.business.auckland.ac.nz/people/b-juric
http://www.business.auckland.ac.nz/people/b-lang
http://www.business.auckland.ac.nz/people/msw-lee
http://www.business.auckland.ac.nz/people/l-liu
http://www.business.auckland.ac.nz/people/k-dutton
http://www.business.auckland.ac.nz/people/l-sajtos
http://www.business.auckland.ac.nz/people/h-sima
http://www.business.auckland.ac.nz/people/s-bennett
http://www.business.auckland.ac.nz/people/rg-starr
http://www.business.auckland.ac.nz/people/c-windahl
http://www.business.auckland.ac.nz/people/mb-smith
http://www.business.auckland.ac.nz/people/m-chen
http://www.business.auckland.ac.nz/people/p-cook
http://www.business.auckland.ac.nz/people/j-dsouza
http://www.business.auckland.ac.nz/people/c-elliffe
http://www.business.auckland.ac.nz/people/j-farrar
http://www.business.auckland.ac.nz/people/m-gedye
http://www.business.auckland.ac.nz/people/g-gunasekara
http://www.business.auckland.ac.nz/people/y-hua
http://www.business.auckland.ac.nz/people/b-hutchinson
http://www.business.auckland.ac.nz/people/m-josling
http://www.business.auckland.ac.nz/people/p-kam
http://www.business.auckland.ac.nz/people/m-keating
http://www.business.auckland.ac.nz/people/r-merkin
http://www.business.auckland.ac.nz/people/l-miller
http://www.business.auckland.ac.nz/people/o-morgan
http://www.business.auckland.ac.nz/people/c-nicoll
http://www.business.auckland.ac.nz/people/cnoo001
http://www.business.auckland.ac.nz/people/j-ren
http://www.business.auckland.ac.nz/people/am-sharp
http://www.business.auckland.ac.nz/people/a-sims
http://www.business.auckland.ac.nz/people/m-benito
http://www.business.auckland.ac.nz/people/z-dong
http://www.business.auckland.ac.nz/people/e-douglas
http://www.business.auckland.ac.nz/people/o-filippova
http://www.business.auckland.ac.nz/people/n-garrad
http://www.business.auckland.ac.nz/people/d-levy
http://www.business.auckland.ac.nz/people/l-murphy
http://www.business.auckland.ac.nz/people/m-rehm
http://www.business.auckland.ac.nz/people/james-young
http://www.business.auckland.ac.nz/people/m-anstis
http://www.business.auckland.ac.nz/people/r-aoki
http://www.business.auckland.ac.nz/people/d-bandyopadhyay
http://www.business.auckland.ac.nz/people/m-berka
http://www.business.auckland.ac.nz/people/a-chaudhuri
http://www.business.auckland.ac.nz/people/z-chen
http://www.business.auckland.ac.nz/people/m-dale
http://www.business.auckland.ac.nz/people/a-endres
http://www.business.auckland.ac.nz/people/p-gai
http://www.business.auckland.ac.nz/people/d-grechyna
http://www.business.auckland.ac.nz/people/r-mcgrevy
http://www.business.auckland.ac.nz/people/m-greer
http://www.business.auckland.ac.nz/people/a-grimes
http://www.business.auckland.ac.nz/people/t-hazledine
http://www.business.auckland.ac.nz/people/j-hillas
http://www.business.auckland.ac.nz/people/b-hool
http://www.business.auckland.ac.nz/people/kjan020
http://www.business.auckland.ac.nz/people/g-jayasuriya
http://www.business.auckland.ac.nz/people/a-lazonby
http://www.business.auckland.ac.nz/people/llee107
http://www.business.auckland.ac.nz/people/joe-li
http://www.business.auckland.ac.nz/people/clil010
http://www.business.auckland.ac.nz/people/s-lippert
http://www.business.auckland.ac.nz/people/michael-littlewood
http://www.business.auckland.ac.nz/people/t-marsters
http://www.business.auckland.ac.nz/people/j-panzar
http://www.business.auckland.ac.nz/people/pcb-phillips
http://www.business.auckland.ac.nz/people/s-poletti
http://www.business.auckland.ac.nz/people/alisha-rodrigues
http://www.business.auckland.ac.nz/people/a-rogers
http://www.business.auckland.ac.nz/people/bsal016
http://www.business.auckland.ac.nz/people/e-sbai
http://www.business.auckland.ac.nz/people/r-scollay
http://www.business.auckland.ac.nz/people/b-sharp
http://www.business.auckland.ac.nz/people/j-steele
http://www.business.auckland.ac.nz/people/s-stjohn
http://www.business.auckland.ac.nz/people/ak-suomalainen
http://www.business.auckland.ac.nz/people/saing-te
http://www.business.auckland.ac.nz/people/swan174
http://www.business.auckland.ac.nz/people/sy-wong
http://www.business.auckland.ac.nz/people/lyan111
Build machine learning-powered business intelligence analyses using Amazon QuickSight
https://amazonaws-china.com/blogs/big-data/build-machine-learning-powered-business-intelligence-analyses-using-amazon-quicksight/
Imagine you can see the future—to know how many customers will order your product months ahead of time so you can make adequate provisions, or to know how many of your employees will leave your organization several months in advance so you can take preemptive actions to encourage staff retention. For an organization that sees the future, the possibilities are limitless. Machine learning (ML) makes it possible to predict the future with a higher degree of accuracy.
Amazon SageMaker provides every developer and data scientist the ability to build, train, and deploy ML models quickly, but for business users who usually work on creating business intelligence dashboards and reports rather than ML models, Amazon QuickSight is the service of choice. With Amazon QuickSight, you can still use ML to forecast the future. This post goes through how to create business intelligence analyses that use ML to forecast future data points and detect anomalies in data, with no technical expertise or ML experience needed.
Overview of solution
Amazon QuickSight ML Insights uses AWS-proven ML and natural language capabilities to help you gain deeper insights from your data. These powerful, out-of-the-box features make it easy to discover hidden trends and outliers, identify key business drivers, and perform powerful what-if analysis and forecasting with no technical or ML experience. You can use ML insights in sales reporting, web analytics, financial planning, and more. You can detect insights buried in aggregates, perform interactive what-if analysis, and discover what activities you need to meet business goals.
This post imports data from Amazon S3 into Amazon QuickSight and creates ML-powered analyses with the imported data. The following diagram illustrates this architecture.
Walkthrough
In this walkthrough, you create an Amazon QuickSight analysis that contains ML-powered visuals that forecast the future demand for taxis in New York City. You also generate ML-powered insights to detect anomalies in your data. This post uses the New York City Taxi and Limousine Commission (TLC) Trip Record Data on the Registry of Open Data on AWS.
The walkthrough includes the following steps:
- Set up and import data into Amazon QuickSight
- Create an ML-powered visual to forecast the future demand for taxis
- Generate an ML-powered insight to detect anomalies in the data set
Prerequisites
For this walkthrough, you should have the following prerequisites:
- An AWS account
- Amazon Quicksight Enterprise edition
- Basic knowledge of AWS
Setting up and importing data into Amazon QuickSight
Set up Amazon Quicksight as an individual user. Complete the following steps:
- On the AWS Management Console, in the Region list, select US East (N. Virginia) or any Region of your choice that Amazon QuickSight
- Under Analytics, for Services, choose Amazon QuickSight.If you already have an existing Amazon QuickSight account, make sure it is the Enterprise edition; if it is not, upgrade to Enterprise edition. For more information, see Upgrading your Amazon QuickSight Subscription from Standard Edition to Enterprise Edition.If you do not have an existing Amazon QuickSight account, proceed with the setup and make sure you choose Enterprise Edition when setting up the account. For more information, see Setup a Free Standalone User Account in Amazon QuickSight.After you complete the setup, a Welcome Wizard screen appears.
- Choose Next on each of the Welcome Wizard screens.
- Choose Get Started.
Before you import the data set, make sure that you have at least 3GB of SPICE capacity. For more information, see Managing SPICE Capacity.
Importing the NYC Taxi data set into Amazon QuickSight
The NYC Taxi data set is in an S3 bucket. To import S3 data into Amazon QuickSight, use a manifest file. For more information, see Supported Formats for Amazon S3 Manifest Files. To import your data, complete the following steps:
- In a new text file, copy and paste the following code:
"fileLocations": [ { "URIs": [ "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-01.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-02.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-03.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-04.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-05.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-06.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-07.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-08.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-09.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-10.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-11.csv", "https://nyc-tlc.s3.amazonaws.com/trip data/green_tripdata_2018-12.csv" ] } ], "globalUploadSettings": { "textqualifier": "\"" } }
- Save the text file as
nyc-taxi.json
. - On the Amazon QuickSight console, choose New analysis.
- Choose New data set.
- For data source, choose S3.
- Under New S3 data source, for Data source name, enter a name of your choice.
- For Upload a manifest file field, select Upload.
- Choose the
nyc-taxi.json
file you created earlier. - Choose Connect.
The S3 bucket this post uses is a public bucket that contains a public data set and open to the public. When using S3 buckets in your account with Amazon QuickSight, it is highly recommended that the buckets are not open to the public; you need to configure authentication to access your S3 bucket from Amazon QuickSight. For more information about troubleshooting, see I Can’t Connect to Amazon S3.After you choose Connect, the Finish data set creation screen appears. - Choose Visualize.
- Wait for the import to complete.
You can see the progress on the top right corner of the screen. When the import is complete, the result shows the number of rows imported successfully and the number of rows skipped.
Creating an ML-powered visual
After you import the data set into Amazon QuickSight SPICE, you can start creating analyses and visuals. Your goal is to create an ML-powered visual to forecast the future demand for taxis. For more information, see Forecasting and Creating What-If Scenarios with Amazon Quicksight.
To create your visual, complete the following steps:
- From the Data source details pop screen, choose Visualize.
- From the field list, select
Lpep_pickup_datetime
. - Under Visual types, select the first visual.Amazon QuickSight automatically uses the best visual based on the number and data type of fields you selected. From your selection, Amazon Quicksight displays a line chart visual.
From the preceding graph, you can see that the bulk of your data clusters are around December 31, 2017, to January 1, 2019, for the
Lpep_pickup_datetime
field. There are a few data points with date ranges up to June 2080. These values are incorrect and can impact your ML forecasts.To clean up your data set, filter out the incorrect data using the data in theLpep_pickup_datetime
. This post only uses data in whichLpep_pickup_datetime
falls between January 1, 2018, and December 18, 2018, because there is a more consistent amount of data within this date range. - Use the filter menu to create a filter using the
Lpep_pickup_datetime
- Under Filter type, choose Time range and Between.
- For Start date, enter
2018-01-01 00:00
. - Select Include start date.
- For End date, enter
2018-12-18 00:00
. - Select Include end date.
- Choose Apply.
The line chart should now contain only data with Lpep_pickup_datetime
from January 1, 2018, and December 18, 2018. You can now add the forecast for the next 31 days to the line chart visual.
Adding the forecast to your visual
To add your forecast, complete the following steps:
- On the visual, choose the arrow.
- From the drop-down menu, choose Add forecast.
- Under Forecast properties, for Forecast length, for Periods forward, enter
31
. - For Periods backwards, enter
0
. - For Prediction interval, leave at the default value
90
. - For Seasonality, leave at the default selection Automatic.
- Choose Apply.
You now see an orange line on your graph, which is the forecasted pickup quantity per day for the next 31 days after December 18, 2018. You can explore the different dates by hovering your cursor over different points on the forecasted pickup line. For example, hovering your cursor over January 10, 2019, shows that the expected forecasted number of pickups for that day is approximately 22,000. The forecast also provides an upper bound (maximum number of pickups forecasted) of about 26,000 and a lower bound (minimum number of pickups forecasted) of about 18,000.
You can create multiple visuals with forecasts and combine them into a sharable Amazon QuickSight dashboard. For more information, see Working with Dashboards.
Generating an ML-powered insight to detect anomalies
In Amazon QuickSight, you can add insights, autonarratives, and ML-powered anomaly detection to your analyses without ML expertise or knowledge. Amazon QuickSight generates suggested insights and autonarratives automatically, but for ML-powered anomaly detection, you need to perform additional steps. For more information, see Using ML-Powered Anomaly Detection.
This post checks if there are any anomalies in the total fare amount over time from select locations. For example, if the total fare charged for taxi rides is about $1,000 and above from the first pickup location (for example, the airport) for most dates in your data set, an anomaly is when the total fare charged deviates from the standard pattern. Anomalies are not necessarily negative, but rather abnormalities that you can choose to investigate further.
To create an anomaly insight, complete the following steps:
- From the top right corner of the analysis creation screen, click the Add drop-down menu and choose Add insight.
- On the Computation screen, for Computation type, select Anomaly detection.
- Under Fields list, choose the following fields:
fare_amount
lpep_pickup_datetime
PULocationID
- Choose Get started.
- The Configure anomaly detection
- Choose Analyze all combinations of these categories.
- Leave the other settings as their default.You can now perform a contribution analysis and discover how the drop-off location contributed to the anomalies. For more information, see Viewing Top Contributors.
- Under Contribution analysis, choose
DOLocationID
. - Choose Save.
- Choose Run Now.The anomaly detection can take up to 10 minutes to complete. If it is still running after about 10 minutes, your browser may have timed out. Refresh your browser and you should see the anomalies displayed in the visual.
- Choose Explore anomalies.
By default, the anomalies you see are for the last date in your data set. You can explore the anomalies across the entire date range of your data set by choosing SHOW ANOMALIES BY DATE and dragging the slider at the bottom of the visual to display the entire date range from January 1, 2018, to December 30, 2018.
This graph shows that March 21, 2018, has the highest number of anomalies of the fare charged in the entire data set. For example, the total fare amount charged by taxis that picked up passengers from location 74 on March 21, 2018, was 7,181. This is -64% (about 19,728.5) of the total fare charged by taxis for the same pickup location on March 20, 2018. When you explore the anomalies of other pickup locations for that same date, you can see that they all have similar drops in the total fare charged. You can also see the top DOLocationID
contributors to these anomalies.
What happened in New York City on March 21, 2018, to cause this drop? A quick online search reveals that New York City experienced a severe weather condition on March 21, 2018.
Publishing your analyses to a dashboard, sharing the dashboard, and setting up email alerts
You can create additional visuals to your analyses, publish the analyses as a dashboard, and share the dashboard with other users. QuickSight anomaly detection allows you to uncover hidden insights in your data by continuously analyzing billions of data points. You can subscribe to receive alerts to your inbox if an anomaly occurs in your business metrics. The email alert also indicates the factors that contribute to these anomalies. This allows you to act immediately on the business metrics that need attention.
From the QuickSight dashboard, you can configure an anomaly alert to be sent to your email with Severity set to High and above and Direction set to Lower than expected. Also make sure to schedule a data refresh so that the anomaly detection runs on your most recent data. For more information, see Refreshing Data.
Cleaning up
To avoid incurring future charges, you need to cancel your Amazon Quicksight subscription.
Conclusion
This post walked you through how to use ML-powered insights with Amazon QuickSight to forecast future data points, detect anomalies, and derive valuable insights from your data without needing prior experience or knowledge of ML. If you want to do more forecasting without ML experience, check out Amazon Forecast.
If you have questions or suggestions, please leave a comment.
About the Author
Osemeke Isibor is a partner solutions architect at AWS. He works with AWS Partner Network (APN) partners to design secure, highly available, scalable and cost optimized solutions on AWS. He is a science-fiction enthusiast and a fan of anime.
今天的关于AddBusinessDays和GetBusinessDays的分享已经结束,谢谢您的关注,如果想了解更多关于ABAP Business switc 和 business function 简介、Adobe LiveCycle Designer for SAP Business ByDesign、Au business、Build machine learning-powered business intelligence analyses using Amazon QuickSight的相关知识,请在本站进行查询。
本文标签: