In screening, the worst mistake is calling a malignant tumour benign. In this dataset the label is 1 for benign and 0 for malignant. A model "calls a tumour benign" when its probability of class 1 is greater than or equal to a threshold.
Write safest_model(names, threshold).
load_breast_cancer(return_X_y=True, as_frame=True) and split it with train_test_split(X, y, test_size=0.25, random_state=0, stratify=y).names lists which models to try, chosen from:
"logistic": make_pipeline(StandardScaler(), LogisticRegression(max_iter=1000))"knn": make_pipeline(StandardScaler(), KNeighborsClassifier(n_neighbors=5))"bayes": GaussianNB()"forest": RandomForestClassifier(n_estimators=100, random_state=0)predict_proba(X_test)[:, 1].Return a dict with each name in names mapped to its number of missed cancers (an int), plus one more entry "safest": the name with the fewest missed cancers. On a tie, pick the name that comes first in names.