10月22日笔试小结

10月22日下午参加了盛大网络的笔试。虽然考试题目中没有写程序的大题,但是其中一些小题对我也很有启发意义,记述如下。

 

1 数列题:8,8,12,24,60请问下一个数是什么?本来很简单,但是,由于思维定势的缘故,当时我没有想到答案。我总是在想后项减去前项,或者是单数项一个规律、偶数项另一个规律之类的。其实,既然想到等差数列,应该很容易想到另一种数列——等比数列,然后就会想到后项除以前项。这个数列,后项除以前项之后得到的是一个等差数列:1,1.5,2,2.5。所以,下一个数是3*60 = 180。

 

2 判断程序输出题。下面的程序输出的是什么呢? 

         int a[3] = {1,2,3};
        char* p = (char*)&a[0];
        char* q = (char*)&a[2];
        printf("a[q-p] = %d\n", a[q-p]);

答案是输出3。其实就是考察int型变量的字节存放顺序的问题。可以通过下面的程序查看int型变量的字节存放顺序。

 int a[3] = {1,2,3};
 char* p = (char*)&a[0];
 int base;
 for(int i = 0; i < 12; i++)
 {
  base = 128;
  for(int j = 0 ; j < 8; j++)
  {
   printf("%d", (base&*p)>>(7-j));
   base = base/2;
  }
  p++;
  printf("\n");
 }

输出的结果是:

00000001

00000000

00000000

00000000

00000010

00000000

00000000

00000000

00000011

00000000

00000000

00000000

通过输出的结果可以知道,int型变量4个字节,低位字节存放在前面,高位字节在后面。

 

3 eCPM概念问题。我在实习期间接触过这个概念,但由于当时只需要求得不同时间段的eCPM的比率,所以对于eCPM的定义和计算方法没有准确的记忆,以至于这题居然也做错了。

eCPM (effective cost per mille)指的就是每一千次展示可以获得的广告收入

eCPM = (收入/网页展示次数)×1000

收入 = 广告单价×网页点击率×网页展示次数

eCPM = 广告单价×网页点击率×1000

 

4 Precision和Recall的概念。这两个概念在读paper的时候也不只一次的看到过,结果考试的时候还是忘了。

In a statistical classification task, the Precision for a class is the number of true positives(i.e. the number of items correctly labeled as belonging to the positive class) divided by the total number of elements labeled as belonging to the positive class (i.e. the sum of true positives and false positives, which are items incorrectly labeled as belonging to the class).Recall in this context is defined as the number of true positives divided by the total number of elements that actually belong to the positive class (i.e. the sum of true positives and false negatives, which are items which were not labeled as belonging to the positive class but should have been).

In information retrieval, a perfect Precision score of 1.0 means that every result retrieved by a search was relevant (but says nothing about whether all relevant documents were retrieved) whereas a perfect Recall score of 1.0 means that all relevant documents were retrieved by the search (but says nothing about how many irrelevant documents were also retrieved).

再上一个图和公式来帮助形象记忆。

In the context of classification tasks, the terms true positivestrue negativesfalse positives and false negatives are used to compare the given classification of an item (the class label assigned to the item by a classifier) with the desired correct classification (the class the item actually belongs to). This is illustrated by the table below:

   correct result / classification
    E1  E2 
obtained
result / classification
E1 tp
(true positive)
fp
(false positive)
E2 fn
(false negative)
tn
(true negative)

Precision and Recall are then defined as:

\mbox{Precision}=\frac{tp}{tp+fp} \,
\mbox{Recall}=\frac{tp}{tp+fn} \,

Recall in this context is also referred to as the True Positive Rate, other related measures used in classification include True Negative Rate and Accuracy. True Negative Rate is also called Specificity.

\mbox{True Negative Rate}=\frac{tn}{tn+fp} \,
\mbox{Accuracy}=\frac{tp+tn}{tp+tn+fp+fn} \,

 

还有ROC的概念,稍有点复杂,这里暂不记述。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值