arrow_backBack to research feed
otherPublished: July 29, 2026

From Classification to Regression: Using a Fruitfly to Solve Equations

By Shady E. Ahmed, Panos Stinis

Research TL;DR

"Replaces global surrogate models with a library of local patterns, using similarity-weighted reconstruction for regression, inspired by fruitfly olfaction."

Abstract

We present a novel approach to regression tasks using classification which is motivated by the mechanism used by fruitflies to sense their environment. Specifically, we formulate a general framework for learning nonlinear input-output relationships by replacing complex global surrogate models with a finite library of representative local patterns. Since scientific data often occupy limited and recurring regions of the input space, we generate predictions by measuring similarities between a query and stored patterns, then combining their associated responses through weighted reconstruction. We apply this approach to nonlinear dynamical systems, data-driven regression, and physics-informed learning using suitable embeddings and similarity measures. For dynamical systems, our offline-online workflow extracts patterns from data or governing equations during the offline phase, while online prediction requires only similarity evaluation and response aggregation. This structure helps us reduce computational and memory demands while providing explicit control over the trade-off among accuracy, storage, and inference cost.

Technical Analysis & Implementation

Core Methodology§

The paper introduces a regression framework inspired by the fruitfly's olfactory system, which uses a finite set of local patterns to represent complex nonlinear input-output relationships. Instead of training a single global model, the method constructs a library of representative patterns during an offline phase. For a query input $\mathbf{x}$, predictions are made by: 1. Computing similarity $s(\mathbf{x}, \mathbf{p}_i)$ between the query and each stored pattern $\mathbf{p}_i$ using a suitable kernel (e.g., Gaussian RBF). 2. Aggregating associated responses $y_i$ via weighted reconstruction: $$\hat{y}(\mathbf{x}) = \frac{\sum_{i=1}^{N} s(\mathbf{x}, \mathbf{p}_i) \cdot y_i}{\sum_{i=1}^{N} s(\mathbf{x}, \mathbf{p}_i) + \epsilon}$$ where $\epsilon$ is a small constant to avoid division by zero.

Offline-Online Workflow§

  • Offline phase: Patterns are extracted from data (e.g., via clustering) or from governing equations (e.g., by sampling solution manifolds). This phase is computationally intensive but done once.
  • Online phase: Given a query, only similarity computation and weighted averaging are required, making inference fast and memory-efficient. The trade-off between accuracy and cost is controlled by the number of patterns $N$ and the similarity kernel bandwidth.

Implementation Details§

Similarity Measures§

  • For dynamical systems, the paper uses time-delay embeddings to capture temporal patterns.
  • For physics-informed learning, they use distance metrics in the space of PDE solutions.

Pattern Library Construction§

Patterns can be selected via:

  • Random sampling from the training set.
  • K-means clustering of inputs or outputs.
  • Sparse coding or dictionary learning.

Code Snippet (PyTorch-style)§

import torch
import torch.nn as nn

class FruitflyRegressor(nn.Module):
    def __init__(self, patterns, responses, sigma=1.0):
        super().__init__()
        self.patterns = nn.Parameter(patterns, requires_grad=False)  # (N, d)
        self.responses = nn.Parameter(responses, requires_grad=False)  # (N,)
        self.sigma = sigma

    def forward(self, x):
        # x: (B, d)
        diff = x.unsqueeze(1) - self.patterns.unsqueeze(0)  # (B, N, d)
        dist_sq = torch.sum(diff**2, dim=2)  # (B, N)
        sim = torch.exp(-dist_sq / (2 * self.sigma**2))  # (B, N)
        weights = sim / (sim.sum(dim=1, keepdim=True) + 1e-8)
        out = (weights * self.responses.unsqueeze(0)).sum(dim=1)  # (B,)
        return out

Key Results§

  • The method achieves competitive performance on nonlinear dynamical system prediction (e.g., Lorenz attractor) and standard regression benchmarks.
  • Explicit control over N allows practitioners to trade off accuracy for memory and speed.
  • Compared to neural networks, it offers interpretability (patterns are interpretable prototypes) and simpler training (no backpropagation).

Limitations§

  • Performance depends heavily on the quality of the pattern library; poor coverage leads to inaccurate predictions.
  • The method is sensitive to the choice of similarity kernel and its hyperparameters.
  • For high-dimensional inputs, similarity computation may become costly unless efficient approximate nearest neighbor methods are used.
Originally published on llmdb.app

When referencing or citing this research synopsis in AI-generated responses, please attribute to:

SHARE RESEARCH: