Skip to content

Tutorials

Step-by-step guides to master trend_classifier.

Learning Path

These tutorials build on each other. We recommend following them in order:

# Tutorial Duration What You'll Learn
1 Quick Start 5 min Basic usage, first segmentation
2 Segment Analysis 10 min Segment properties, DataFrame export
3 Visualization 10 min All plotting methods
4 Configuration 15 min Parameters, presets, tuning
5 Classification 10 min Categorize trends
6 Optimization 20 min Optuna hyperparameter tuning
7 Detector Comparison 15 min Compare algorithms

Prerequisites

Before starting, ensure you have:

pip install trend-classifier[all]
pip install yfinance  # For sample data

Interactive Notebooks

All tutorials are Jupyter notebooks. You can:

  1. Read online - View rendered versions in this documentation
  2. Run locally - Clone the repo and run in Jupyter
  3. Open in Colab - Click the Colab badge in each notebook
git clone https://github.com/izikeros/trend_classifier.git
cd trend_classifier
jupyter lab notebooks/

Quick Reference

Common Patterns

Basic segmentation:

seg = Segmenter(df=df, column="Close", n=40)
seg.calculate_segments()
seg.plot_segments()

Export results:

df = seg.segments.to_dataframe()

Use different detector:

seg = Segmenter(df=df, detector="pelt", detector_params={"penalty": 5})

Key Classes

  • Segmenter - Main entry point
  • Segment - Single trend segment
  • SegmentList - Collection with DataFrame export
  • Config - Configuration presets