Skip to content

🚀 Welcome to KerasFactory

KerasFactory Logo

🧩 Reusable Model Architecture Bricks in Keras 3

🏢 Provided and maintained by UnicoLab

🎯 Production-Ready Tabular AI

Build sophisticated tabular models with 38+ specialized layers, smart preprocessing, and intelligent feature engineering - all designed exclusively for Keras 3.


🎯 What is KerasFactory?

KerasFactory is a comprehensive collection of production-ready layers and models designed specifically for tabular data processing with Keras 3. Our library provides:

  • 🧠 Advanced Attention Mechanisms for tabular data
  • 🔧 Feature Engineering Layers for data preprocessing
  • 🏗️ Pre-built Models for common ML tasks
  • 📊 Data Analysis Tools for intelligent layer recommendations
  • Keras 3 Native - No TensorFlow dependencies in production code

Why KerasFactory?

KerasFactory eliminates the need to build complex tabular models from scratch. Our layers are battle-tested, well-documented, and designed to work seamlessly together.


🧩 What's Inside KerasFactory?

  • 38+ Production Layers

    Advanced attention mechanisms, feature processing, and specialized architectures ready for production use.

    Explore All Layers →

  • Smart Preprocessing

    Automatic data transformation, date encoding, and intelligent feature engineering layers.

    See Layer Examples →

  • Pre-built Models

    Ready-to-use models like BaseFeedForwardModel and SFNEBlock for common ML tasks.

    View Models →

  • Data Analyzer

    Intelligent CSV analysis tool that recommends the best layers for your specific data.

    Try Analyzer →


💡 See It In Action - Build Real Models Now!

Get a production-ready model in 3 lines of code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
import keras
from kerasfactory.models import SFNEBlock

# Create a state-of-the-art tabular model
model = SFNEBlock(
    input_dim=25,              # Number of input features
    hidden_dim=128,            # Hidden representation size
    num_blocks=3,              # Number of processing blocks
    output_dim=10              # Number of output classes
)

# Compile and train
model.compile(
    optimizer='adam',
    loss='sparse_categorical_crossentropy',
    metrics=['accuracy']
)
print("✅ State-of-the-art model ready!")

When to use: Maximum performance, zero architecture design effort.

Build advanced models by combining specialized layers:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import keras
from kerasfactory.layers import (
    DistributionTransformLayer,    # Intelligent preprocessing
    VariableSelection,              # Learn feature importance
    TabularAttention,               # Model feature relationships
    GatedFeatureFusion              # Combine representations
)

inputs = keras.Input(shape=(15,))

# Build processing pipeline
x = DistributionTransformLayer()(inputs)
x = VariableSelection(num_features=15)(x)
x = TabularAttention(num_heads=4, head_dim=16)(x)

# Combine representations
linear = keras.layers.Dense(32, activation='relu')(x)
nonlinear = keras.layers.Dense(32, activation='tanh')(x)
x = GatedFeatureFusion()([linear, nonlinear])

outputs = keras.layers.Dense(1, activation='sigmoid')(x)
model = keras.Model(inputs=inputs, outputs=outputs)

When to use: Fine-grained control, reuse battle-tested components.

Production-ready classification with all best practices:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
import keras
from kerasfactory.models import BaseFeedForwardModel

# Create robust classification model
model = BaseFeedForwardModel(
    input_dim=20,
    output_dim=1,
    hidden_layers=[256, 128, 64],
    activation='relu',
    dropout_rate=0.2
)

# Compile with production metrics
model.compile(
    optimizer=keras.optimizers.Adam(learning_rate=0.001),
    loss='binary_crossentropy',
    metrics=['accuracy', 'precision', 'recall']
)
print("✅ Production model ready!")

When to use: Proven architecture for classification tasks.


🎯 Real-World Use Cases

Predict credit risk with advanced tabular features:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from kerasfactory.models import BaseFeedForwardModel

# 50+ financial features → Risk prediction
model = BaseFeedForwardModel(
    input_dim=50,
    output_dim=1,
    hidden_layers=[256, 128, 64]
)
model.compile(
    optimizer='adam',
    loss='binary_crossentropy',
    metrics=['auc', 'precision', 'recall']
)

Use case: Loan approval, credit scoring, fraud detection

Intelligent medical diagnosis with mixed data:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from kerasfactory.layers import (
    DistributionTransformLayer,
    VariableSelection,
    TabularAttention
)

inputs = keras.Input(shape=(30,))
x = DistributionTransformLayer()(inputs)
x = VariableSelection(num_features=30)(x)
x = TabularAttention(num_heads=4, head_dim=16)(x)
outputs = keras.layers.Dense(1)(x)
model = keras.Model(inputs=inputs, outputs=outputs)

Use case: Disease prediction, patient risk assessment, diagnosis support

Build user-item interaction models:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
from kerasfactory.layers import TabularAttention, GatedFeatureFusion

user_features = keras.Input(shape=(20,))
item_features = keras.Input(shape=(15,))

user_repr = TabularAttention(
    num_heads=4, head_dim=16
)(keras.layers.Concatenate()(
    [user_features, item_features]
))

fused = GatedFeatureFusion()([user_repr, item_features])
compatibility = keras.layers.Dense(1)(fused)
model = keras.Model(
    inputs=[user_features, item_features],
    outputs=compatibility
)

Use case: Product recommendations, CTR prediction, customer lifetime value


🎨 Key Technical Features

  • 🧠 Advanced Architecture

    Graph-based feature relationships • Multi-head attention mechanisms • Hierarchical aggregation • Residual connections for stable training

  • ⚡ Performance Optimized

    Keras 3 native • Memory efficient • GPU ready • Fully serializable for production deployment

  • 🔧 Developer Friendly

    Complete type annotations • 461+ passing tests • Rich docstrings with examples • Modular design for customization


🚀 Perfect For

  • 🏢 Enterprise ML Teams

    Build production systems that scale. Battle-tested layers, 461+ passing tests, clear APIs for team collaboration, and detailed monitoring support.

    Get Started →

  • 🔬 Research & Development

    Experiment with cutting-edge techniques. State-of-the-art architectures, easy composition, reproducible results, and detailed docstrings throughout.

    Explore Layers →

  • 🎓 Learning & Education

    Master tabular deep learning. Rich examples from basic to advanced, learn from production code, interactive examples, and best practices embedded in the library.

    Start Learning →

  • ⚙️ Data Engineering

    Streamline feature engineering. Intelligent feature layers, automatic preprocessing, data quality analysis, and built-in layer recommendations.

    Try Analyzer →


🤝 Contributing

We welcome contributions! Whether you're:

  • 🐛 Reporting bugs or suggesting improvements
  • 🧩 Adding new layers or models
  • 📝 Improving documentation or examples
  • 🔍 Enhancing data analysis tools

Check out our Contributing Guide to get started!


📖 Your Journey with KerasFactory

Start here - Get up and running in 5 minutes

  1. Quick Start Guide
  2. Try pre-built models
  3. Run basic examples

Ready to build amazing tabular models? **Choose your path:** [⚡ Quick Start (5 min)](getting-started/quickstart.md){ .md-button .md-button--primary .md-button--large } [🧩 Explore Layers](api/layers.md){ .md-button .md-button--large } [🏗️ View Models](api/models.md){ .md-button .md-button--large }


Join thousands of ML engineers building production-ready tabular models with KerasFactory 🚀