物联网数据科学CRONBACH’S ALPHA算法,用于测量内容相关性

在构建物联网数据科学的传感器管道主要有五个阶段分别是:
1. Determine phenomena to sense and sensors to use
2. Collect sensor data of the phenomena together with ground truth labels
3. Determine appropriate preprocessing steps and features that are good for
the phenomena
4. Train classifiers / regression models based on the features and ground truth
5. Deploy trained models as part of the application

在物联网传感器的第二阶段任务是:收集现象的传感器数据和地面真值标签。

那么如何测量RELIABILITY OF ANNOTATIONS,也就是如何判断对数据进行label的方法是否可靠。在数据科学中有一套公式去判断RELIABILITY OF ANNOTATIONS。

而针对不同类型的方法有不同的可靠性判断:

Test-retest reliability : repeating same test over time
Interrater : same test conducted by different people
Parallel forms : different versions of the test produce equivalent results
Internal consistency : reliability of the individual items on a test
我们今天就讨论一种判断Internal consistency的方法叫做CRONBACH’S ALPHA,这个算法是来评估相似方面的项目是否会产生相似的结果,也就是说设置同样的多个问题的问卷调查表,无论这个表交给多少个参与者去做,得出的结果应该是相似,而不能是大相径庭,这就是说明了这个问卷调查表设计的问题是具有 Internal consistency,也就是reliability的。
那么就开始上例子,如何判断以下问卷调查表questionaire的reliability呢?
我们可以用 CRONBACH’S ALPHA算法来计算这个公式如下:
Number of items K = 5
Sum of item variances (Ʃδ Yi 2 ) = 9.9
Variance in observed test scores (variance of user sums δX 2 ) = 34.3
Cronbach’s alpha = 5 / (5 – 1) * (1 – 9.9 / 34.3) = 0.89
Rule-of-thumb: good reliability
也就是说K是item的个数, ƩδYi 2是每一列方差之和,δX 2 是每一行和的方差,得出的 Cronbach’s alpha就是这个问卷的reliability。
这是不同 alpha值对应不同的等级reliability。
那么以下表格的reliability怎么样?
import numpy as np

# Participants' answers
answers = np.array([
    [5, 2, 3, 5, 4],
    [4, 3, 5, 4, 3],
    [4, 2, 4, 1, 1],
    [4, 3, 5, 4, 2],
    [3, 1, 1, 2, 3],
    [1, 2, 3, 4, 5],
    [2, 2, 3, 2, 2]
])

# Calculate Cronbach's alpha
num_participants, num_questions = answers.shape
print(num_questions)
mean_scores = np.mean(answers, axis=0)
total_score_var = np.var(np.sum(answers, axis=1))
question_var = np.sum(np.var(answers, axis=0))
alpha = (num_questions / (num_questions - 1)) * (1 - (question_var / total_score_var))

print("Cronbach's alpha for the questionnaire:", alpha)

输出结果如下:

根据以上的评级表我们可以看出alpha值为0.56,说明这个问卷的reliability是Poor。

给大家留个疑问,就是如果删除掉一行participant的数据,reliability可能会发生改变。那么究竟删除哪一行participant的数据,问卷的reliability提高的最多。

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值