Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ authors = ["Carlos Vigil-Vásquez", "Dimi Boeckaerts", "Michiel Stock", "Steff T
version = "0.1.0"

[deps]
Distances = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hyperdimensional computing in Julia

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://michielstock.github.io/HyperdimensionalComputing.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://michielstock.github.io/HyperdimensionalComputing.jl/dev)
[![Build Status](https://github.com/dimiboeckaerts/HyperdimensionalComputing.jl/workflows/CI/badge.svg)](https://github.com/dimiboeckaerts/HyperdimensionalComputing.jl/actions)
[![Build Status](https://github.com/MichielStock/HyperdimensionalComputing.jl/workflows/CI/badge.svg)](https://github.com/MichielStock/HyperdimensionalComputing.jl/actions)
[![code style: runic](https://img.shields.io/badge/code_style-%E1%9A%B1%E1%9A%A2%E1%9A%BE%E1%9B%81%E1%9A%B2-black)](https://github.com/fredrikekre/Runic.jl)

This package implements special types of vectors and associated methods for hyperdimensional
Expand Down
10 changes: 4 additions & 6 deletions docs/src/examples/introduction-to-hdc.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Handcalcs #hide

# # Introduction
#
# Hyperdimensional Computing (HDC) is a brain-inspired computational paradigm that represents
Expand Down Expand Up @@ -64,7 +62,7 @@ h₃ = BipolarHV(; D = 8);
# ## Bundling
#
# Bundling (also known as superposition) combines multiple hypervectors to create a new hypervector
# that is similar to it's constituyents.
# that is similar to it's constituents.
#
# $$u = [h_1 + h_2 + h_3]$$
#
Expand All @@ -86,7 +84,7 @@ bundle([h₁, h₂, h₃])

h₁ + h₂ + h₃

# This operation generates a hypervector that is similar to all it's contituyent hypervectors,
# This operation generates a hypervector that is similar to all it's constituent hypervectors,
# such that
#
# $$h₁ \sim u, h₂ \sim u, h₃ \sim u$$
Expand All @@ -97,7 +95,7 @@ h₁ + h₂ + h₃
# ## Binding
#
# Binding combines multiple hypervectors to create a new hypervector that is dissimilar to it's
# constituyents, such that:
# constituents, such that:
#
# $$v = [h₁ \times h₂ \times h₃]$$
#
Expand All @@ -111,7 +109,7 @@ bind([h₁, h₂, h₃])

h₁ * h₂ * h₃

# This operation generates a hypervector that is similar to all it's contituyent hypervectors,
# This operation generates a hypervector that is similar to all it's constituent hypervectors,
# such that
#
# $$h₁ \nsim v, h₂ \nsim v, h₃ \nsim v$$
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ CurrentModule = HyperdimensionalComputing

# HyperdimensionalComputing.jl

Documentation for [HyperdimensionalComputing](https://github.com/dimiboeckaerts/HyperdimensionalComputing.jl).
Documentation for [HyperdimensionalComputing](https://github.com/MichielStock/HyperdimensionalComputing.jl).

## Overview

HyperdimensionalComputing.jl provides...
HyperdimensionalComputing.jl provides types and operations for hyperdimensional computing (HDC), a brain-inspired computational paradigm that represents and manipulates information using high-dimensional vectors. The package supports multiple vector symbolic architectures (BSC, MAP, FHRR, graded) with composable encoding strategies for sets, sequences, key-value pairs, graphs, and numeric levels.

## Manual

Expand Down
4 changes: 1 addition & 3 deletions ext/UnicodePlotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ function Base.show(io::IO, mime::MIME"text/plain", hv::AbstractHV)
end

function Base.show(io::IO, mime::MIME"text/plain", hv::Union{BinaryHV, BipolarHV})
counts = Dict(e => count(==(e), hv) for e in unique(hv))
#n = hv isa BinaryHV ? 0 : -1 # negative element
counts = Dict(string(e) => count(==(e), hv) for e in unique(hv))
println(io, "$(length(hv))-element $(typeof(hv))")
#println(io, "1 / $n : $(count(hv.v)) / $(length(hv) - count(hv.v))")
println(io, barplot(counts))
return println(io, unicodeheatmap(hv))
end
Expand Down
163 changes: 0 additions & 163 deletions scripts/concept.jl

This file was deleted.

4 changes: 1 addition & 3 deletions src/HyperdimensionalComputing.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module HyperdimensionalComputing

using Distances, Random, Distributions, LinearAlgebra
using Random, Distributions, LinearAlgebra

include("types.jl")
export AbstractHV,
Expand Down Expand Up @@ -45,6 +45,4 @@ export similarity,
nearest_neighbor


#include("learning.jl")

end
10 changes: 5 additions & 5 deletions src/encoding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,12 @@ This encoding is based on the following mathematical notation:

*Undirected graphs*
```math
\\otimes_{i=1}^{m} S_i \\otimes T_i
\\oplus_{i=1}^{m} S_i \\otimes T_i
```

*Directed graphs*
```math
\\otimes_{i=1}^{m} S_i \\otimes \\Pi(T_i)
\\oplus_{i=1}^{m} S_i \\otimes \\Pi(T_i)
```

where `K` and `V` are the key and value hypervector collections, `m` is the size of the
Expand Down Expand Up @@ -598,12 +598,12 @@ decodelevel(HV, numvalues; testbound = false) = decodelevel(level(HV, length(num
convertlevel(hvlevels, numvals..., kwargs...)
convertlevel(HV::AbstractHV, numvals..., kwargs...)

Creates the `encoder` and `decoder` for a level incoding in one step. See `encodelevel`
Creates the `encoder` and `decoder` for a level encoding in one step. See `encodelevel`
and `decodelevel` for their respective documentations.
"""
convertlevel(hvlevels, numvals...; kwargs...) = encodelevel(hvlevels, numvals...; kwargs...), decodelevel(hvlevels, numvals..., kwargs...)
convertlevel(hvlevels, numvals...; kwargs...) = encodelevel(hvlevels, numvals...; kwargs...), decodelevel(hvlevels, numvals...; kwargs...)

convertlevel(hv::AbstractHV, numvals...; kwargs...) = encodelevel(hv, numvals...; kwargs...), decodelevel(hv, numvals..., kwargs...)
convertlevel(hv::AbstractHV, numvals...; kwargs...) = encodelevel(hv, numvals...; kwargs...), decodelevel(hv, numvals...; kwargs...)


# levels using FHRR
Expand Down
30 changes: 0 additions & 30 deletions src/learning.jl

This file was deleted.

8 changes: 3 additions & 5 deletions src/operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
operations.jl; This file implements operations that can be done on hypervectors to enable them to encode text-based data.
=#

# Remark: use element-wise reduce, maybe using LazyArrays?

#=

| Operation | symbol | remark |
Expand Down Expand Up @@ -219,7 +217,7 @@ Base.isequal(v::AbstractHV, u::AbstractHV) = v.v == u.v
"""
Base.isapprox(u::AbstractHV, v::AbstractHV, atol=length(u)/100, ptol=0.01)

Measurures when two hypervectors are similar (have more elements in common than expected
Measures when two hypervectors are similar (have more elements in common than expected
by chance).

One can specify either:
Expand All @@ -239,12 +237,12 @@ end
"""
Base.isapprox(u::AbstractHV, v::AbstractHV, atol=length(u)/100, ptol=0.01)

Measurures when two hypervectors are similar (have more elements in common than expected
Measures when two hypervectors are similar (have more elements in common than expected
by chance) using the Hamming distance. Uses a bootstrap to construct a null distribution.

One can specify either:
- `ptol=1e-10` threshold for seeing that many matches due to chance
- `N_bootstap=200` number of samples for bootstrapping
- `N_bootstrap=200` number of samples for bootstrapping
"""
function Base.isapprox(u::T, v::T; ptol = 1.0e-10, N_bootstrap = 500) where {T <: AbstractHV}
@assert length(u) == length(v) "Vectors have to be of equal length"
Expand Down
35 changes: 0 additions & 35 deletions src/predictors.jl

This file was deleted.

Loading
Loading