注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号
x
本帖最后由 匿名 于 2025-2-5 19:50 编辑
Linkedin海投的,2025 summer MLE Intern。总体下来我觉得偏难,上来直接两个OA。
第一个OA: 包含assessment of logical reasoning和assessment measuring your alignment with the Coinbase cultural tenets。logical reasoning15分钟50题,包含多种题目:简单算术题,图表题,数字找规律,图形找规律,英语完形填空...反正50个题15分钟我觉得绝大您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 使用VIP即刻解锁阅读权限或查看其他获取积分的方式 游客,您好! 本帖隐藏的内容需要积分高于 188 才可浏览 您当前积分为 0。 VIP即刻解锁阅读权限 或 查看其他获取积分的方式 iers,x和y。输出经过majority voting后的predicted y。答案大概长这样:- from random import randint, seed
- from sklearn.tree import DecisionTreeClassifier
- import numpy as np
- def bootstrap(n: int) -> list[int]:
- """
- Step 1: Bootstrap the train samples for each base classifier.
- """
- indices = [randint(0, n-1) for _ in range(n)]
- return indices
- def fit(classifiers: list[DecisionTreeClassifier], x: list[list[float]], y: list[int]):
- """
- Step 2: Train each classifier based on its own bootstrapped samples.
- """
- n_samples = len(x)
- for clf in classifiers:
- indices = bootstrap(n_samples)
- x_bootstrapped = [x[i] for i in indices]
- y_bootstrapped = [y[i] for i in indices]
- clf.fit(x_bootstrapped, y_bootstrapped)
- def predict(classifiers: list[DecisionTreeClassifier], x: list[list[float]]) -> list[int]:
- """
- Step 3: Assign class labels by a majority vote of the base classifiers.
- """
- predictions = np.array([clf.predict(x) for clf in classifiers])
- # Majority vote
- final_predictions = np.apply_along_axis(lambda x: np.bincount(x).argmax(), axis=0, arr=predictions)
- return final_predictions.tolist()
- def solution(x_train: list[list[float]], y_train: list[int], x_test: list[list[float]], n_estimators: int) -> list[int]:
- """
- Step 4: Pull everything together
- """
- seed(42)
- classifiers = [DecisionTreeClassifier(random_state=0) for _ in range(n_estimators)]
- fit(classifiers, x_train, y_train)
- return predict(classifiers, x_test)
复制代码 第三道code:手动实现Naive Bayes算法。到这我已经没时间了。
总体而言,我觉得Coinbase疯了。
请给点米吧!!!真的好多都看不了,以后还会分享更多相关经验的。 |