Behavior Market Fit (BMF) Scoring Algorithm

Note: This is a theoretical scoring framework. The algorithms and code examples presented here are conceptual blueprints for how Behavior Market Fit could be quantitatively measured and validated across domains.

Core Algorithm

BMF Score Calculation

The Behavior Market Fit Score (BMF-S) quantifies how well a target behavior aligns with user capabilities and problem-solving needs:

BMF-S = Σ(wᵢ × fᵢ) where i ∈ {1...7}

Component Factors

def calculate_bmf_score(behavior_data):
    """
    Calculate Behavior Market Fit Score
    
    Returns: score (0-100), confidence interval, component breakdown
    """
    
    # Factor 1: Problem-Behavior Alignment (PBA)
    pba = calculate_problem_behavior_alignment(
        problem_severity=behavior_data['problem']['severity'],
        behavior_effectiveness=behavior_data['behavior']['effectiveness'],
        alternative_solutions=behavior_data['alternatives']
    )
    
    # Factor 2: User Ability Score (UAS)
    uas = calculate_user_ability(
        skill_required=behavior_data['behavior']['skill_level'],
        user_capability=behavior_data['user']['capability_distribution'],
        learning_curve=behavior_data['behavior']['learning_curve']
    )
    
    # Factor 3: Motivation Alignment (MA)
    ma = calculate_motivation_alignment(
        intrinsic_motivation=behavior_data['user']['intrinsic_drivers'],
        extrinsic_rewards=behavior_data['behavior']['rewards'],
        effort_required=behavior_data['behavior']['effort']
    )
    
    # Factor 4: Context Compatibility (CC)
    cc = calculate_context_compatibility(
        environmental_factors=behavior_data['context']['environment'],
        social_acceptability=behavior_data['context']['social_norms'],
        resource_requirements=behavior_data['behavior']['resources']
    )
    
    # Factor 5: Trigger Availability (TA)
    ta = calculate_trigger_availability(
        natural_triggers=behavior_data['triggers']['natural'],
        designed_triggers=behavior_data['triggers']['designed'],
        trigger_timing=behavior_data['triggers']['timing_alignment']
    )
    
    # Factor 6: Habit Potential (HP)
    hp = calculate_habit_potential(
        frequency_requirement=behavior_data['behavior']['frequency'],
        reward_consistency=behavior_data['behavior']['reward_schedule'],
        cue_stability=behavior_data['behavior']['cue_stability']
    )
    
    # Factor 7: Competitive Behavior Analysis (CBA)
    cba = calculate_competitive_behavior_score(
        existing_behaviors=behavior_data['competitive']['current_behaviors'],
        switching_cost=behavior_data['competitive']['switching_cost'],
        relative_advantage=behavior_data['competitive']['advantage']
    )
    
    # Domain-specific weights
    weights = get_domain_weights(behavior_data['domain'])
    
    # Calculate weighted score
    bmf_score = (
        weights['pba'] * pba +
        weights['uas'] * uas +
        weights['ma'] * ma +
        weights['cc'] * cc +
        weights['ta'] * ta +
        weights['hp'] * hp +
        weights['cba'] * cba
    )
    
    # Calculate confidence interval
    confidence_interval = calculate_confidence_interval(
        score=bmf_score,
        sample_size=behavior_data['sample_size'],
        variance=calculate_variance(behavior_data)
    )
    
    return {
        'bmf_score': bmf_score,
        'confidence_interval': confidence_interval,
        'components': {
            'problem_behavior_alignment': pba,
            'user_ability': uas,
            'motivation_alignment': ma,
            'context_compatibility': cc,
            'trigger_availability': ta,
            'habit_potential': hp,
            'competitive_behavior': cba
        },
        'interpretation': interpret_score(bmf_score)
    }

Statistical Validation

Confidence Interval Calculation

def calculate_confidence_interval(score, sample_size, variance, confidence_level=0.95):
    """
    Calculate confidence interval for BMF score
    """
    import numpy as np
    from scipy import stats
    
    # Standard error
    se = np.sqrt(variance / sample_size)
    
    # Z-score for confidence level
    z = stats.norm.ppf((1 + confidence_level) / 2)
    
    # Confidence interval
    margin_of_error = z * se
    ci_lower = max(0, score - margin_of_error)
    ci_upper = min(100, score + margin_of_error)
    
    return {
        'lower': round(ci_lower, 2),
        'upper': round(ci_upper, 2),
        'margin_of_error': round(margin_of_error, 2),
        'confidence_level': confidence_level
    }

Statistical Significance Testing

def test_bmf_significance(behavior_a, behavior_b, data):
    """
    Test if difference in BMF scores is statistically significant
    """
    from scipy import stats
    
    # Calculate scores for both behaviors
    score_a = calculate_bmf_score(data[behavior_a])
    score_b = calculate_bmf_score(data[behavior_b])
    
    # Perform t-test
    t_stat, p_value = stats.ttest_ind(
        data[behavior_a]['raw_scores'],
        data[behavior_b]['raw_scores']
    )
    
    # Effect size (Cohen's d)
    cohens_d = (score_a['bmf_score'] - score_b['bmf_score']) / pooled_std
    
    return {
        'behavior_a_score': score_a['bmf_score'],
        'behavior_b_score': score_b['bmf_score'],
        'difference': score_a['bmf_score'] - score_b['bmf_score'],
        'p_value': p_value,
        'significant': p_value < 0.05,
        'effect_size': cohens_d,
        'interpretation': interpret_effect_size(cohens_d)
    }

Domain-Specific Calibration

Weight Optimization

# Domain weight configurations
DOMAIN_WEIGHTS = {
    'healthcare': {
        'pba': 0.25,  # Problem severity critical in healthcare
        'uas': 0.15,  # Ability important but support available
        'ma': 0.20,   # Motivation crucial for adherence
        'cc': 0.15,   # Context matters for treatment
        'ta': 0.10,   # Triggers can be designed
        'hp': 0.10,   # Habit formation important
        'cba': 0.05   # Less competition in healthcare
    },
    'technology': {
        'pba': 0.15,  # Problems may be less severe
        'uas': 0.20,  # User ability crucial
        'ma': 0.15,   # Varied motivation levels
        'cc': 0.10,   # Digital context flexible
        'ta': 0.15,   # Triggers easily implemented
        'hp': 0.15,   # Habit formation key to retention
        'cba': 0.10   # High competition consideration
    },
    'education': {
        'pba': 0.20,  # Clear learning problems
        'uas': 0.15,  # Scaffolding can help ability
        'ma': 0.25,   # Motivation is critical
        'cc': 0.10,   # Structured context
        'ta': 0.10,   # Schedule-based triggers
        'hp': 0.15,   # Study habits essential
        'cba': 0.05   # Limited competition
    }
}

def optimize_weights(domain, training_data):
    """
    Optimize weights using gradient descent on historical data
    """
    from sklearn.model_selection import cross_val_score
    from sklearn.linear_model import LinearRegression
    
    # Extract features and outcomes
    X = extract_features(training_data)
    y = extract_outcomes(training_data)
    
    # Optimize weights
    model = LinearRegression(positive=True)
    model.fit(X, y)
    
    # Cross-validation
    cv_scores = cross_val_score(model, X, y, cv=5)
    
    return {
        'optimized_weights': dict(zip(FACTORS, model.coef_)),
        'cv_score': np.mean(cv_scores),
        'std_dev': np.std(cv_scores)
    }

Implementation Examples

Python Implementation

class BMFScorer:
    def __init__(self, domain='general'):
        self.domain = domain
        self.weights = DOMAIN_WEIGHTS.get(domain, DOMAIN_WEIGHTS['general'])
        self.threshold_excellent = 80
        self.threshold_good = 65
        self.threshold_viable = 50
    
    def score_behavior(self, behavior_data):
        """Full scoring pipeline"""
        # Validate input data
        self._validate_data(behavior_data)
        
        # Calculate base score
        score_result = calculate_bmf_score(behavior_data)
        
        # Apply domain adjustments
        adjusted_score = self._apply_domain_adjustments(score_result)
        
        # Generate recommendations
        recommendations = self._generate_recommendations(adjusted_score)
        
        return {
            'score': adjusted_score['bmf_score'],
            'classification': self._classify_score(adjusted_score['bmf_score']),
            'confidence_interval': adjusted_score['confidence_interval'],
            'components': adjusted_score['components'],
            'recommendations': recommendations,
            'visualization': self._generate_visualization(adjusted_score)
        }
    
    def _classify_score(self, score):
        if score >= self.threshold_excellent:
            return 'EXCELLENT_FIT'
        elif score >= self.threshold_good:
            return 'GOOD_FIT'
        elif score >= self.threshold_viable:
            return 'VIABLE_FIT'
        else:
            return 'POOR_FIT'

R Implementation

# BMF Scoring in R
calculate_bmf_score <- function(behavior_data) {
  # Load required libraries
  library(tidyverse)
  library(boot)
  
  # Calculate component scores
  components <- list(
    pba = calculate_pba(behavior_data),
    uas = calculate_uas(behavior_data),
    ma = calculate_ma(behavior_data),
    cc = calculate_cc(behavior_data),
    ta = calculate_ta(behavior_data),
    hp = calculate_hp(behavior_data),
    cba = calculate_cba(behavior_data)
  )
  
  # Get domain weights
  weights <- get_domain_weights(behavior_data$domain)
  
  # Calculate weighted score
  bmf_score <- sum(unlist(components) * unlist(weights))
  
  # Bootstrap confidence interval
  boot_ci <- boot(
    data = behavior_data$raw_scores,
    statistic = function(d, i) mean(d[i]),
    R = 1000
  )
  
  ci <- boot.ci(boot_ci, type = "perc")$percent[4:5]
  
  return(list(
    score = bmf_score,
    ci_lower = ci[1],
    ci_upper = ci[2],
    components = components
  ))
}

Validation Dataset Requirements

Minimum Sample Sizes

Domain Minimum N Recommended N Features Required
Healthcare 500 2,000 15 core + 5 domain
Technology 1,000 5,000 15 core + 8 domain
Education 300 1,500 15 core + 6 domain
B2B 200 1,000 15 core + 10 domain

Data Schema

{
  "behavior_id": "uuid",
  "domain": "healthcare|technology|education|b2b",
  "problem": {
    "severity": 0.0-1.0,
    "urgency": 0.0-1.0,
    "prevalence": 0.0-1.0
  },
  "behavior": {
    "complexity": "low|medium|high",
    "effort_required": 0.0-1.0,
    "skill_level": 0.0-1.0,
    "frequency": "daily|weekly|monthly",
    "duration_minutes": integer
  },
  "user": {
    "capability_mean": 0.0-1.0,
    "capability_std": 0.0-0.3,
    "motivation_distribution": {},
    "demographic_factors": {}
  },
  "context": {
    "environmental_support": 0.0-1.0,
    "social_acceptance": 0.0-1.0,
    "resource_availability": 0.0-1.0
  },
  "outcomes": {
    "adoption_rate": 0.0-1.0,
    "sustained_rate_30d": 0.0-1.0,
    "sustained_rate_90d": 0.0-1.0
  }
}

Score Interpretation Guide

Score Ranges

BMF Score Classification Interpretation Recommended Action
80-100 Excellent Fit Behavior naturally aligns with users Scale immediately
65-79 Good Fit Strong alignment with minor barriers Address barriers, then scale
50-64 Viable Fit Moderate alignment, significant barriers Iterate on behavior design
35-49 Poor Fit Weak alignment, major barriers Reconsider behavior selection
0-34 No Fit Fundamental misalignment Return to behavior research

Component Analysis

def interpret_components(components):
    """Generate actionable insights from component scores"""
    insights = []
    
    if components['user_ability'] < 0.5:
        insights.append({
            'issue': 'Low user ability score',
            'impact': 'High abandonment risk',
            'recommendations': [
                'Simplify behavior steps',
                'Add progressive disclosure',
                'Provide skill-building support'
            ]
        })
    
    if components['motivation_alignment'] < 0.6:
        insights.append({
            'issue': 'Weak motivation alignment',
            'impact': 'Low engagement likelihood',
            'recommendations': [
                'Enhance intrinsic rewards',
                'Clarify value proposition',
                'Add social proof elements'
            ]
        })
    
    # Additional component analyses...
    
    return insights

API Integration

# Score a behavior via API
curl -X POST https://api.behavioralstrategy.com/v1/bmf/score \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "behavior_data": {
      "domain": "healthcare",
      "problem": {"severity": 0.8, "urgency": 0.9},
      "behavior": {"complexity": "medium", "effort_required": 0.6},
      "user": {"capability_mean": 0.7, "motivation_distribution": {...}},
      "context": {"environmental_support": 0.6}
    }
  }'

Continuous Improvement

A/B Testing Framework

def ab_test_behaviors(behavior_a, behavior_b, population, duration_days=30):
    """
    Run A/B test comparing two behaviors for BMF
    """
    # Random assignment
    group_a, group_b = random_split(population)
    
    # Deploy behaviors
    deploy_behavior(group_a, behavior_a)
    deploy_behavior(group_b, behavior_b)
    
    # Collect metrics
    results_a = collect_metrics(group_a, duration_days)
    results_b = collect_metrics(group_b, duration_days)
    
    # Calculate BMF scores
    bmf_a = calculate_bmf_score(results_a)
    bmf_b = calculate_bmf_score(results_b)
    
    # Statistical comparison
    comparison = test_bmf_significance(behavior_a, behavior_b, {
        behavior_a: results_a,
        behavior_b: results_b
    })
    
    return {
        'winner': behavior_a if bmf_a > bmf_b else behavior_b,
        'scores': {'a': bmf_a, 'b': bmf_b},
        'statistical_significance': comparison,
        'recommendation': generate_recommendation(comparison)
    }

Licensing: This algorithm specification is protected under the Behavioral Strategy Specification License (BSSL). Commercial implementation requires explicit licensing. See full licensing terms for details.

Attribution: Behavior Market Fit Scoring Algorithm by Jason Hreha. Learn more at behavioralstrategy.com

← Back to Behavioral Strategy Overview