[nltk_data] Downloading package stopwords to /root/nltk_data...
[nltk_data] Package stopwords is already up-to-date!
49989
politico
Se llegó al extremo, al colmo de que la Secretaría de Gobernación que manejaba la Policía Federal c…
1178
politico
Mucha gente no conoce sobre lo que significó el florecimiento de las culturas de México en la época…
137809
medico
Tener en claro, ya una vez vino la doctora Alethse de la Torre a hablar sobre el amor en los tiempo…
97598
politico
Sí hay información ya, pero no puedo informarlo.
155346
medico
Le pido al doctor Alomía si es tan amable de presentar la primera parte y continuamos.
134413
medico
Las Brigadas Correcaminos están conformadas por 12 personas que tienen diversas funciones, dos de l…
111773
politico
Entonces, estamos resolviendo el problema del abasto de los medicamentos. Se hizo un acuerdo con la…
124523
politico
Se están haciendo obras, presas, trenes, carreteras, puertos, aeropuertos. Dejar protegido todo eso…
26043
politico
Antes, un sexenio anterior, Repsol, de España; la OHL, también de España. Por eso a veces El País, …
100060
politico
Pero habíamos quedado con él.
Análisis Exploratorio de Datos
Dividir el Dataset
Feature Engineering
Etiquetas
Texto
¿O quieren ustedes que yo le conteste?
Tokenización
¿ # O # quieren # ustedes # que # yo # le # conteste # ?
['?o', 'quieren', 'ustedes', 'conteste']
Vectorización
One-Hot Encoding
1
0
1
2
1
1
Convierte nuestros textos a vectores
Modelado
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_logistic.py:818: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG,
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_logistic.py:818: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG,
/shared-libs/python3.7/py/lib/python3.7/site-packages/sklearn/linear_model/_logistic.py:818: ConvergenceWarning: lbfgs failed to converge (status=1):
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
Increase the number of iterations (max_iter) or scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
Please also refer to the documentation for alternative solver options:
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG,
precision recall f1-score support
0 0.92 0.84 0.88 26552
1 0.94 0.97 0.96 72972
accuracy 0.94 99524
macro avg 0.93 0.91 0.92 99524
weighted avg 0.94 0.94 0.94 99524
precision recall f1-score support
0 0.92 0.84 0.88 26552
1 0.95 0.97 0.96 72972
accuracy 0.94 99524
macro avg 0.93 0.91 0.92 99524
weighted avg 0.94 0.94 0.94 99524
precision recall f1-score support
0 0.96 0.91 0.94 26552
1 0.97 0.99 0.98 72972
accuracy 0.97 99524
macro avg 0.97 0.95 0.96 99524
weighted avg 0.97 0.97 0.97 99524
0.9328805112334714
0.9331216590973032
0.9605321329528556
Test Dataset
Test accuracy: 95.85%