由于上一例的实现中只针对了离散数据,为了扩充处理范围,我实现了一下对线性数据的简单处理,在其中我选择用中位数作为指标,平均数.众数等等其他数据在我看来异曲同工,最终也都会有较相似的结构. 求连续数据的香农熵 def calcLinerData(dataSet): num=len(dataSet) count={1:0,0:0} shannonEnt=0.0 for i in range(num): feature = [ example[-1] for example in dataSet] f
二值化 设置一个condition,把连续型的数据分类两类.比如Age,大于30,和小于30. from sklearn.preprocessing import Binerize as Ber x = data_2.iloc[:,0].values.reshpe(-1,1) #提取数据 trans = Ber(threshold = 30).fit_transform(x) trans 这是x中>30的设置为1,其他的设置为0. 标签 有时数据可能需要对数据进行分箱化处理,或者给不同的数据设置
WITH Date AS ( SELECT CAST('2008-08-01' AS DATETIME) da UNION ALL FROM Date WHERE da < '2008-08-21' ) ) AS c FROM Date ORDER BY da WITH Temp AS ( SELECT 1 [index], REPLACE(NEWID(), '-', '') as guid UNION ALL SELECT [index] + 1, REPLACE(NEWID(), '-',