Loading [MathJax]/jax/output/CommonHTML/config.js
前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >Quant面试『真题』系列:第二期

Quant面试『真题』系列:第二期

作者头像
量化投资与机器学习微信公众号
发布于 2022-05-23 03:18:16
发布于 2022-05-23 03:18:16
1.3K0
举报

量化投资与机器学习微信公众号,是业内垂直于量化投资、对冲基金、Fintech、人工智能大数据等领域的主流自媒体。公众号拥有来自公募、私募、券商、期货、银行、保险、高校等行业30W+关注者,连续2年被腾讯云+社区评选为“年度最佳作者”。

量化投资与机器学公众号在2022年又双叒叕开启了一个全新系列:

QIML汇集了来自全球顶尖对冲基金、互联网大厂的真实面试题目。希望给各位读者带来不一样的求职与学习体验!

往期回顾:第一期

本期题目来自:Citadel、Two Sigma、Morgan Stanley

第二期

▌出题机构:Citadel

▌题目难度:Medium

题目

Compare and contrast Gaussian Naive Bayes (GNB) and logistic regression, When would you use one over the other?

答案

Both Gaussian naive Bayes (GNB) and logistic regression can be used for classification. The two models each have advantages and disadvantages, which provide the answer as to which to choose under what circumstances. These are discussed below, along with their similarities and differences:  

Advantages:  

1.GNB requires only a small number of observations to be adequately trained; it is also easy to use and reasonably fast to implement; interpretation of the results produced by GNB can also be highly useful.

2.Logistic regression has a simple interpretation in terms of class probabilities, and it allows inferences to be made about features (i.e. variables) and identification of the most relevant of these with respect to prediction.  

Disadvantages:  

1. Bu assuming features (i.e., variables) to be independent, GNB can be wrongly employed in problems where that does not hold true. a very common occurrence.  

2. Not highly flexible, logistic regression may fail to capture interactions between features and so may lose prediction power. This lack of flexibility can also lead to overfitting if very little data are available for training.  

Differences:

1.Since logistic regression directly learns , it is a discriminative classifier, whereas GNB directly estimates   and   and so is a generative classifier.

2.Logistic regression requires an optimization setup (where weights cannot be learned directly through counts), whereas GNB requires no such setup.

Similarities:

1.Both methods as linear decision functions generated from training data.

2.GNB’s implied   is the same as that of logistic regression (but with particular parameters).

Given these advantages and disadvantages, logistic regression would be preferable assuming training provided data size is not an issue, since the assumption of conditional independence breaks down if features are correlated. however, in cases where training data are limited or the data-generating process includes strong priors, using GNB may be preferable.

---

▌出题机构:Two Sigma

▌题目难度:Hard

题目

Describe the kernel trick in SVMs and give a simple example. How do you decide what kernel to choose?

答案

The idea behind the kernel trick is that data cannot be separated by a hyperplane in its current dimensionality can actually be linearly separable by projecting it onto a higher dimensional space. and we can table any data and map that data to a higher dimension through a variety of functions phi. However, if phi is difficult to compute, then we have a problem — instead, it is desirable if we can compute the value of k without blowing up the computation.  For instance, say we have two examples and want to map them to a quadratic space.

We have the following:

and we can use the following:

If we now change n = 2 (quadratic) to arbitrary n, we can have arbitrarily complex phi. As long as we perform computations in the original feature space (without a feature transformation), then we avoid the long compute time while still mapping our data to a higher dimension!

In terms of which kernel to choose, we can choose between linear and nonlinear kernels, and these will be for linear and nonlinear problems, respectively. For linear problems, we can try a linear or logistic kernel. For nonlinear problems, we can try either radial basis function (RBF) or Gaussian kernels.  In real-life problems, domain knowledge can he handy — in the absence of such knowledge, the above defaults are probably good starting points.

We could also try many kernels, and set up a hyper-parameter search (a grid search, for example) and compare different kernels to one another. Based on the loss function at hand, or certain performance metrics (accuracy, F1, AUC of the ROC curve, etc.), we can determine which kernel is appropriate.

---

▌出题机构:Morgan Stanley

▌题目难度:Hard

题目

Say we have N observations for some variable which we model as being drawn from a Gaussian distribution. What are your best guesses for the parameters of the distribution?

答案

Assume we have some dataset X consisting of n i.i.d observations :

Our likelihood function is the where

and therefore the log-likelihood is given by:

aking the derivative of the log-likelihood with respect to  and setting the result to 0 yields the following:

Simplifying the result yields: , and therefore the maximum likelihood estimate for is given by:

To obtain the variance, we take the derivative of the log-likelihood with respect to   and set the result equal to 0:

Simplifying yields the following:

---

▌出题机构:Two Sigma

▌题目难度:Hard

题目

Suppose you are running a linear regression and model the error terms as being normally distributed. Show that, in this setup, maximizing the likelihood of the data is equivalent to minimizing the sum of the squared residuals. 

答案

In matrix form, we assume is distributed as multivariate Gaussian:

The likelihood of given above is

Of which we can take the log in order to optimize:

Note that, when taking a derivative with respect to , the first term is a constant, so we can ignore it, making our optimization problem as follows:

We can ignore the constant and flip the sign to rewrite as the following:

which is exactly equivalent to minimizing the sum of the squared residuals.

---

▌出题机构:Citadel

▌题目难度:Hard

题目

Describe the model formulation behind logistic regression, How do you maximize the log-likelihood of a given model (using the two-class case)?

答案

Logistic regression aims to classify   into one of   classes by calculating the following:

Therefore, the model is equivalent to the following, where the denominator normalizes the numerator over the   classes:

The log-likelihood over  observations, in general, is the following:

Use the following notation to denote classes 1 and 2 for the two-class case:

Then we have the following:

Using the following notation, such that the log-likelihood can be written as follows:

Simplifying yields the following:

Substituting for the probabilities yields the following:

To maximize this log-likelihood, take the derivative and set it equal to 0

We note that:

which is equivalent to the latter half of the above expression:  

The solutions to these equations are not closed-form, however, and, hence, the above should be iterated until convergence.

---

相关阅读

干翻机器学习面试!

全程干货!Citadel在职Quant求职经验分享

G-Research:量化研究员面试『真题』

小编尽力了!G-Research量化面试『真题』答案出炉!

Quant Puzzle:高级享受!

独家!中国量化私募面试Q&A系列——鸣石投资

独家!中国量化私募面试Q&A系列——白鹭资管

Quant求职系列:Jane Street烧脑Puzzle(2019-2020)

Two Sigma:面试还是挺难(附面经)!

你能做几道?Jane Street烧脑面试题!

独家!全球顶尖对冲基金LeetCode面试题汇总

挑战Man Group!顶级对冲基金的10道Python面试题

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2022-05-20,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 量化投资与机器学习 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
JavaScript学习笔记(四)—— jQuery入门
子元素伪类选择器就是选择某一个元素下面的子元素的方式,在jQuery中,子元素伪类选择器分为两大类:
wsuo
2020/07/31
11.3K0
常用的 jQuery 选择器-笔记
例如,$("#myDiv .myClass") 选择 ID 为 myDiv 的元素内所有类名为 myClass 的元素。
云峥百宝箱
2025/04/16
780
JQuery学习笔记之选择器
JQuery与DOM对象 <div id="test1" class="test2"></div> DOM对象获取方式: var dom_div1 = document.getElementById('test1'); var dom_div2 = document.getElementByClassName('test2'); JQuery对象获取方式: var $jq_div1 = $('#test1'); // id选择器 var $jq_div2 = $('.test2'); // 类选择器 var
marsggbo
2020/06/12
6180
jQuery之高级选择器
为什么要反复的讲选择器,这个就是jQuery的一个核心点,在之前js的时候,通过复杂的document.getElement(s)ById|ByTagName|ByClassName等等,这些方式,找页面的元素对象。同样,在jQuery里面,我们要操作页面对象还是需要找对象,找页面对象,就是通过各类的选择器来找,简化我们的业务代码量。
张哥编程
2024/12/19
1200
Web前端JQuery入门实战案例
快速的,轻量级的,功能丰富的 js 库。动画(animation),ajax,DOM,更简单,容易使用的api。
达达前端
2019/07/03
4K0
前端基础-jQuery选择器
jQuery选择器是jQuery为我们提供的一组方法,让我们更加方便的获取到页面中的元素。注意:jQuery选择器返回的是jQuery对象。
cwl_java
2020/03/26
8390
JavaWeb(八)JQuery
jQuery 市场用得比较多两个框架: jQuery 比较适合做一些互联网 的应用(12306.com,蘑菇街,美丽说,聚美) extjs 比较适合做后台管理系统(电商(订单管理),银行,电信) 核心: 主要功能:javascript开发人员查找元素、操作DOM、处理事件、执行动画和开发Ajax的操作。优势:(宗旨:write less ,do more 写更少的代码,做更多的事情) 1:轻量级 (js 库非常小) 2:强大的选择器(获取页面上面的dom 元素 document.getElementByI
二十三年蝉
2018/02/28
1.8K0
jQuery入门前言
上次说到了JavaScript,对其有一定了解,本文就来说说jQuery。jQuery就是一个由JavaScript编写的轻量库,简单的说就是封装了一些JavaScript的操作,所以使用jQuery比使用原生的JavaScript可以达到用更少的代码做更多的事的效果。
贪挽懒月
2018/10/09
2.8K0
jQuery入门前言
Web阶段:第五章:JQuery库
点击:API文档下载 Jquery介绍 1.什么是JQuery ? jQuery,顾名思义,也就是JavaScript和查询(Query),它就是辅助JavaScript开发的js类库。 2.JQue
Java廖志伟
2022/09/28
26.5K0
Web阶段:第五章:JQuery库
从零开始学 Web 之 jQuery(二)获取和操作元素的属性
DOM中有很多方式获取元素,比如通过id,通过标签名,通过类名,通过name的值,通过选择器等方式。
Daotin
2018/08/31
1.8K0
前端基础:jQuery
jQuery 能做的 JavaScript 也都能做,但使用 jQuery 能大幅提高开发效率
RendaZhang
2020/09/08
13.6K0
前端基础:jQuery
jquary学习(二)jquary的使用,jQuery中的选择器
目录 首先在官网下载jquary的js文件 html页面文件里面引入 jQuery中的选择器 基本选择器id 选择器标签选择器 (“a”)类选择器 (“.class”) 首先在官网下载jquary的
一写代码就开心
2021/06/17
5.5K0
jquary学习(二)jquary的使用,jQuery中的选择器
JQuery干货篇之选择元素
实例 $("img:odd").css("border","thick double red");选择序号为奇数的img元素 $("img:first").css("border","thick double red") 选择第一个img元素
爱撒谎的男孩
2019/12/31
1.9K0
jQuery基础系列
jquery的入口函数是在html所有标签都加载后才执行,而JavaScript的window.onload事件是等到所有内容加载完后才执行。
达达前端
2019/07/03
2.7K0
jQuery基础系列
jQuery动画,案例
1.显示动画 show([s,[e],[fn]]) 内部实现原理根据当前操作的元素是块级还是行内决定, 块级内部调用display:block;,行内内部调用display:inline;
不愿意做鱼的小鲸鱼
2022/08/24
5.1K0
jQuery动画,案例
javaWeb核心技术第五篇之jQuery
- 概述 - jQuery是一个优秀的javascript框架(js类库),兼容css3和各大浏览器,提供dom,events,animate,ajax等简易的操作。并且jQuery有非常丰富的插件,大多数功能都有相应的插件解决方案。jQuery的宗旨是write less, do more. (写的更少,做的更多) - jQuery入门 - jQuery和html整合 - 下载 - 下载地址:www.jquery.com - 使用script的src属性即可
海仔
2019/08/26
8.1K0
jQuery基础
使用jQuery快速高效制作网页交互特效 第一章-JavaScript基础 上机练习1 练习——统计包含“a”或“A”的字符串的个数 需求说明:使用数组存储一组字符串,并统计包含“a”或“A”的字符串的个数 关键代码: <script type="text/javascript"> var a = ["America","Greece","Britain","Canada","China","Egypt"]; var count = 0; for(var i in a) {
星辰xc
2022/04/09
7.6K0
jQuery基础
jQuery
DOM 对象 Alert 出来的效果是:[object HTML 标签名 Element]
OY
2022/03/12
10.9K0
jQuery
jquery入门
运用jQuery时,需要在页面中引入jQuery文件 jQuery的hello world <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>helloworld</title> <!-- 1. 在页面中引入jQuery支持 --> <script src="js/jquery-1.12
周小董
2019/03/25
3K0
jQuery
jQuery是目前使用最广泛的javascript函数库。据统计,全世界排名前100万的网站,有46%使用jQuery,远远超过其他库。微软公司甚至把jQuery作为他们的官方库。
py3study
2020/01/16
4.1K0
相关推荐
JavaScript学习笔记(四)—— jQuery入门
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档