<jupyter_start><jupyter_text>Modelo de Voting Classifier* Se esxperimentara con un tipo de modelo de conjunto cuya salida sera igual a la prediccion de mayor proporcion entre los distintos modelos entrenados. Las predicciones se votan y la clase que gane es la salida.<jupyter_code>from sklearn.svm import SVC
from sklearn.linear_model import LogisticRegression
from sklearn.neighbors import KNeighborsClassifier

list_models=[("RandomForest",RandomForestClassifier(**parameters)),
             ("SVC",SVC(probability=True)),
             ("Logistic",LogisticRegression(max_iter=200)),
             ("Kneighbors",KNeighborsClassifier())
            ]
from sklearn.ensemble import VotingClassifier

voting=VotingClassifier(estimators=list_models,voting="soft")
voting.fit(transformer.fit_transform(x_train),y_train);
voting.score(transformer.transform(x_train),y_train)
voting.score(transformer.transform(x_test),y_test)
y_pred=voting.predict(transformer.transform(x_test))
print(classification_report(y_test,y_pred))
pipeline_model.score(x_train,y_train)
pipeline_model.score(x_test,y_test)<jupyter_output><empty_output><jupyter_text>Modelo de conjunto: Stacking<jupyter_code>from sklearn.ensemble import StackingClassifier

base_models=list_models.copy()
final_model=LogisticRegression(max_iter=200)
cv=StratifiedKFold(n_splits=10)
stacking=StackingClassifier(estimators=base_models,final_estimator=final_model,cv=cv)
stacking.fit(x_train,y_train);
stacking.score(x_train,y_train)
stacking.score(x_test,y_test)<jupyter_output><empty_output><jupyter_text>AdaBoostClassifier* Metamodelo que usa clasificadores debiles para construir uno mas fuerte.* La estrategie que usa el observar donde se produjeron predicciones incorrectas para luego centrarse en dichos casos y construir un modelo mas fuerte.<jupyter_code>from sklearn.ensemble import AdaBoostClassifier

ada=AdaBoostClassifier(n_estimators=100,random_state=seed)
ada.fit(x_train,y_train)
ada.score(x_train,y_train)
ada.score(x_test,y_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08835143139190524, 'fraction_numerical': 0.005429417571569595, 'mean_word_length': 8.985221674876847, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '148475', 'license': 'MIT', 'n_tokens_mistral': 721, 'n_tokens_neox': 702, 'n_words': 120, 'path': 'modelos_ensamblados.ipynb', 'repo_name': 'Jovamih/Deep-Learning', 'size': '2026'}