Leaf Documentation

Welcome to the Leaf documentation. Learn how to use Leaf to build powerful machine learning models with an intuitive Python API.

What is Leaf?

Leaf is a modern machine learning library for Python that makes it easy to build, train, and deploy ML models. It provides a high-level API that simplifies common ML workflows while remaining flexible for advanced use cases.

Installation

Install Leaf using pip:

pip install leaf-ml

Quick Start

Here's a simple example to get you started:

import leaf as lf

# Create a sequential model
model = lf.Sequential([
    lf.layers.Dense(64, activation='relu', input_shape=(784,)),
    lf.layers.Dropout(0.2),
    lf.layers.Dense(10, activation='softmax')
])

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

# Train the model
model.fit(x_train, y_train, epochs=10, batch_size=32)

Models

Leaf provides several model types for different use cases:

  • Sequential - For linear stack of layers
  • Functional - For complex architectures
  • Custom - For advanced custom models

Layers

Available layer types include:

  • Dense - Fully connected layer
  • Conv2D - 2D convolutional layer
  • LSTM - Long Short-Term Memory layer
  • Dropout - Regularization layer

Need Help?

If you need help or have questions, you can: