<jupyter_start><jupyter_text>KNN Carga del dataset<jupyter_code>import pandas as pd
from sklearn.datasets import load_breast_cancer

datos = load_breast_cancer()

cancer = pd.DataFrame(datos.data, columns=datos.feature_names)
cancer["cancer_maligno"] = datos.target
cancer.head()<jupyter_output><empty_output><jupyter_text>Clasificador KNN, y calcular el AUC (roc_auc) medio con validación cruzada<jupyter_code>from sklearn.neighbors import KNeighborsClassifier
from sklearn.model_selection import cross_val_score

cross_val_score(KNeighborsClassifier(),
               X=cancer.drop(columns="cancer_maligno"),
               y=cancer["cancer_maligno"],
               scoring="roc_auc"
               ).mean()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09324324324324325, 'fraction_numerical': 0.0, 'mean_word_length': 5.333333333333333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '252283', 'license': 'MIT', 'n_tokens_mistral': 264, 'n_tokens_neox': 251, 'n_words': 41, 'path': 'Machine_Learning/Clasificacion/4_KNN_KVecinosMasProximos.ipynb', 'repo_name': 'mariousm/Data-Science-Course', 'size': '740'}