Skip to content

modaus/libSV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libSV

libSV is a high-performance C++ library for Shapley value computations with Python bindings.

Overview

libSV provides efficient algorithms for computing Shapley values in cooperative game theory. The library features:

  • Fast C++ Backend: Core computations implemented in optimized C++
  • Python Interface: Easy-to-use Python bindings with inheritance support
  • Multiple Algorithms: Exact computation and Monte Carlo approximation
  • Extensible Design: Create custom games by inheriting the base Game class
  • Built-in Games: Voting games, weighted voting games, and more

Quick Install

pip install -e .

Quick Example

import libsv

# Create a weighted voting game
players = [0, 1, 2, 3]
weights = [40, 30, 20, 10]
quota = 60

game = libsv.WeightedVotingGame(players, weights, quota)
calculator = libsv.ShapleyCalculator()

# Compute Shapley values
shapley_values = calculator.compute_exact(game)
print(f"Shapley values: {shapley_values}")

Documentation

See docs/README.md for complete documentation, API reference, and examples.

Project Structure

libSV/
├── libSV/
│   ├── include/          # C++ headers
│   └── src/              # C++ implementation
├── examples/             # Python examples
├── tests/                # Unit tests
├── docs/                 # Documentation
├── CMakeLists.txt        # Build configuration
└── setup.py              # Python package setup

Development

# Build with CMake
mkdir build && cd build
cmake .. && make

# Run tests
cmake -DBUILD_TESTS=ON .. && make && ctest

# Install development version
pip install -e .

License

MIT License - see LICENSE file for details.

About

A library for Shapley value computation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published