Consider the following Python code, which implements both regression and classification models to predict molecular activity: import random import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.ensemble import RandomForestClassifier random.shuffle(compound_data) split_idx = int(len(compound_data) * 0.6) train_set, test_set = compound_data[:split_idx], compound_data[split_idx:] features = ["logP", "num_hbd", "num_hba", "mw", "num_rotatable_bonds"] target_reg = "pKi" target_cls = "status" # "Active" or "Inactive" X_train_reg = [[mol[feat] for feat in features] for mol in train_set] y_train_reg = [mol[target_reg] for mol in train_set] X_test_reg = [[mol[feat] for feat in features] for mol in test_set] y_test_reg = [mol[target_reg] for mol in test_set] X_train_cls = X_train_reg # Using same features as regression y_train_cls = [1 if mol[target_cls] == "Active" else 0 for mol in train_set] X_test_cls = X_test_reg y_test_cls = [1 if mol[target_cls] == "Active" else 0 for mol in test_set] reg_model = LinearRegression() reg_model.fit(X_train_reg, y_train_reg) print("R² on test set:", reg_model.score(X_test_reg, y_test_reg)) cls_model = RandomForestClassifier() cls_model.fit(X_train_cls, y_train_cls) print("Accuracy on test set:", cls_model.score(X_test_cls, y_test_cls)) Based on this code, which of the following statements is most accurate?单项选择题
A
A model like cls_model is preferred if the data set contains only active compounds, but no inactives.
B
A model like reg_model is better than one like cls_model because it provides more detailed predictions rather than just a binary label.
C
A model like reg_model is preferred when predicting continuous activity values (e.g., pKi), while a model like cls_model is useful when distinguishing between active and inactive compounds.
D
cls_model is better than reg_model because accuracy is easier to interpret than R².
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
What was the world's first widely adopted biodiversity policy?
The aim of the Paris Agreement is to ensure that the earth’s preindustrial temperature is not exceeded by more than º Celsius.
The IPCC's mission is to Blank ______.
Why have most international agreements for environmental protection been based on the honor system?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!