Skip to content

Featrix and Jupyter Notebooks

Featrix includes built-in visualization tools designed for Jupyter notebooks. No extra imports needed—just use featrix.notebook() to access training plots, 3D embedding visualizations, and animated training movies.

Getting Started

from featrixsphere.api import FeatrixSphere

featrix = FeatrixSphere()
notebook = featrix.notebook()

# Train a model
fm = featrix.create_foundational_model(
    name="customer_model",
    data_file="customers.csv"
)
fm.wait_for_training()

Available Visualizations

Training Loss Curves

Plot loss and learning rate over training epochs:

fig = notebook.training_loss(fm, style='notebook', show_learning_rate=True)
fig.show()

Parameters: - style: 'notebook', 'paper', or 'presentation' (adjusts aesthetics) - show_learning_rate: Show learning rate on secondary axis - smooth: Apply smoothing to loss curves - figsize: Tuple of (width, height)

3D Embedding Space

Visualize how your data is organized in the embedding space:

# Interactive (rotatable) with Plotly
fig = notebook.embedding_space_3d(fm, interactive=True)
fig.show()

# Static with Matplotlib
fig = notebook.embedding_space_3d(fm, interactive=False)

Parameters: - sample_size: Number of points to display (default 2000) - interactive: Use Plotly (True) or Matplotlib (False) - color_by: Column name to color points by - figsize: Figure dimensions

Training Movies

Watch how the model learns over time:

movie = notebook.training_movie(fm, notebook_mode=True)
# Displays automatically in Jupyter

Parameters: - notebook_mode: True for Jupyter widget, False for raw animation - fps: Frames per second - figsize: Figure dimensions

Compare Multiple Models

Plot training curves from multiple models on the same axes:

fig = notebook.training_comparison(
    [fm1, fm2, fm3],
    labels=['Baseline', 'With feature engineering', 'Extended data']
)
fig.show()

Embedding Space Training Details

Detailed plots for foundational model training (loss, learning rate, gradient norms):

fig = notebook.embedding_space_training(fm)
fig.show()

Predictor Training Details

Detailed plots for predictor training (loss, accuracy, AUC):

predictor = fm.create_binary_classifier(target_column="churned")
predictor.wait_for_training()

fig = notebook.single_predictor_training(predictor)
fig.show()

Dependencies

The notebook helper uses optional dependencies:

  • matplotlib: Required for all visualizations
  • plotly: Required for interactive 3D plots
  • ipywidgets: Required for notebook-mode training movies

Install them with:

pip install matplotlib plotly ipywidgets

Example: Full Visualization Workflow

from featrixsphere.api import FeatrixSphere

featrix = FeatrixSphere()
notebook = featrix.notebook()

# Train foundational model
fm = featrix.create_foundational_model(
    name="churn_analysis",
    data_file="customers.csv",
    ignore_columns=["customer_id", "churned"]
)
fm.wait_for_training()

# Visualize foundational model training
print("Training Loss:")
notebook.training_loss(fm).show()

print("\nEmbedding Space:")
notebook.embedding_space_3d(fm, interactive=True).show()

# Train predictor
predictor = fm.create_binary_classifier(target_column="churned")
predictor.wait_for_training()

# Visualize predictor training
print("\nPredictor Metrics:")
notebook.single_predictor_training(predictor).show()

# Watch the training movie
print("\nTraining Evolution:")
notebook.training_movie(fm, notebook_mode=True)

Tips

  • Use interactive=True for 3D plots—you can rotate and zoom to explore the embedding space
  • Lower sample_size if visualizations are slow with large datasets
  • The 'paper' style produces cleaner plots suitable for publications
  • Training movies work best with notebook_mode=True in Jupyter; use False to save as video files