TensorFlow is a machine learning framework used to build and train models.
At a very basic level, you can think of it as a toolkit for:
- working with tensors, which are multi-dimensional arrays
- building neural networks
- training models on data
- running predictions on new inputs
Common beginner ideas:
tf.Tensor: the basic data structurekeras.Sequential: a simple way to define a model layer by layermodel.fit(...): trains a modelmodel.predict(...): makes predictions
Very small mental model:
- Load data.
- Define a model.
- Train the model.
- Evaluate the result.
- Use the model for prediction.
Simple example:
import tensorflow as tf
model = tf.keras.Sequential([
tf.keras.layers.Dense(8, activation="relu"),
tf.keras.layers.Dense(1)
])
model.compile(optimizer="adam", loss="mse")
Why people use TensorFlow:
- good ecosystem
- strong support for deep learning
- useful for production deployment
- integrates well with Keras
Good first goal:
Build a tiny model that learns from a small table of numbers before moving into images, text, or time series.