Skip to main content
Article·tensorflow.org
machine-learningdeep-learningneural-networkspythontensorflow

TensorFlow

Get started with TensorFlow, Google's open-source machine learning framework, to build and train deep learning models.

beginner30 minutes5 steps
The play
  1. Install TensorFlow
    Install TensorFlow using pip. It's recommended to use a virtual environment.
  2. Import TensorFlow
    Import the TensorFlow library into your Python script.
  3. Create a Simple Model
    Define a simple linear model: y = Wx + b, where W is the weight, x is the input, and b is the bias.
  4. Define a Loss Function
    Define a loss function to measure the difference between the model's predictions and the actual values. Here, we use mean squared error.
  5. Train the Model
    Train the model using gradient descent to minimize the loss function. This example uses a simple training loop.
Starter code
Start by installing TensorFlow and importing it into your Python environment.
Source
TensorFlow — Action Pack