Skip to content

henu-wang/decision-frameworks-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

decision-frameworks

Python library providing structured decision-making frameworks. Evaluate options, weigh trade-offs, and prioritize tasks using proven analytical methods.

Why?

Good decisions follow repeatable processes. This library implements three widely-used decision frameworks as simple Python classes, so you can integrate structured thinking into your scripts, notebooks, and applications.

Inspired by the mental models of Buffett, Munger, and other great decision-makers. For a curated collection of decision-making principles, see KeepRule.

Install

pip install decision-frameworks

Frameworks

DecisionMatrix

Weighted multi-criteria evaluation. Score options against criteria with importance weights to find the best choice.

from decision_frameworks import DecisionMatrix

matrix = DecisionMatrix("Choose a Cloud Provider")
matrix.add_option("aws", "AWS")
matrix.add_option("gcp", "GCP")
matrix.add_option("azure", "Azure")

matrix.add_criteria("pricing", "Pricing", weight=3)
matrix.add_criteria("ml", "ML Services", weight=2)
matrix.add_criteria("dx", "Developer Experience", weight=2)

matrix.score("aws", "pricing", 7).score("aws", "ml", 8).score("aws", "dx", 6)
matrix.score("gcp", "pricing", 8).score("gcp", "ml", 9).score("gcp", "dx", 8)
matrix.score("azure", "pricing", 7).score("azure", "ml", 7).score("azure", "dx", 5)

best = matrix.get_best_option()
print(f"Best: {best.label} (score: {best.normalized_score})")

matrix.print_summary()

Features:

  • Weighted scoring with customizable scales
  • Ranking and normalized scores
  • JSON serialization/deserialization
  • Fluent chaining API

ProsConsList

Structured advantages/disadvantages analysis with optional weighting.

from decision_frameworks import ProsConsList

pc = ProsConsList("Accept the job offer?")
pc.add_pro("40% salary increase", weight=3)
pc.add_pro("Better engineering culture", weight=2)
pc.add_pro("Remote-friendly", weight=1)
pc.add_con("Startup risk", weight=2)
pc.add_con("Smaller team", weight=1)

result = pc.evaluate()
print(result["recommendation"])  # "Leaning YES"
print(f"Confidence: {result['confidence']:.0%}")

pc.print_summary()

Features:

  • Weighted pros and cons
  • Category grouping
  • Quantified recommendation with confidence score
  • Net score calculation

EisenhowerMatrix

Prioritize tasks by urgency and importance into four action quadrants.

from decision_frameworks import EisenhowerMatrix

em = EisenhowerMatrix()
em.add_task("Fix production outage", urgent=True, important=True)
em.add_task("Design Q3 architecture", urgent=False, important=True)
em.add_task("Respond to vendor email", urgent=True, important=False)
em.add_task("Reorganize Jira board", urgent=False, important=False)

# Get prioritized action plan
plan = em.get_action_plan()
for item in plan:
    print(f"[{item['action']}] {item['task']}")

em.print_summary()

Features:

  • Automatic quadrant classification
  • Prioritized action plan generation
  • Summary statistics
  • Formatted print output

Use Cases

  • Technical decisions -- Compare databases, frameworks, or architectures
  • Career decisions -- Weigh job offers, project choices, or skill investments
  • Sprint planning -- Prioritize backlog items by impact and urgency
  • Investment analysis -- Evaluate opportunities using structured frameworks
  • Team retrospectives -- Quantify pros/cons of process changes

API Reference

DecisionMatrix

Method Description
add_option(id, label, **meta) Add an option
add_criteria(id, label, weight=1.0) Add a criterion
set_weight(criteria_id, weight) Update criterion weight
score(option_id, criteria_id, value) Score an option (1-10)
calculate() Get sorted results
get_best_option() Get top scorer
get_ranking() Get ranked list
to_json() / from_json(s) Serialize/deserialize

ProsConsList

Method Description
add_pro(text, weight=1.0, category="general") Add advantage
add_con(text, weight=1.0, category="general") Add disadvantage
evaluate() Get recommendation
get_by_category() Group by category

EisenhowerMatrix

Method Description
add_task(text, urgent, important) Add a task
get_quadrant(quadrant) Get tasks in quadrant
get_all_quadrants() Get all quadrants
get_action_plan() Prioritized task list
summary() Count per quadrant

License

MIT

About

Python decision-making frameworks library - structured analysis tools for better decisions. https://keeprule.com

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors