关联规则挖掘(Association rule mining)
我有一个主要是整数值的数据集。 我想在其上应用关联规则挖掘。 我已经看过像Apriori等流行的算法,但是它们都处理具有布尔值的数据,即事务中是否存在项目或者不存在。
是否有一种算法可以让我们除了计数之外还考虑属性的值? (我计划将数据规范化为0到1之间的值)
I have a dataset with mostly integer values. I want to apply association rule mining on it. I have taken a look at the popular algorithms like Apriori, etc. but all of them work on data which have boolean values, i.e., either the item exists in the transaction or doesn't.
Is there an algorithm which lets us account for values of the attributes in addition to their counts? (I plan to normalize the data to have values between 0 and 1)
原文:https://stackoverflow.com/questions/28759325
最满意答案
从
DATE
值中提取年份,然后使用字符串连接来创建新日期。DECLARE @year CHAR(4) = DATEPART(YEAR, @date) SELECT @year + '-01-01' AS [start year], @year + '-12-31' AS [end year]
如果他们全都为零,则不需要包含时间。
如果您希望将它们作为实际
date
或datetime
类型,请使用CAST
或CONVERT
SELECT CONVERT(DATE, @year + '-01-01') AS [start year], CONVERT(DATE, @year + '-12-31') AS [end year]
Extract the year from your
DATE
value, then use string concatenation to make new dates.DECLARE @year CHAR(4) = DATEPART(YEAR, @date) SELECT @year + '-01-01' AS [start year], @year + '-12-31' AS [end year]
You don't need to include the time if they're all zeroes.
If you want them as real
date
ordatetime
types, useCAST
orCONVERT
SELECT CONVERT(DATE, @year + '-01-01') AS [start year], CONVERT(DATE, @year + '-12-31') AS [end year]
相关问答
更多-
假设你的“date属性”是一个日期(而不是一个完整的时间戳),那么一个简单的where会给你你的“按日期查找”: Model.where(:date_column => date) 你不想要find_by_date_column因为这将给出最多一个结果。 对于要使用extract SQL函数的年,月和日查询: Model.where('extract(year from date_column) = ?', desired_year) Model.where('extract(month from da ...
-
像这样的东西会工作。 它是你的方法的变体,但它不使用MM / DD / YYYY文字格式,并且它不会针对不好的输入(无论好坏)发生爆炸。 declare @month tinyint declare @day tinyint set @month = 9 set @day = 1 declare @date datetime -- this could be inlined if desired set @date = convert(char(4),year(getdate()))+'0101' se ...
-
好的,所以我解决你的问题的方法是创建一个日期表(它甚至可以是一个即时创建的临时表)。 我并没有试图通过连接日期和时间来伪造时间差异,而是实际上拉动了差异,并将它们添加到第一个DATETIME标记中,我们将该日期与DAYOFWEEK(mydate) = weekday 。 IF语句表示如果小时数相等,则使用24小时,否则使用时间差的绝对值来计算秒数。 不是火箭科学,但有点具有挑战性。 我正在使用的主要SQL是这个(在这里添加硬格返回格式): select m.mydate, CONVERT(CONCAT_W ...
-
在等待没有人回答这个问题时,我发现你可以使用MonthName( number, [ abbreviate ] )函数来打印月份名称。 从我的例子可以看出,这个函数的参数是number,它是1到12表示月份的值,而abbreviate是可选的boolean。 如果此参数设置为TRUE,则表示月份名称将缩写。 如果此参数设置为FALSE或省略,则月份名称不会缩写; 现在让我们回过头来回答这个问题。 由于Month(Date)返回Month(Date)的编号,您可以将其设置为MonthName(); so的第一 ...
-
为自己获取日,年,月(Get day, year and month for itself)[2023-08-30]
我不这样做。 使用java.util.Calendar : DateFormat dateFormatter = new SimpleDateFormat("yyyy-MMM-dd"); dateFormatter.setLenient(false); String dateStr = "2012-Dec-21"; Date date = dateFormatter.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.se ... -
如何从已知日期和月份查找星期几,但可变年份(How to find day of the week from known date and month but variable year)[2023-08-07]
通过消除不必要的变量并因此消除潜在的转换问题来找到解决方案。 最终代码如下: intJan =工作日(CDate(“1/1 /”&varYear)) The solution was found by eliminating unnecessary variables and thus eliminating potential conversion problems. The final code was as follows: intJan = Weekday(CDate("1/1/" & varYea ... -
localtime_r不是C标准的一部分。 也许你在寻找localtime ? localtime_r在许多Linux系统上真正可用: 线程安全版本asctime_r(),ctime_r(),gmtime_r()和localtime_r()由SUSv2指定,自从libc 5.2.5 但是,由于它不是标准的一部分,所以不能在Windows上使用它。 我怎样才能改变这种日期格式如下:5.12.2012或5-12-2012? 以及如何获得今年的一天? 你必须使用strftime而不是asctime : int m ...
-
从DATE值中提取年份,然后使用字符串连接来创建新日期。 DECLARE @year CHAR(4) = DATEPART(YEAR, @date) SELECT @year + '-01-01' AS [start year], @year + '-12-31' AS [end year] 如果他们全都为零,则不需要包含时间。 如果您希望将它们作为实际date或datetime类型,请使用CAST或CONVERT SELECT CONVERT(DATE, @year + '-01-01') AS [st ...
-
编辑:假设你的意思是一个javascript日期对象: var date = new Date("Tue Jan 01 2013 00:00:00 GMT+0530 (India Standard Time)"); var day = date.getDay(); //returns 0 - 6 var month = date.getMonth(); //returns 0 - 11 var year = date.getFullYear(); //returns 4 digit year ex: 200 ...
-
感谢@jwijffels这个伟大的解决方案: require(ffbase) MyData$SalesReportDateYear <- with(MyData["SalesReportDate"], format(SalesReportDate, "%Y"), by = 250000) MyData$SalesReportDateMonth <- with(MyData["SalesReportDate"], format(SalesReportDate, "%m"), by = 250000) ...