Ejemplo completo: Red neuronal para clasificar dígitos MNIST
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layersWhen data becomes unstructured (images, audio, long-form text) or voluminous, Scikit-Learn reaches its limit. This is where TensorFlow (the engine) and Keras (the API) take precedence.
test_loss, test_acc = modelo.evaluate(imagenes_test, etiquetas_test) print(f'Precisión en test: test_acc')
Veredicto: Keras es la herramienta perfecta para prototipar rápidamente. Cuando aprendes machine learning con scikitlearn keras y tensorflow, Keras es donde la magia se vuelve visual y emocionante.
Si eres principiante, no. Quédate con tf.keras. Si aspiras a ser ingeniero de ML senior, necesitas entender el ecosistema TensorFlow:
Ejemplo avanzado con tf.data:
dataset = tf.data.Dataset.from_tensor_slices((imagenes, etiquetas)) dataset = dataset.shuffle(1000).batch(32).prefetch(tf.data.AUTOTUNE)
modelo.fit(dataset, epochs=10)
Una vez que tu modelo Keras funciona, llega la hora de escalar. TensorFlow puro te permite: aprende machine learning con scikitlearn keras y tensorflow
modelo.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
| Library | Primary Use Case | Level of Abstraction | Key Strengths | | :--- | :--- | :--- | :--- | | Scikit-Learn | Classical ML (Regression, Classification, Clustering) | High | Simple API, great documentation, robust utilities. | | Keras (now part of TensorFlow) | Deep Learning prototyping | Very High | User-friendly, modular, fast iteration. | | TensorFlow | Production deep learning & large-scale models | Low to Medium | Scalability, deployment (TFX, Lite, JS), ecosystem. |
Note: Keras is now the official high-level API of TensorFlow (tf.keras), combining Keras’ simplicity with TensorFlow’s power. Veredicto: Keras es la herramienta perfecta para prototipar
En la era de la inteligencia artificial, el Machine Learning (ML) se ha convertido en la habilidad más codiciada del mercado laboral tecnológico. Sin embargo, para quienes se inician, el ecosistema de Python puede ser abrumador. ¿Por dónde empezar? ¿Cómo pasar de cero a un modelo de producción?
La respuesta está en dominar tres librerías específicas que forman el stack definitivo del ML moderno: Scikit-learn, Keras y TensorFlow. Si quieres aprender machine learning con Scikit-learn, Keras y TensorFlow, has llegado al lugar indicado. Este artículo es tu hoja de ruta definitiva.