Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Octahedral Food Chart 🍽️

An interactive 3D visualization system that maps foods into an 8-dimensional categorical space using octahedral geometry. This project implements a novel approach to food categorization based on structural, textural, and preparation properties.

🎯 Concept

Instead of traditional flat taxonomies, this system positions foods in a 3D octahedral space where:

  • 8 maximally distinct food categories define the vertices and face centers
  • Category scores (0-1) determine a food's position in the space
  • Hybridization is visualized through entropy and positioning
  • Relationships between foods become geometrically apparent

📐 The 8 Categories

Vertex Categories (Pure Forms)

  1. Soup 🍲 - Liquid-dominated, spoonable
  2. Sandwich 🥪 - Structural integrity from bread/wrapper
  3. Salad 🥗 - Unbound assembly of raw/cold ingredients
  4. Roast 🍖 - Whole-piece dry heat cooking

Face Categories (Intermediates)

  1. Stew 🍛 - Chunks in thick liquid, forkable
  2. Cutlet 🍗 - Solid, fried/breaded protein slice
  3. Tart 🥧 - Open-faced pastry with structured topping
  4. Dumpling 🥟 - Filled dough pouch, hand-held

🚀 Quick Start

Installation

# Clone the repository
git clone <repository-url>
cd food

# Install dependencies
pip install -r requirements.txt

# Run the Streamlit app
streamlit run streamlit_app.py

Usage

  1. Explore the 3D Chart: Start with the sample data to see foods positioned in octahedral space
  2. Add New Foods: Use sliders to define category scores for any food item
  3. Analyze Patterns: View distribution charts and entropy analysis
  4. Compare Foods: Use radar charts to compare foods across all categories

🔧 Features

Interactive 3D Visualization

  • Octahedral mesh with category rays pointing to pure forms
  • Food positioning based on weighted category scores
  • Color coding by dominant category
  • Size variation representing hybridization (entropy)
  • Hover details showing complete category breakdowns

Data Input Interface

  • Slider-based scoring for all 8 categories (0.0 - 1.0)
  • Preset loading for category prototypes
  • Real-time validation and metrics display
  • Batch operations for data management

Analysis Tools

  • Category distribution charts showing food spread
  • Entropy analysis revealing hybridization patterns
  • Food comparison using radar charts
  • Summary statistics across the entire dataset

📊 Data Model

Each food item is represented as:

FoodEntry(
    name="Chicken Pot Pie",
    description="Chicken stew in a pastry shell",
    cuisine="American",
    vector=CategoryVector(
        tart=0.7,      # Primary: pastry shell
        stew=0.6,      # Secondary: chunky filling  
        roast=0.3,     # Tertiary: baked crust
        soup=0.2       # Quaternary: gravy-like
    )
)

Classification Tiers

  • Primary (≥0.75): Dominant characteristics
  • Secondary (0.25-0.74): Notable features
  • Tertiary (<0.25): Minor attributes

Metrics

  • Total Score: Sum of all category values
  • Entropy: Measure of hybridization (0-3 bits)
  • Primary Category: Highest-scoring category

🧮 Geometry Mapping

The octahedral coordinates create meaningful spatial relationships:

# Vertex positions (pure categories)
SOUP = (0, 0, 1)       # Top vertex
SANDWICH = (1, 0, 0)   # Right vertex  
SALAD = (0, 1, 0)      # Front vertex
ROAST = (-1, 0, 0)     # Left vertex (opposite sandwich)

# Face positions (hybrid categories)  
STEW = (0.5, 0.5, 0)   # Between soup/salad
CUTLET = (0, -0.5, -0.5) # Opposite salad
TART = (0.5, -0.5, 0)   # Between sandwich/roast
DUMPLING = (0, 0, -1)   # Bottom vertex (opposite soup)

🍕 Example Foods

Food Primary Secondary Tertiary
Lasagna Tart (0.8) Stew (0.6) Roast (0.5)
Burrito Sandwich (0.8) Dumpling (0.6) Stew (0.3)
Ramen Soup (0.8) Dumpling (0.3) Salad (0.2)
Spring Roll Dumpling (0.8) Salad (0.6) Sandwich (0.2)

🔬 Theory & Applications

Why Octahedral?

  • 8 vertices/faces accommodate 8 distinct categories
  • Opposite positioning represents antithetical concepts (soup ↔ dumpling)
  • Face interpolation naturally represents hybrid forms
  • 3D embedding preserves geometric relationships

Potential Uses

  • Menu organization for restaurants
  • Recipe recommendation systems
  • Culinary education and taxonomy
  • Food science research into structural properties
  • Cultural cuisine analysis and comparison

🛠️ Technical Architecture

app/
├── models.py          # Pydantic data models
├── geometry.py        # Octahedral mesh generation
├── visualization.py   # Plotly 3D charts
├── sample_data.py     # Example foods dataset
└── __init__.py

streamlit_app.py       # Main web interface
requirements.txt       # Python dependencies
README.md             # This file

Dependencies

  • Streamlit: Web interface and interactivity
  • Plotly: 3D visualization and charts
  • Pydantic: Data validation and modeling
  • NumPy: Geometric calculations
  • Pandas: Data manipulation

🤝 Contributing

This is an experimental framework for food categorization. Contributions welcome for:

  • Category refinement: Should "tart" include quiches?
  • Geometric validation: Testing octahedral mapping accuracy
  • Dataset expansion: More diverse food examples
  • UI improvements: Better input workflows
  • Analysis features: New visualization types

📈 Future Development

  • Machine learning: Auto-scoring from ingredient lists
  • Cultural mapping: Regional cuisine clustering analysis
  • Temporal analysis: How recipes evolve in the space
  • Multi-language: International food name support
  • API integration: Restaurant menu analysis
  • Export tools: Data sharing and collaboration features

📜 License

Open source - feel free to experiment, extend, and adapt!


"All food exists somewhere in the octahedron. The question is: where?"

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages