{"id":20507372,"url":"https://github.com/leonvanbokhorst/friction-flow","last_synced_at":"2025-04-13T21:52:55.489Z","repository":{"id":259254498,"uuid":"877153732","full_name":"leonvanbokhorst/friction-flow","owner":"leonvanbokhorst","description":"The Friction-Flow framework aims to analyze and track narrative field dynamics in complex social systems, emphasizing the evolution, interaction, and influence of stories.","archived":false,"fork":false,"pushed_at":"2024-12-13T07:02:13.000Z","size":3600,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:13:39.290Z","etag":null,"topics":["complexity","narrative","narrative-field","narrative-field-dynamics","simulation","simulation-framework","social-dynamics"],"latest_commit_sha":null,"homepage":"https://www.fontysictinnovationlab.nl","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonvanbokhorst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-23T07:19:02.000Z","updated_at":"2025-02-10T14:33:03.000Z","dependencies_parsed_at":"2024-11-23T16:36:39.617Z","dependency_job_id":null,"html_url":"https://github.com/leonvanbokhorst/friction-flow","commit_stats":null,"previous_names":["leonvanbokhorst/lab-politik"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonvanbokhorst%2Ffriction-flow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonvanbokhorst%2Ffriction-flow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonvanbokhorst%2Ffriction-flow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonvanbokhorst%2Ffriction-flow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonvanbokhorst","download_url":"https://codeload.github.com/leonvanbokhorst/friction-flow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788867,"owners_count":21161726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["complexity","narrative","narrative-field","narrative-field-dynamics","simulation","simulation-framework","social-dynamics"],"created_at":"2024-11-15T20:13:43.234Z","updated_at":"2025-04-13T21:52:55.483Z","avatar_url":"https://github.com/leonvanbokhorst.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Friction Flow\n\n[![CI](https://github.com/leonvanbokhorst/friction-flow/actions/workflows/ci.yml/badge.svg)](https://github.com/leonvanbokhorst/friction-flow/actions/workflows/ci.yml)\n\n## Project Overview\n\nFriction Flow is an advanced Python-based research project aimed at developing a framework for analyzing and simulating complex human behavior and group interaction based on Narrative Field Dynamics. This project leverages AI and machine learning techniques, with a focus on integrating Large Language Models (LLMs) for natural language-based decision making and interactions.\n\n## Key Features\n\n1. **Multi-Agent Systems**: Simulates emergent behavior in complex social systems using Graph Attention Networks (GAT)\n2. **Psychological Modeling**: Incorporates models of individual and group psychology with emotional states\n3. **LLM Integration**: Utilizes language models for natural language processing and generation\n4. **Meta-Learning**: Implements Model-Agnostic Meta-Learning (MAML) for rapid adaptation\n5. **Social Network Analysis**: Advanced relationship modeling with quantum-inspired dynamics\n\n## Technical Stack\n\n**Python**: Core programming language (version \u003e= 3.12.6 recommended)\n\n- **PyTorch**: For neural network components and tensor operations\n- **Transformers**: For integration with pre-trained language models\n- **Ray**: For distributed computing\n- **FastAPI**: For service endpoints\n- **Redis**: For state management\n- **Ollama**: For local LLM integration\n- **ChromaDB**: For vector storage and similarity search\n\n## Core Components\n\n### 1. Social Network Analysis (gat_social_network.py)\n\n- Graph Attention Network (GAT) for relationship modeling\n- Multi-head attention mechanisms\n- Community detection using Louvain method\n- Real-time visualization of social dynamics\n- Comprehensive metrics tracking\n- Classroom social dynamics demonstration\n\n### 2. Meta-Learning Framework (maml_model_agnostic_meta_learning.py)\n\n- Model-Agnostic Meta-Learning (MAML) implementation\n- Adaptive learning rate scheduling\n- Skip connections for improved gradient flow\n- Comprehensive visualization capabilities\n- Task-specific adaptation\n- Enhanced visualization with feature importance analysis\n\n### 3. Narrative Field Dynamics\n\nThe project implements three core approaches to narrative field dynamics:\n\n#### Story Waves\n\n- Quantum-inspired approach to modeling narrative dynamics\n- Resonance level tracking\n- Theme interaction analysis\n- Emotional impact measurement\n\n#### Three Story Evolution\n\n- Detailed evolution of interacting stories with emotional states\n- Story state management with resonance tracking\n- Memory-based updating mechanism\n- Collective story emergence analysis\n\n#### Simple Lab Scenario\n\n- Practical application in simulated environments\n- Real-world interaction modeling\n- Team dynamics simulation\n- Ethics and mental health integration\n\n### 4. Belief Systems (bayes_updating.py)\n\n- Bayesian belief updating using LLM embeddings\n- Dynamic confidence tracking\n- Historical state maintenance\n- Time-based decay modeling\n- Visualization of belief evolution\n\n### 5. Deep Learning Components\n\n#### Deep Belief Networks (DBN)\n\n- MNIST demonstration implementation\n- Hierarchical feature learning\n- Layer-wise pretraining\n- Comprehensive visualization tools\n\n#### Hopfield Networks\n\n- Pattern recognition and completion\n- Associative memory demonstration\n- Modern attention-like mechanisms\n- Quantum-inspired dynamics\n\n## Experimental Results\n\n### 1. Social Network Analysis\n\n- Successfully modeled classroom dynamics with 5+ distinct personality types\n- Detected natural community formations\n- Tracked influence pathways between agents\n- Visualized relationship networks and evolution\n\n### 2. Meta-Learning Performance\n\n- Rapid adaptation to new tasks (3-5 gradient steps)\n- Robust performance across varying task complexities\n- Effective feature importance identification\n- Clear visualization of adaptation progress\n\n### 3. Belief System Dynamics\n\n- Demonstrated smooth belief transitions\n- Tracked confidence evolution\n- Showed effective handling of contradictory evidence\n- Visualized belief space trajectories\n\n## Development Guidelines\n\n- Follow PEP 8 style guide and use Black for code formatting\n- Implement type hints as per PEP 484\n- Maintain a minimum of 80% test coverage\n- Adhere to SOLID principles\n- Use meaningful commit messages following conventional commits format\n\n## Testing\n\nRun the test suite using pytest:\n\n```bash\npytest tests/\n```\n\n## CI/CD\n\nThe project uses GitHub Actions for continuous integration with:\n\n- Python 3.12.6 setup\n- Dependency installation\n- Automated testing\n- Code quality checks\n\n## Contributing\n\nWe welcome contributions. Key points:\n\n- No commented-out code in main branch\n- No TODOs in main branch\n- Clear variable and function naming\n- Adherence to DRY and SOLID principles\n\n## License\n\nThis project is licensed under the Apache License 2.0. See the LICENSE file for details.\n\n## Acknowledgments\n\nThis project builds upon research in cognitive science, complex systems theory, social network analysis, and organizational behavior. Special thanks to the open-source community and the developers of the libraries and tools used in this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonvanbokhorst%2Ffriction-flow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonvanbokhorst%2Ffriction-flow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonvanbokhorst%2Ffriction-flow/lists"}