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

TikTok面经:速来!TikTok机器学习工程师最新面试题+答案分享,帮你高效准备面试

   
全局:

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

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

x
TikTok面经:速来!TikTok机器学习工程师最新面试题+答案分享,帮你高效准备面试
Round 1: algorithm and coding


1、Find the indexes of max values in a given array.

(example)

I have this:

var arr = [0, 21, 22, 7];
. 1point 3 acres
What's the best way to return the index of the highest value into another variable?



Answer:

function indexOfMax(arr) {

    if (arr.length === 0) {. .и

        return -1;
. ----
    }.--



    var max = arr[0];

    var maxIndex = 0;. Waral dи,
. Χ


    for (var i = 1; i < arr.length; i++) { ..

        if (arr[i] > max) {

            maxIndex = i;

            max = arr[i];
.1point3acres
        }

    }



    return maxIndex;
. 1point3acres.com
}

.

2、Followup: if there are multiple maximum values, return either one with equal probability.



(example). 1point 3 acres

Program to return the index of the maximum number in the array [ To Note : the array may or may not contain multiple copies of maximum number ] such that each index ( which contains the maximum numbers ) have the probability of 1/no of max numbers to be returned.

Examples:

[-1 3 2 3 3], each of positions [1,3,4] have the probability 1/3 to be returned (the three 3s)

[ 2 4 6 6 3 1 6 6 ], each of [2,3,6,7] have the probability of 1/4 to be returned (corresponding to the position of the 6s).

.google  и

Answer:

int find_maxIndex(vector<int> a){.
    int count = 1;
    int maxElement = a[0];
    for(int i = 1; i < a.size(); i++){.--
        if(a[i] == maxElement){
            count ++;
        } else if(a[i] > maxElement){. 1point 3 acres
            count = 1;
            maxElement = a[i];.google  и
        }
    }
    int occurrence = rand() % count + 1;
    int occur = 0;
    for(int i = 0; i < a.size(); i++){
        if(a[i] == maxElement){
            occur++;
            if(occur == occurrence) return i;
        }. 1point3acres
    }
}


Round 2: Machine Learning concept and modeling


1、How do you train and test an ML system on streaming data and make sure the model doesn’t overfit;



(example)

How do you ensure you’re not overfitting with a model?
.1point3acres
Answer: This is a simple restatement of a fundamental problem in machine learning: the possibility of overfitting training data and carrying the noise of that data through to the test set, thereby providing inaccurate generalizations.

There are three main methods to avoid overfitting:

Keep the model simpler: reduce variance by taking into account fewer variables and parameters, thereby removing some of the noise in the training data.. .и
.1point3acres
Use cross-validation techniques such as k-folds cross-validation.

Use regularization techniques such as LASSO that penalize certain model parameters if they’re likely to cause overfitting.


. check 1point3acres for more.

2、Ideas of concept drift and data drift.



(example)

What’s the difference between concept drift and data drift ?

The performance of a machine learning model degrades over time, absent intervention. This is why model monitoring is an important component of a production ML system. When a machine learning model’s predictions start to underperform, there can be several culprits.

After ruling out any data quality issues, the two usual suspects are data drift and concept drift. It’s important to understand the difference between them, because they require different approaches.. Χ

In data drift, the input has changed. The trained model is no longer relevant on the new data.
In concept drift the data distribution hasn't changed. Rather, the interaction between inputs and outputs is different than before. ֵIt practically means that what we are trying to predict has changed. A classic example is spam detection: over time, spammers try new tactics, so the spam filters need to be retrained to react to these new patterns.



3、How do we determine it’s time to retrain the model and decide how often we need to retrain the model.
-baidu 1point3acres

(example)
..
When to Your Machine Learning Model


(1)What Causes Model Staleness?.--

Perhaps the primary cause for model staleness and performance degradation is concept drift (known also as model drift). One of the core assumptions in ML is that the distribution of the training data is the same as that of the test data. However, changes in the world such as shifting markets and user behavior as well as seasonal changes can greatly affect the essence of the phenomenon we are trying to model, deeming our existing ML model irrelevant. Additional common causes include changes in the format of the data such as features that become available, or features that have stopped being available.



(2)Triggers for Retraining

Which events should trigger a retraining of your model? For one, if a significant amount of additional data becomes available, especially if the original training dataset wasn’t very large – retraining will boost your model’s performance significantly.

Another thing to notice is whether there are any schema changes in the data such as renaming of a column or introduction of a new feature. These changes can have a dramatic effect on the model’s performance. In some cases, this may be solved by a simple processing step to translate between formats, but in other cases may require a full retraining procedure.. Χ

Furthermore, if your model’s performance is degrading, it is likely time to retrain your model. This process can even be automated by using triggers that detect when performance goes under some threshold, or using anomaly detection techniques. However, it is not always easy to assess the model’s performance in real time as ground truth labels may not be available for a while, and thus you may need to estimate the correct time to retrain. This could be done using backtesting, by dividing the existing training data into “past” and “future” examples, and measuring the corresponding drift. Additionally, significant data drift is likely to reflect concept drift, and this can be measured even when labels aren’t available.
.1point3acres
Another point to consider, is that dramatic trends and events in the actual world may indicate that your model will stop performing as expected. For example, the spread of the coronavirus pandemic hit industries around the world, affecting many ML models in production. In April of 2020, the top 10 search terms on Amazon.com included: toilet paper, face mask, and hand sanitizer – items which were significantly less popular before the pandemic.

Finally, you should ask yourself whether your model might be subject to a feedback loop, where the model’s predictions may actively cause performance degradation over time, or whether your model may be subject to adversarial attacks, where users are actively trying to generate a specific outcome from your model. If one of these issues apply in your case, your are likely to need to retrain your models more frequently.. check 1point3acres for more.

Following is a useful chart by Henrik Skogström that summarizes the cases in which you may need to retrain your ML model:
(因为有的图片放不上去,如果有需要完整版练习题的可以留言呀!)

评分

参与人数 3大米 +3 收起 理由
douxiaotian + 1 欢迎分享你知道的情况,会给更多积分奖励!
UCLA34 + 1 很有用的信息!
Mark6 + 1 给你点个赞!

查看全部评分


上一篇:interview query 账号共享
下一篇:求助:interview query 会员分享
全局:
这回答是你自己写的吗?….我想知道过面试了么
回复

使用道具 举报

🔗
opxiao 2023-1-3 08:38:46 | 只看该作者
全局:
谢谢分享 ^_^
回复

使用道具 举报

🔗
RubyJiangCMU 2023-1-5 00:56:48 | 只看该作者
全局:
感觉楼主的内容很好啊, 跟我在这个书里看到的很类似 Chip Huyen - Designing Machine Learning Systems_ An Iterative Process for Production-Ready Applications-O'Reilly Media (2022) 推荐给大家。
回复

使用道具 举报

全局:
第一题好像在国内的网站上看到过hhh后面还有一个要求O(1)空间+one pass的follow up
回复

使用道具 举报

无效楼层,该帖已经被删除
全局:
楼主拿到offer了吗?感觉coding还比较简单
回复

使用道具 举报

🔗
ustcsteve 2023-3-16 10:08:29 | 只看该作者
全局:
很有用的帖子
回复

使用道具 举报

🔗
Louis_Lau 2024-10-29 01:32:51 | 只看该作者
全局:
博主有完整的练习题可以分享吗?万分感谢!
回复

使用道具 举报

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

本版积分规则

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