首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

一个sql生成hive日期维度表

set hive.execution.engine=tez; with dates as ( select date_add("2010-01-01", a.pos) as d from (select posexplode(split(repeat("o", datediff("2030-12-31", "2010-01-01")), "o"))) a ) insert overwrite table dim.dim_date select     d   , date_format(d, 'yyyyMMdd000000') as to_pt            -- 指定分区格式   , date_format(d, 'yyyyMMdd')       as date_yyyymmdd   , trunc(d,'MM')                    as month_first_day    , last_day(d)                      as month_last_day   , date_format(last_day(d),'yyyyMMdd000000')   as month_last_pt   , date_format(d, 'yyyyMM')  as month_yyyymm   , date_format(d, 'yyyy-MM') as month_yyyy_mm   , month(d) as month   , date_format(d, 'u') as week   , date_format(d, 'E') as week_long      , weekofyear(d) as week_of_year   , year(d) as year   , floor(substr(d,6,2)/3.1)*3+1 as quarter   -- , concat_group('"',date_format(d, 'yyyyMM'),'"') as date_yyyymmdd_list   -- 低版本hive group_concat 不可用 from dates

03

用R语言写个贝叶斯模型 预测我的妻子是否怀孕

在2015年的二月21日,我的妻子已经33天没有来月经了,她怀孕了,这真是天大的好消息! 通常月经的周期是大约一个月,如果你们夫妇打算怀孕,那么月经没来或许是一个好消息。但是33天,这还无法确定这是一个消失的月经周期,或许只是来晚了,那么它是否真的是一个好消息? 为了能获得结论我建立了一个简单的贝叶斯模型,基于这个模型,可以根据你当前距离上一次经期的天数、你历史经期的起点数据来计算在当前经期周期中你怀孕的可能性。在此篇文章中我将阐述我所使用的数据、先验思想、模型假设以及如何使用重点抽样法获取数据并用R语言

09
领券