https://github.com/borchlab/bhive

B-cell Hybrid Immune Variant Engine

https://github.com/borchlab/bhive

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

B-cell Hybrid Immune Variant Engine

Basic Info
  • Host: GitHub
  • Owner: BorchLab
  • License: other
  • Language: R
  • Default Branch: main
  • Homepage:
  • Size: 528 KB
Statistics
  • Stars: 11
  • Watchers: 1
  • Forks: 4
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed 10 months ago
Metadata Files
Readme License

README.md

bHIVE

B-cell Hybrid Immune Variant Engine

R-CMD-check Codecov test coverage <!-- badges: end -->

Introduction

bHIVE is an R package implementing an Artificial Immune Network (AI-Net) algorithm. Inspired by principles of immunology, the bHIVE algorithm evolves a population of "antibodies" to model and analyze datasets. It supports three tasks:

  • Clustering: Groups data points based on similarity.
  • Classification: Assigns labels to data points based on learned patterns.
  • Regression: Predicts continuous outcomes based on input features.

The AI-Net algorithm uses clonal selection and mutation, network suppression, and affinity/distance metrics to iteratively refine the antibody population.

Algorithm Basis

The algorithm operates in the following steps:

  1. Affinity Calculation: For a data point x and an antibody a, the affinity is defined as:

Affinity(x, a) = f(x, a; params)

where f is a similarity kernel such as Gaussian (RBF), Laplace, or cosine similarity.

  1. Clonal Expansion and Mutation: Top-matching antibodies are cloned and mutated:

a' = a + ε

where ε is sampled from a distribution scaled by affinity and iteration parameters.

  1. Network Suppression: Antibodies that are too similar (within a threshold ε) are suppressed to maintain diversity:

Distance(ai, aj) < ε ⇒ Suppress a_j

  1. Assignment: Data points are assigned to antibodies using affinity (for classification/regression) or distance (for clustering).

Installation

To install the bHIVE from GitHub, use:

```R

Install bHIVE from GitHub

devtools::install_github("BorchLab/bHIVE") ```

Examples

Clustering

```

Load the Iris dataset

data(iris) X <- as.matrix(iris[, 1:4]) # Use numeric features only

Run bHIVE for clustering

res <- bHIVE(X = X, task = "clustering", nAntibodies = 30, beta = 5, epsilon = 0.01, maxIter = 20, k = 3)

View clustering results

table(res$assignments) ```

Classification

```

Load the Iris dataset

data(iris) X <- as.matrix(iris[, 1:4]) # Use numeric features y <- iris$Species # Classification labels

Run bHIVE for classification

res <- bHIVE(X = X, y = y, task = "classification", nAntibodies = 30, beta = 5, epsilon = 0.01, maxIter = 20, k = 3)

Compare predicted labels with actual labels

table(Predicted = res$assignments, Actual = y) ```

Regression

```

Load the Iris dataset

data(iris) X <- as.matrix(iris[, 2:4]) # Use other features as predictors y <- iris$Sepal.Length # Regression target

Run bHIVE for regression

res <- bHIVE(X = X, y = y, task = "regression", nAntibodies = 30, beta = 5, epsilon = 0.01, maxIter = 20, k = 3)

Compare predicted values with actual values

cor(res$assignments, y) ```

Bug Reports/New Features

If you run into any issues or bugs please submit a GitHub issue with details of the issue.

If possible please include a reproducible example.

Any requests for new features or enhancements can also be submitted as GitHub issues.

Contributing

We welcome contributions to the bHIVE project! To contribute:

  • Fork the repository.
  • Create a feature branch (git checkout -b feature-branch).
  • Commit your changes (git commit -m "Add new feature").
  • Push to the branch (git push origin feature-branch).
  • Open a pull request.

Owner

  • Name: BorchLab
  • Login: BorchLab
  • Kind: organization

GitHub Events

Total
  • Issues event: 5
  • Watch event: 3
  • Issue comment event: 2
  • Push event: 18
  • Pull request event: 1
  • Fork event: 2
Last Year
  • Issues event: 5
  • Watch event: 3
  • Issue comment event: 2
  • Push event: 18
  • Pull request event: 1
  • Fork event: 2

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 4
  • Total pull requests: 1
  • Average time to close issues: 10 days
  • Average time to close pull requests: about 3 hours
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 1
  • Average time to close issues: 10 days
  • Average time to close pull requests: about 3 hours
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ncborcherding (4)
Pull Request Authors
  • ncborcherding (1)
Top Labels
Issue Labels
enhancement (2) bug (1)
Pull Request Labels