Skip to main content

A Python library for simplifying innovation/policy diffusion modelling.

Project description

innovate

A Python library for simplifying innovation and policy diffusion modeling.

This library provides a flexible and robust framework for modeling the complex dynamics of how innovations, technologies, and policies spread over time. It is designed for researchers and practitioners in economics, marketing, public policy, and technology forecasting.

Core Philosophy

innovate is built on a modular architecture, allowing users to combine different models and components to simulate real-world scenarios. The library supports everything from classic S-curve models to advanced agent-based simulations.

Key Features

  • Modular Design: A suite of focused modules for specific modeling tasks:
    • innovate.diffuse: For foundational single-innovation adoption curves (Bass, Gompertz, Logistic).
    • innovate.substitute: For modeling technology replacement and generational products (Fisher-Pry, Norton-Bass).
    • innovate.compete: For analyzing market share dynamics between competing innovations.
    • innovate.hype: For simulating the Gartner Hype Cycle and the impact of public sentiment.
    • innovate.fail: For understanding the mechanisms of failed adoption.
    • innovate.adopt: For classifying adopter types based on their adoption timing.
  • Efficient Data Handling: Uses pandas with an Apache Arrow backend for high-performance data manipulation.
  • Advanced Parameterization:
    • Covariate-Driven Parameters: Allow model parameters (like p, q, and m in the Bass model) to be functions of external variables (e.g., price, advertising).
    • Time-Varying Parameters: Model structural breaks and policy impacts by allowing parameters to change at a specified time.
    • Mixture Models: Automatically identify and model distinct adopter segments from your data using the Expectation-Maximization algorithm.
  • Extensible: Designed with clear base classes to make it easy to add new custom models.
  • Computationally Aware: Leverages vectorized NumPy operations for efficiency, with a backend abstraction that will support future acceleration (e.g., with JAX).

Model Feature Matrix

Feature Bass Gompertz Logistic Lotka-Volterra Fisher-Pry Norton-Bass
Core Diffusion
Covariates
Time-Varying Params
Mixture Model

Innovate in the Ecosystem

innovate is designed to fill a unique gap in the Python ecosystem. While some libraries offer diffusion models and others provide generic agent-based modeling (ABM) frameworks, innovate is the first to integrate both under a unified, domain-specific toolkit for innovation dynamics.

Feature innovate PyDiM / bassmodeldiffusion Mesa / AgentPy / BPTK-Py
Core Diffusion Models ✅ (Bass, Gompertz, Logistic) ✅ (Primarily Bass) ❌ (Not its focus)
Competition Models ✅ (Lotka-Volterra) ✅ (Via custom ABM)
Substitution Models ✅ (Fisher-Pry) ✅ (Via custom ABM)
Hype Cycle Modeling ✅ (Composite & DDE models) ✅ (Via custom ABM)
Advanced Parameterization ✅ (Covariates, Time-Varying, Mixtures) ❌ (Requires manual implementation)
Agent-Based Modeling ✅ (Integrated with mesa) ✅ (Core functionality)
Pre-configured ABM Scenarios ✅ (Competition, Hype, Disruption) ❌ (Requires manual implementation)
System Dynamics ✅ (BPTK-Py only)
Unified Framework ✅ (Diffusion + Competition + ABM) ❌ (Focused on diffusion) ❌ (Focused on ABM/SD)
Parameter Fitting ❌ (Not a primary feature)
Visualization ✅ (Network/Grid plots)

This integrated approach means you can start with high-level diffusion models and seamlessly transition to complex, bottom-up agent-based simulations without changing frameworks.

Roadmap

The innovate library is under active development. For detailed plans on upcoming features, including the Agent-Based Modeling (ABM) framework and advanced policy analysis tools, please see our Roadmap.

Installation

pip install innovate

(Note: The package is not yet available on PyPI under this name, but will be in the future).

You will also need to install pyarrow:

pip install pyarrow

Usage

Examples and tutorials will be provided in the examples/ directory to demonstrate how to use the library for various modeling scenarios.

Example Plots

Here is a sample of the kinds of visualizations you can generate with innovate.

Bass Diffusion Lotka-Volterra Competition
Bass Diffusion Curve Lotka-Volterra Competition
Hype Cycle Reduction Analysis
Hype Cycle Reduction Analysis
Gompertz Diffusion Logistic Diffusion
Gompertz Diffusion Curve Logistic Diffusion Curve
Fisher-Pry Substitution Norton-Bass Substitution
Fisher-Pry Substitution Norton-Bass Substitution
Multi-Product Diffusion Adoption Curve
Multi-Product Diffusion Adoption Curve

Backend Performance

The innovate library supports both NumPy and JAX backends. The JAX backend can provide a significant performance benefit for fitting complex models, especially those with a large number of parameters. However, the performance benefit is less significant for simple models.

The following table shows the results of a benchmarking script that compares the performance of the NumPy and JAX backends for a variety of tasks:

Model Backend Task Time (s)
BassModel numpy fit 1.53
BassModel jax fit 1.39
GompertzModel numpy fit 0.03
GompertzModel jax fit 0.03
LogisticModel numpy fit 0.05
LogisticModel jax fit 0.05
BassModel numpy predict 0.06
BassModel jax predict 0.06
GompertzModel numpy predict 0.06
GompertzModel jax predict 0.06
LogisticModel numpy predict 0.10
LogisticModel jax predict 0.10
BassModel numpy simulate_1000 0.64
BassModel jax simulate_1000 0.62
GompertzModel numpy simulate_1000 0.61
GompertzModel jax simulate_1000 0.61
LogisticModel numpy simulate_1000 1.06
LogisticModel jax simulate_1000 1.08

As you can see, the JAX backend is slightly faster than the NumPy backend for fitting the BassModel. However, the performance is about the same for the other models and tasks.

We are continuing to investigate opportunities for optimization, including the use of pyarrow and other high-performance libraries.

License

This project is licensed under the Apache 2.0 License.

Testing

See the Testing Strategy document for details on how to run the test suite and how different tests are categorized.

Setup

Install the project dependencies before running the tests:

pip install -r requirements.txt

After installing the requirements, you can run pytest. The full recommended command is documented in docs/testing_strategy.rst.

Branching Strategy

This repository now uses work as the primary development branch. Existing branches can be rebased or merged onto work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

innovate-0.5.0.tar.gz (107.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

innovate-0.5.0-py3-none-any.whl (101.0 kB view details)

Uploaded Python 3

File details

Details for the file innovate-0.5.0.tar.gz.

File metadata

  • Download URL: innovate-0.5.0.tar.gz
  • Upload date:
  • Size: 107.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for innovate-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c8687b0ce2d08a55549d3707a7120847e8433fe0d51ae577fadba1ec94cb7961
MD5 53c6ad087d69e11f2a369d9df2ff75f5
BLAKE2b-256 8fda43578bff1f45d9483e55982dd49422d5b238893b918b0f992a84ceb02f9e

See more details on using hashes here.

File details

Details for the file innovate-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: innovate-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 101.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for innovate-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd656c7662fabb7639aa204c4e86335e5ccfcdc0536365b398c69b8dcfe2b966
MD5 eedb4524f3c78e2b1ddb330fa957ed7d
BLAKE2b-256 dceb13721834e0ae6ceb59ad02bca1fba5aa8f5d602939f7115ef05397f1b113

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page