📣 独立日限时特惠: VIP通行证立减$68
楼主: Zeophy
跳转到指定楼层
上一主题 下一主题
收起左侧

2018-12 在职刷题保持状态, 每天1题+ML insights

🔗
 楼主| Zeophy 2019-1-24 00:39:48 | 只看该作者
全局:
Day49

Solved 243, 245, 256.
回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-25 05:45:31 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-25 06:50 编辑

Day50

Solved 65.
Solved 69.

Solved 261 with union-find.

ML Reviewed:

Point estimates:
MLE -> Pros: efficient, consistent and invariant under re-parameterization(func of the estimate is still the MLE of that function.).
           Cons: Not unique, not sure about its uncertainty. Might overfit.
MAP->  Pros: Usually a convex combination of MLE and prior on theta hence approx. to MLE as samples->infy
                    Intepretable
                    Can avoid overfitting.
           Cons: Not invariant
                    Must assume prior on theta.
Bayesian inference:
->Major aspects of Beyesian
->Priors: Conjugate priors, Informative and uninformative priors.
->Naive Bayes (not necessarily a Bayesian method!):
---->argmax_y p(y|x) = p(x|y)p(y)/constant_proportionality, where p(x|y) = p(x|y,theta) and p(y) = p(y|theta)
---->Need to estimate theta first (MLE,MAP, etc)
---->Solve the optimization
Note: x = {x1,x2,x3,....}, we can assume different likelihood on p(x_{i}|y,theta) as they are conditionally indep.



回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-26 00:14:49 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-26 00:48 编辑

Day51

Solved 148 with Mergesort.
Solved 19.

Solved 27.
回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-27 06:15:57 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-27 13:08 编辑

Day52.

Solved 28 with KMP.Solved 29
Solved 35.

回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-27 13:08:21 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-28 01:47 编辑

Day53

Solved 265. To achieve O(nk), the key idea is to keep record of min and second min costs and asscoiated colors of painting i-1 houses. For i-th house and j-th color, if min color for i-1 not equal to j, then use min otherwise use second min.
Solved 323. Union find.

Solved 636. Very confusing start and end time that have differernt meanings.

ML reviewed:


Model-based Bayesian inference. (Model is P(y|theta))

Conjugacy:

Conjugate priors of a likelihood function is the prior distribution that, once times with that likelihood function, resulting in a posterior distribution of same family as the prior

—>The beauty is, you can start with a conjugate prior, incorporate new data, update it to a posterior and then use it as the new prior.

—>This process can continue without introducing new difficulties.

Hierarchical Bayes:

Instead of assuming the prior, you can estimated them by introducing hyper priors of hyper parameter phi on these priors. Choosing hyperprior to be proper, nearly flat.


Predictive posterior:

One cool thing you can do with a full bayesian inference is to do prediction of  P (y_new|y) by integrating out the theta:

P(y_new|y) = inte P(y_new, theta|y) d(theta) = inte  P(y_new|theta)P(y|theta) d(theta)

First term is the model and second term is the product of  Beyesian inference (the posterior).

Bayesian vs Frequentist inference:

1.Bayesian believes data is fixed and our belief on the parameters to be random
2.Frequentist believes the data is random (and repeatedly sampling produce the same data as those observed) and parameter is fixed (i.e., there is one true parameter). No uncertainty on the parameter (confidence interval just gives an uncertainty about the “true” value not the parameter itself)

回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-29 06:55:53 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-29 10:31 编辑

Day54

Solved 36.
Solved 405. Thought a much more complicated version of this problem to remove all nodes of given value in O(h).

Solved 706.

ML Reviewed:

Naive Bayes and auto clustering (class, model selection…many nicknames):

Irrespective of its name, Naive Bayes it actually more a frequentist method that solves the following
argmax_c P(c|x) = P(x|c)*P(c)/P(x)

it is really a MAP for c assuming coordinates of x conditionally independent on c.

Just like a MAP, need to do two things:
Assume some prior on P(c)
Adopt a model P(c|x) = P(c|x,theta) and estimate theta^ to approximate it with P(c|x, theta^)



Used it to do unsupervised clustering by assuming C = 1, …len(D) clusters. Assume uniform categorical prior on P(c). Just need to check P(C|x) and find C=C* that maximize the likelihood (in this case equal to posterior maximizer.)

This is actually a very common technique to perform model selection.

回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-30 02:45:04 | 只看该作者
全局:
Day55

Solved 89

Solved 79

Solved 61
回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-30 07:33:17 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-1-31 01:21 编辑

Day56

Solved 428.
Solved 611. Similar to threeSum

Solved 83
回复

使用道具 举报

🔗
 楼主| Zeophy 2019-1-31 12:14:48 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-2-1 01:02 编辑

Day57

Solved 96
Solved 161
Solved 168.
回复

使用道具 举报

🔗
 楼主| Zeophy 2019-2-1 14:37:32 | 只看该作者
全局:
本帖最后由 Zeophy 于 2019-2-1 15:43 编辑

Day58

Solved 163
Solved 171

Solved 179
回复

使用道具 举报

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

本版积分规则

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