innovate.abm

The innovate.abm module provides a framework for creating Agent-Based Models (ABMs) of innovation diffusion. It is built on top of the mesa library.

class innovate.abm.CompetitiveDiffusionAgent(unique_id, model, num_innovations)[source]

An agent in a competitive diffusion model. The agent can adopt one of several competing innovations.

step()[source]

The agent’s step function. The agent’s decision to adopt is based on its neighbors’ adoptions.

class innovate.abm.CompetitiveDiffusionModel(num_agents, width, height, num_innovations)[source]

A model for competitive diffusion of multiple innovations.

run_model(n_steps)[source]

Run the model for a specified number of steps.

step()[source]

Run one step of the model.

class innovate.abm.DisruptiveInnovationAgent(unique_id, model)[source]

An agent in a disruptive innovation model. The agent can choose between an incumbent and a disruptive product.

step()[source]

The agent’s step function. The agent’s choice is based on the perceived value of each product.

class innovate.abm.DisruptiveInnovationModel(num_agents, width, height, initial_disruptive_performance, disruptive_performance_improvement)[source]

A model for disruptive innovation.

run_model(n_steps)[source]

Run the model for a specified number of steps.

step()[source]

Run one step of the model.

class innovate.abm.InnovationAgent(unique_id, model)[source]

An agent in the innovation diffusion model.

step()[source]

Agent’s behavior at each step.

class innovate.abm.InnovationModel(num_agents, width, height)[source]

A model for innovation diffusion.

step()[source]

Run one step of the model.

class innovate.abm.SentimentHypeAgent(unique_id, model)[source]

An agent in a sentiment-driven hype cycle model. The agent’s adoption decision is influenced by sentiment.

step()[source]

The agent’s step function. The agent’s decision to adopt is based on its neighbors’ adoptions and sentiment.

class innovate.abm.SentimentHypeModel(num_agents, width, height, adoption_threshold, sentiment_threshold)[source]

A model for a sentiment-driven hype cycle.

run_model(n_steps)[source]

Run the model for a specified number of steps.

step()[source]

Run one step of the model.

Pre-configured Scenarios

The module includes three pre-configured ABM scenarios that can be used to model different aspects of innovation diffusion.

Competitive Diffusion

The CompetitiveDiffusionModel simulates a scenario where multiple innovations are competing for adoption in a population of agents. The agents’ adoption decisions are based on the choices of their neighbors.

Sentiment-Driven Hype Cycle

The SentimentHypeModel models the impact of sentiment on the adoption of an innovation. Agents’ decisions are influenced by both the adoption status and the sentiment of their neighbors.

Disruptive Innovation

The DisruptiveInnovationModel simulates the competition between an established incumbent product and a new disruptive one. The disruptive innovation starts with lower performance but improves over time.

Example Usage

The following example demonstrates how to use the pre-configured ABM scenarios.

import matplotlib.pyplot as plt
from innovate.abm import (
    CompetitiveDiffusionModel,
    SentimentHypeModel,
    DisruptiveInnovationModel,
)


def plot_results(df, title):
    """Helper function to plot model results."""
    df.plot()
    plt.title(title)
    plt.xlabel("Step")
    plt.ylabel("Number of Adopters")
    plt.show()


# 1. Competitive Diffusion Example
print("Running Competitive Diffusion Model...")
competitive_model = CompetitiveDiffusionModel(
    num_agents=100,
    width=10,
    height=10,
    num_innovations=3,
)
competitive_results = competitive_model.run_model(n_steps=50)
plot_results(competitive_results, "Competitive Diffusion")

# 2. Sentiment-Driven Hype Cycle Example
print("Running Sentiment-Driven Hype Cycle Model...")
sentiment_model = SentimentHypeModel(
    num_agents=100,
    width=10,
    height=10,
    adoption_threshold=5,
    sentiment_threshold=3,
)
sentiment_results = sentiment_model.run_model(n_steps=50)
plot_results(sentiment_results, "Sentiment-Driven Hype Cycle")

# 3. Disruptive Innovation Example
print("Running Disruptive Innovation Model...")
disruptive_model = DisruptiveInnovationModel(
    num_agents=100,
    width=10,
    height=10,
    initial_disruptive_performance=0.1,
    disruptive_performance_improvement=0.02,
)
disruptive_results = disruptive_model.run_model(n_steps=50)
plot_results(disruptive_results, "Disruptive Innovation")