← Back to Tutorials

5. AI Tools & Frameworks

Tools & Ecosystem

TensorFlow

Open-source ML framework by Google. Supports deep learning, deployment on mobile/web, and production pipelines. Keras is now the official high-level API for TensorFlow.

import tensorflow as tf

model = tf.keras.Sequential([
    tf.keras.layers.Dense(128, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
    loss='categorical_crossentropy',
    metrics=['accuracy'])

PyTorch

Open-source ML framework by Meta. Known for its dynamic computation graph, Pythonic feel, and strong research community. The dominant framework in academic research.

import torch
import torch.nn as nn

class Net(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(784, 128)
        self.fc2 = nn.Linear(128, 10)

    def forward(self, x):
        x = torch.relu(self.fc1(x))
        x = self.fc2(x)
        return x

scikit-learn

Python library for classical ML algorithms (regression, classification, clustering, dimensionality reduction). Excellent for standard ML workflows.

from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2)
clf = RandomForestClassifier(n_estimators=100)
clf.fit(X_train, y_train)
accuracy = clf.score(X_test, y_test)

Hugging Face

Leading platform for NLP and transformer models. Provides thousands of pre-trained models for text, image, and audio tasks via the transformers library.

from transformers import pipeline

classifier = pipeline("sentiment-analysis")
result = classifier("AI is transforming the world!")
# [{'label': 'POSITIVE', 'score': 0.99}]

JAX

Google's library for high-performance numerical computing with automatic differentiation, JIT compilation, and GPU/TPU acceleration.

Other Notable Tools

Practice Task: Install scikit-learn and train a Random Forest classifier on the Iris dataset. Modify the neural network examples above to add an extra hidden layer. Try a pre-trained sentiment analysis model from Hugging Face on 5 different sentences and analyze the results.