查看: 5115| 回复: 19
跳转到指定楼层
上一主题 下一主题
收起左侧

跳槽DS准备打卡贴

全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
入职将近两年一家生物startup,做DE,其实平时什么也干,管database,写sql,搭网站,写pipeline,修电脑,也是小公司的一般状况吧,最近写了快一年网站实在是无聊。和同学朋友聊了聊,觉得还是想做DS分析数据比较有趣,也不太想做生物相关的。另一方面也想多赚点。于是思前想后决定跳槽。主攻analytics方向,打算从现在开始准备,在这里记录一下,大概每周更新次,希望有小伙伴一起努力。
看了地里的一些帖子,打算从以下几个方面准备:

1. Product
这方面以前完全没经验,打算从头看Cracking PM Interview
Youtube Product School视频

2. Coding.1point3acres
Python/R之前上学写过很多,打算去kaggle上看看别人的code,再写几个项目练练手
SQL刷一下leetcode
之前上过C++数据结构的课。算法打算刷一下基本的题型,不花太多时间了
. 1point 3 acres
3. 统计概率、AB testing. Χ
MS毕业两年,还得翻翻教材把基本知识捡起来
另外打算上一下udacity的 ABtesting的课.

4. ML
analytics的话,ML就简单看一下,看一下standford课程的note,熟悉下每个model的优缺点



.



评分

参与人数 2大米 +2 收起 理由
梁大岗 + 1 给你点个赞!
VanJcY + 1 给你点个赞!

查看全部评分


上一篇:数据科学需要掌握哪些统计知识?
下一篇:求问ds职业方向发展选择。略迷茫:)
推荐
 楼主| 雨天愁浪 2019-5-29 11:52:37 | 只看该作者
全局:
这周看完了Stanford 课程,上网刷了些常见题目,mL就先到这里了。下周开始投简历,做kaggle,为take home练手写模板。
. Waral dи,
ML剩余部分总结:
lasso path: 逐渐加大regularize parameter,训练模型,看什么时候feature开始起作用

Binary classification有两类model:1. 直接output分类(KNN, decision tree),2. Output score(margin-SVM, probability-logistic regression, neural network).需要确定分类标准.
rank view, 对error analysis有用,从最高的negative 或最低的positive sample开始。prevalance =  ,决定class imbalance. 如果太多sample,就用class-wise histogram. .и
Confusion matrix. False Positive = Type 1 error, True Negative = Type 2 error. Accuracy = 多少比例预测正确。Precision(Positive Prediction Value, PPV) = quality of Positive prediction. Recall(sensitivity) = what fraction of positive is picked out. Negative Recall (Specificity) = what fraction of negatives is picked out? F1 score = Harmonic mean of Precision and Recall. G score = Geometric mean of Precision and Recall. Precision和specificity有一点正相关,sensitivity和specificity负相关,precision和recall负相关。ROC curve是y=specificity和x=sensitivity的曲线,AUC(area under curve)= C-statistics(concordance score)表明rank score的好坏。对角线为随机猜。Precision recall curve. Area under PRC = Average Precision, the expected precision by randomly picking threshold.

Log-loss = p(x)*y + (1-p(x))*(1-y), rewards confident correct predictions and heavily penalizes confident wrong predictions..google  и
If prevalence <5%, high imbalanced. 选择metrics的好坏Accuracy  <<  AUROC  <<  AUPRC。对search engine results, grammar correction等问题,重视FP,要保持高precision同事optimize recall。对medical test,重视FN,要保持高recall,optimize precision。
Multi-class. Confusion matrix is NxN,除了accurcy,大多数metrics都是 1 vs many。Imbalance很常见. check 1point3acres for more.

high variance fix: 获得更多数据,加feature,.1point3acres
high bias fix: 减feature, email header feature。
optimization algo有问题: GD多跑几遍iteration,用不同方法,SGD,GD,Newton。。。optimization objective fix: hyper-parameter,用不同的regularizer, 用不同的model
如果test error太大, 如果train error= test error ,需要加feature;如果train error < test error, overfitting. 需要Regularize, 用simple model。如果trainer error来回摇摆巨大, you optimization algorithm需要改进

k-means 保证会converge,但可能会到local optima。可以用不同的initial values跑k-means很多次,选最终结果k-mean最小的。-baidu 1point3acres
k-means初始值 uniformly chosen, 没效率,K-means++ 改进了初始值选取, O(log k). 1point3acres
1a. Take one centerc1, chosen uniformly at random from X.
1b. Take a new center ci, choosing x∈X with probability D(x)2Px∈XD(x)
2.1c. Repeat Step 1b. until we have taken k centers altogether.
2-4. Proceed as with the standard k-means algorithm.

Mixture of Gaussians用来做clustering. 假设z为某一cluster的中心,z~Multinomial(φ) (φj是z为第j个cluster的中心的概率),对每一个sample x(i), 都在某个cluster里,都有对应的z(i), 假设(x(i)|z(i)=j)~ N(μj,Σj).这里z是假设的unobeserved变量。可以用EM/ Estimation-Maximization求, E-step soft guess z,M-step根据猜的z求parameter的最优解。和K-means很像,也保证converge,也可能陷入local optima,需要多试几个初始值,但EM不做hard cluster assignment,而用soft guess wj,只求分到某个cluster的概率   
repeat until converge

Principal Component Analysis, 要先标准化,然后投影到某vector,u上而使variation基本不变/尽可能大,因为已经过标准化,就是要x在u上投影离远点尽量远,距离为xTu.就是要maximize  ,就是covariance matrix。所以选取Σ的top k eigenvalue为u1,u2…uk即可,就是principal component.PCA有助于数据可视化;在train model前做PCA可以降低计算量,并且减少overfitting;还可以减少noise

Esemble model的好处:Averaging out biases. Reducing the variance. Avoiding overfitting.
. 1point3acres.com
Reinforcement learning 不给正确与否,而是给reward function,好的就reward,bad就punish。应用:autonomous helicopter flight, robot legged locomotion, cell-phone networkrouting, marketing strategy selection, factory control, and efficient web-page indexing.. From 1point 3acres bbs
Markov decision processes (MDP).--

Entropy描述混乱程度,在decision tree中测量分类impurity的程度。Information gain = Entropy(x) — ([weighted average] * entropy(children for feature)), 每次分类按能使information gain 最大的feature 来分类。Gini impurity 是指stop division when we have x number of fewer number of elements left. .и
Decision tree parameter tuning: minimum sample split(某一组数据量小于这个值则不再继续分类);criterion(分类标准是gini还是entropy)

KNN 有三种方法计算距离,1.直接算O[DN2],2. K-D Tree,如果A离B很远,B离C很近,那么不计算也知道A离C很远 O[D N *log(N)],3. Ball Tree, 假设data在高维空间并建立nested hyper sphere. O[Dlog(N)]. 数据量小dimention小,直接算。对小dimention高分散型数据,KD tree比ball tree好。大dimention大数据量用ball tree。
KNN parameters:n_neighbors, algorithm({‘auto’, ‘ball_tree’, ‘kd_tree’, ‘brute’})

Random Forest 取majority vote,也可以根据每个树的error rate加权求majority vote,error小的权大。
RF parameters:n_estimators(tree的数量),criterion(decision tree的algorithm),min_sample_split (每组数据量达到多小时不再继续分类)
-baidu 1point3acres
Adaboost 每次取不同的training dataset来训练,根据每个model的accuracy加权求最终结果。选Training dataset不是random,上一个model中misclassified data points会获得更大的权重,更可能被选上。如果accuracy为50%,Model的权重是0,如果小于50%,权重为负。
回复

使用道具 举报

推荐
 楼主| 雨天愁浪 2019-5-8 13:15:31 | 只看该作者
全局:
上周看了 Udacity AB testing 的课,确实学到了挺多的,总结一下。

有清晰的控制和试验组,metrics,容易收集data并且时间不长的话,都可以用AB testing。还要考虑user有足够时间适应新feature。不能测试缺少了什么,或者太general的结果。
CTR, CTP. Rate 更适合用于usability test,比如increase button size

需要考虑每个事件是独立的
当N*p_hat>5 & N*(1-p_hat)>5时,可以近似正态分布
Null hypothesis: Pexp – Pcont = 0; Alternative Hypothesis: Pexp-Pcont != 0; calculate P(Pexp=Pcont|H0)
Alternative 可选用双尾检验或单尾检验. .и
2% change is big

样本量越小,越容易reject,越不能detect true difference,beta越大,alpha低;样本量越大,分布越集中,beta越小,但alpha不变
practical significance level 越大,beta会越小, beta一般取80%,alpha一般取5%

如果数据密度达到了一定程度,无法从数据中识别出个人,则不认为是敏感信息。HIPAA 明确规定时间戳是有可能包含能确定到某个人的信息,所以是可识别至个人的信息。所以,任何与健康相关的时间戳都是敏感信息。. 1point 3 acres
. 1point 3acres
用多个单独的metrics比用单个Overall Evaluation Criteria/Objective function (OEC)好,因为OEC不能考虑所有情况
如果很难获得数据,或者花费时间太久,则不适合做metrics。
可以用一下方法收集数据
1.        Use External Data: market share data; user survey company; summary level data; published papers. ----
2.        Gather own in-depth data: User Experience Research (most in-depth and intensive, <=10 users, good for brainstorming, can use special equipment, need to validate results); Focus Groups (hundreds of people together, get feedback on hypotheticals, risk of group think); Survey (>1000 users, useful for metrics you cannot directly measure, but user may not give full answers)
3.        Retrospective Analysis: look back logs of users, generating ideas for AB tests and for validating metrics. Can only prove correlation, not casualty
4.        Long-term prospective experiments: run long term test and build models to see what short-term metrics best predict the long-term effects
5.        Human Evaluation: pay professionals to evaluate the website
External data and retrospective analyses are best for validating metrics: the data is usually collected at scale. If you have no idea about what metrics to gather in the first place, more detailed, qualitative, brainstorming type of interactions, such as user experience research studies or focus groups work well.  If you have no way of getting the data, because the interactions aren’t on your site, something like a survey might work well.  If it’s an issue of time to measure, then something like retrospective analyses paired with long-term experiments might work.

Summarized metrics: Sum/count, mean/median/25%/75%/90%percentiles, CTP, CTR, ratio

Spikes/Anomalies: check week-over-week, year-over-year 图表, 把数据按不同组分类,比如按国家. AA testing 可测试 sensitivity, robust, and variability, 寻找潜在的会影响结果的变量. 还可以比较结果,预测variance和计算CI, 也可以将数据排序后直接获得CI。AA testing 做的越多,效果越差。
SE is proportional to sqrt(N) .

做实验步骤:1. Choose subject (unit of diversion); 2. Choose population/sample size; 3. Determine size; 4. Duration/Timing
做关于learning effects, retention,增加user activity等任何需要user 慢慢建立的实验,可以用cohort代替population
需要考虑实验用多少比例的总流量,大的有风险的变化要用小比例,还要考虑其他实验。但一般不要超过几周时间

sanity check: 检查 invariant variables 在实验组和控制组间是相同的.
effective size test和sign test
多个metrics时要用Bonforroni correction

这周刷些概率的题目,然后看ML

评分

参与人数 2大米 +2 收起 理由
qxtracy + 1 很有用的信息!
Blanchey218 + 1 赞一个

查看全部评分

回复

使用道具 举报

推荐
 楼主| 雨天愁浪 2019-5-19 15:20:38 | 只看该作者
全局:
这周刷了些概率题,国内的概率题真是大开眼界,有很多感觉像是智力题。
这周主要是看ML,stanford的CS229 notes特别好,就是作业在piazza上不能看,而且这个学期的notes还没有都放出来。。。现在只看到model selection。
下面总结下看过的ML知识点
.
Gradient descent 一般指 batch gradient descent在每一步update都要看所有sample
When only one obs: Least Mean Squares (Widrow-Hoff). 每次的Update与error term 成比例
Linear regression 的cost function 是convex ,local optima就是global optima
Stochastic gradient descent(incremental GD): 每一步update只看一个sample。比batch GD快得多,不会converge到minimum,只会在minimum附近徘徊,但足够接近了,常用于sample size很大.1point3acres
Normal equation:   
If we write y as function of x and an error term which captures unmodeled effects or random noise.  , and assume every sample is iid, ε is normally distributed with mean 0, then if we want maximum log likelihood of L(θ), it’s same as minimize mean square.

Locally Weighted Linear Regression (LWR):    weights 取决于training samples距离你想测试的那一点的距离,距离越近,weight越大。τ是bandwidth, 决定了权重根据距离缩小而增大的速度
LWR 是non-parametric algorithm. 总是需要所有的training set来做prediction。相反,Parametric有确定有限的parameters,一旦训练完成,则不再需要training set

If we use   and same stochastic GD rule, it’s a Perceptron Learning Algorithm
Newton method:  ; Newton-Raphson method(multidimension version):  ,    is vector of partial derivatives of l(θ) on θi; H is Hessian matrix where  
Newton比 batch GD快,iteration少得多,但是每次iteration比较慢,因为要求H的逆矩阵,总的来说如果θ dimension不大,Newton快很多。
用Newton求logistic regression 的maximumn log likelihood的方法,叫做Fisher Scoring. Waral dи,

Exponential Family Distribution

Bernoulli and Gaussian distribution; The multinomial, the Poisson (for mod-elling count-data; also see the problem set); the gamma and the exponential (for modelling continuous, non-negative random variables, such as time-intervals); the beta and the Dirichlet (for distributions over probabilities);and many more are in exponential family..
.1point3acres
Generalized Linear Models (GLM), ordinary least squares, logistic regression, softmax regression are all GLM.
For multinominal response variable, canonical response function is also called softmax function:  
Softmax regression extension of logistic regression, use GLM to do multi-classification :   

-baidu 1point3acresGussian Discriminative Analysis model 是generative learning algorithm. 他假设X是multivariate Gussian distribution, y是二项分类。他和logistic regression一样,只是多假设了multivariate Gussian,假设更严格。如果假设正确,GDA更efficient,更fit model。当sample size大的时候,GDA总是更好。如果假设错误,logistic更robust,less sensitive to wrong assumption. E.g. If x|y= 0~Poisson(λ0), and x|y= 1~Poisson(λ1), then p(y|x) will be logistic.  Logistic regression will also work well on Poisson data like this.
. From 1point 3acres bbs
Naïve Bayes是classification 算法,要求x都是discrete. 如果x is continuous, 可以把它分成几个区间而分类。如果continuous x 不是很follow multivariate normal distribution, 分区间用Naïve Bayes比GDA结果好。NB大多情况下都不错

Neural Network 由 neuron组成,只要提供input layer和output layer, NN 会自己算出 hidden units/hidden layer。所以NN是black box,中间的hidden feature很难让人类理解。NN自己学习hidden layer的过程叫end-to-end learning. Fully connected layer指上一层每个变量和这一层每个变量都相关
NN的每一步由两个步骤组成,第一步是上一步units的线性组合求出z,第二步是求z的non-linear结果即a。所有过程要对每个sample x(i)进行i=1,…n. a[0]=x-baidu 1point3acres

Activation function 一般是non-linear function,可以是   .
ReLU is Rectified Linear Unit。如果activation function是linear的,linear function of linear function is a linear function,那就只是相当于跑一个linear regression,失去NN的意义
For loops对NN来说太慢了infeasible,要用vectorizaiton和matrix algebra才快. .google  и
W,b 的初始值不能为0,否则gradient一直相同,所有layer都一样,无法训练,应该随机选一些小值,比如N(0,0.1)。所有W,b都一样的值也不行,每次同一层的neuron学习的东西都一样,造成symmetry。更好的办法是Xavier/He initialization   n[l]is the number of neurons in layer l.
确定初始值后,求出y_hat, cost, 然后根据 gradient descent update 每个parameter。Update倒着来节省计算,从output layer往后一层一层update W,b.. check 1point3acres for more.
batch GD cost function more accurate but more noise than stochastic GD. Batch GD 很难为所有sample计算activation。
实际中常用Mini-batch GD.  ,with momentum technique.

Cost function J 可以加regularization  

Has bias = underfit = model too simple; has variance = overfit = model too complex;large noise 也会导致MSE大
Empirical risk = training error. Empirical risk minimization (ERM)
Dropout,data augmentation,adding more data 也是regularization.

Hold-out cross validation(simple cross validation) 在选定model之后可以用整个dataset再train一遍,除非model对initiation比较敏感。SCV一般选25%-35%数据,比较浪费data。K-fold cross validation,k一般选10. 如果k=N,则为leave-one-out cross validation.. 1point 3 acres
Wrapper model feature selection 包括forward search and backward search. Computational expensive. O(n2).
Filter feature selection,根据每个feature多informative来评分,选分高的几个,可以用cross validation来确定选多少个feature。评分标准是feature和y的correlation,或者mutual information; 对discrete features , 测量p(xi, y) 和p(xi)p(y) pdf的不同。

也可以用Bayesian statistics 克服overfitting。假设prior distribution p(θ), posterior distribution is  , p(y(i)|x(i), θ)根据所选model计算,经常要算积分,计算量太大,常用maximum a posteriori 近似 ,这就是maximum likelihood estimate, 只是p(θ)是prior。实际中,常假设θ~ N(0, τ2I),用prior使θMAP更小,所以修正了overfitting,所以Bayesian logistic regression在text classification表现很好。

Error analysis就是把整个系统分成几个部分,和各自的perfect performance作比较,确认哪部分改进空间大,或者是去看错误预测的数据的共同点,确认哪部分需要优化。Ablative analysis是一个一个拿掉feature,看performance怎么变化来确认哪个feature重要
.
下周继续看完stanford ML然后开始做一些Kaggle project练手,并且开始投简历了

补充内容 (2019-5-20 15:19):
好多公式都是图片,好像都没搞上去。。
回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-3-6 06:16:33 | 只看该作者
全局:
一周多了,来更新一下

这周主要focus product sense。看完了carking PM interview. 里面其实蛮多面试技巧还有behavior,改了简历,整理了下behavior的答案和故事,还有product 题目的套路。
Product school的视频看完了硅谷系列,总体上感觉干货不多,很多都是分享故事和一些软技能,对面试并没有多大用

另外随手翻了翻以前的教材,复习概率统计之类的

下周再练习几道product的题目,然后看cracking code interview过一下数据结构和算法, 开始刷算法题。
回复

使用道具 举报

🔗
VanJcY 2019-3-7 11:23:01 | 只看该作者
全局:
楼主是什么专业的background的吖~?也在找DS 的岗位. check 1point3acres for more.
但几乎都是秒拒😂
可以加微信咩~交流交流
Van_J_Y
回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-3-7 13:07:08 | 只看该作者
全局:
VanJcY 发表于 2019-3-7 11:23
楼主是什么专业的background的吖~?也在找DS 的岗位
但几乎都是秒拒😂
可以加微信咩~交流交流

我硕士是统计,本科是土木的,微信已加啦
回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-3-12 09:28:16 | 只看该作者
全局:
又一周了,来更新下

上周的PM套路整理补充下
1. 各种metrics要熟,一般就是跟着AARRR模型,user journey的每一步用什么metrics来衡量,怎么考虑优先级,可以参考 https://stellarpeers.com/blog/metrics-airbnb-experiences-feature/
2. problem solving: 先问clarify questions,明确目标和用户, 然后说分析的框架,除了一般的框架Marketing Mix, SWOT, 5 Cs, 5 Forces外,还可以问interviewer可以如何细分,按地域,产品还是用户等。这里考察能力主要是如何把问题breakdown找到问题所在,与PM咨询类不同的事,需要说要track哪些metrics来找问题所在,或者利用哪些metrics来验证你的solution
3. 设计产品 不知道DS会不会考。还是从明确目标和用户开始,分析use cases,如果现在有有关产品,分析哪里不足,然后阐述怎么针对不同的use cases来设计feature,这些设计相比现有产品有什么改进。
4. 面试前一定要去看公司的main product,分析他的设计理念,metrics之类的

这周练了几道product题目,然后就等面试前二刷了
看完了Cracking code interview和cracking PM interview的coding部分,基本的数据结构和implemetation都复习了,不过没做里面的题。下周开始刷leetcode,先刷两周看看情况吧。
. 1point 3acres
今天刚电面一家做癌症图像分析的startup,问了些简历问题,techinical题目挺简单的,但是手太生了,花了蛮久才做出来,不知道结果怎样,就当练手了。

第一次系统的准备DS面试,如果哪里说得不对,欢迎大家多交流~.1point3acres


回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-3-19 03:13:12 | 只看该作者
全局:
这一周在刷题,把leetcode easy 高频题刷完了,大概70道左右吧,下周开始刷medium

easy难度的variation感觉还是挺大的,有的暴力接就好了,有的虽然简单,但是有好多解法,多看看discusssion别人怎么解的,可以开拓思路,有的初看起来好像没法解,要做很多assumption,要思考给的每个条件可以怎么利用,然后代码其实只解决很简单一部分就可以了。另外想吐槽有的题目简单一句话,啥意思都不说清楚,一些corner case也不给expected result,只能自己先test,浪费好多时间,不过也算锻炼思考方法了吧,面试的时候哪里不清楚直接问就好。

总结一下思路:
linked list:. 1point3acres
recursive; two pointer.--
array:
two pointer; keep tmp variable; iterate from end; divide and conquer; 先sort array再解; dynamic programming. Χ
tree:
recursive (in-order, pre-order, post-order), recursive 都可以利用queue/stack转化成iterative solution; BFS use queue; DFS use stack
string:
我一般都当做array来process,python有些str的function有时候很handy
bit:
这部分ds应该不会用吧,反正我都用bin()转成string来做
-baidu 1point3acres



. 1point 3 acres补充内容 (2019-3-19 03:15):
忘了hash table, 可以array里用来做count
回复

使用道具 举报

🔗
LuLukid 2019-3-25 13:36:30 | 只看该作者
全局:
关注一下~
回复

使用道具 举报

🔗
jxgxx 2019-3-25 23:10:46 | 只看该作者
全局:
lz思路很清晰,加油!.google  и
顺便mark一下 product sense方面内容对我有帮助
回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-3-26 02:22:40 | 只看该作者
全局:
又是一周了,这周在刷LC medium,刷了20道左右,比我想象的难啊。有的题目一上来只会暴力解,慢慢看别人的解法总结起来吧,有些特别奇特的算法也开始出现了. 比如array可以用dfs,backtracking, cache result, recursive, 用O(logN)做乘除法,rotate matrix. recursive还需要多看。

最近面试也以算法为主(是什么鬼),估计还得再刷两周,可能之后还要二刷。.google  и

回复

使用道具 举报

🔗
 楼主| 雨天愁浪 2019-4-19 03:51:32 | 只看该作者
全局:
我回来了,刷了一个月题,也是醉了,要吃透一个题目可能要一整晚,之后刷面经的时候再复习算法吧。
下周去纽约玩,会抽时间上下Udacity ABtesting的课
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表