Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PCA-based visualization for brain state trajectories and MNIST #75

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

leonvanbokhorst
Copy link
Owner

@leonvanbokhorst leonvanbokhorst commented Dec 9, 2024

  • Add brain state trajectory visualization using word embeddings
  • Visualize emotional and cognitive state transitions in 2D space
  • Calculate and display variance explained by principal components
  • Use GloVe embeddings to represent semantic word meanings

Summary by Sourcery

Add new visualization features for brain state trajectories and butterfly data using PCA, and introduce a BrainLayer class for thought processing with a local LLM.

New Features:

  • Introduce brain state trajectory visualization using word embeddings to visualize emotional and cognitive state transitions in 2D space.
  • Implement a PCA demonstration with the MNIST dataset to explore dimensionality reduction and data reconstruction.
  • Add a new module for visualizing butterfly data patterns using PCA to understand variance and principal components.
  • Develop a BrainLayer class to process thoughts using a local LLM and memory comparison.

- Add brain state trajectory visualization using word embeddings
- Visualize emotional and cognitive state transitions in 2D space
- Calculate and display variance explained by principal components
- Use GloVe embeddings to represent semantic word meanings
Copy link
Contributor

sourcery-ai bot commented Dec 9, 2024

Reviewer's Guide by Sourcery

This PR implements a series of PCA (Principal Component Analysis) demonstrations and a brain state visualization system. The implementation includes three PCA demonstration scripts and a brain layer class that processes thoughts using embeddings. The core focus is on dimensionality reduction techniques and their applications in visualizing high-dimensional data.

Class diagram for the BrainLayer class

classDiagram
    class BrainLayer {
        +Client llm
        +Client memory
        +Collection collection
        +__init__()
        +process_thought(input_text)
    }
    note for BrainLayer "This class processes thoughts using a local LLM and memory embeddings."
Loading

File-Level Changes

Change Details Files
Implementation of MNIST dataset PCA visualization
  • Created a comprehensive PCA demonstration using the MNIST digits dataset
  • Implemented different compression levels visualization (10, 30, 50, 100 components)
  • Added eigendigits visualization for the first 16 principal components
  • Included variance explanation plots for components
pocs/pca_minst.py
Brain state trajectory visualization using word embeddings
  • Implemented word vector loading using GloVe embeddings
  • Created thought streams for different emotional states
  • Added 2D visualization of brain state trajectories
  • Calculated and displayed variance explained by principal components
pocs/pca_brainstates.py
Butterfly pattern PCA demonstration
  • Created synthetic correlated data in a butterfly pattern
  • Implemented PCA visualization with principal components
  • Added variance explanation visualization
  • Included detailed component analysis output
pocs/pca_butterflies.py
Brain layer implementation for thought processing
  • Created BrainLayer class with LLM and memory initialization
  • Implemented three-layer thought processing system
  • Added embedding-based memory comparison functionality
  • Integrated with ollama and chromadb for LLM and memory storage
brain/brain_layer.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai bot changed the title @sourcery-ai Add PCA-based visualization for brain state trajectories and MNIST Dec 9, 2024
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @leonvanbokhorst - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider splitting this PR into two separate ones: one for the PCA demonstrations and visualizations, and another for the brain_layer.py implementation. This will help maintain better logical separation and allow for more focused review of each component.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

leonvanbokhorst and others added 2 commits December 9, 2024 07:10
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
@leonvanbokhorst leonvanbokhorst self-assigned this Dec 9, 2024
@leonvanbokhorst leonvanbokhorst added the enhancement New feature or request label Dec 9, 2024
@leonvanbokhorst leonvanbokhorst added this to the Phase 1 milestone Dec 9, 2024
@leonvanbokhorst leonvanbokhorst merged commit 3c8ef16 into main Dec 9, 2024
1 check passed
@leonvanbokhorst leonvanbokhorst deleted the pca branch December 13, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants