Sdr (SDR v0.1.0) View Source
SDR is an Elixir library for Sparse Distributed Representations
Link to this section Summary
Functions
Capacity of a SDR.
Hash encoder.
Overlap of two SDRs.
Overlap of two random similar SDRs given their number of bits n and the number of on bits w.
Linear encoder.
Sparsity of a SDR.
Union of two SDRs.
Union of two random similar SDRs given their number of bits n and the number of on bits w.
Link to this section Functions
Capacity of a SDR.
Examples
iex(1)> Sdr.capacity(2048, 6)
101733385755251712
Hash encoder.
Examples
iex(1)> Sdr.hash(0, 100, 1, 3, 72)
#MapSet<["32BB90E8976AAB5298D5DA10FE66F21D", "AD61AB143223EFBC24C7D2583BE69251", "D2DDEA18F00665CE8623E36BD4E3C7C5"]>
Use MapSet.size/1 to get the length of the MapSet. Use MapSet.to_list/1 to convert it to a list.
Overlap of two SDRs.
Examples
iex(1)> Sdr.overlap(MapSet.new([1, 2]), MapSet.new([2, 3]))
#MapSet<[2]>
Use MapSet.size/1 to get the length of the MapSet. Use MapSet.to_list/1 to convert it to a list.
Overlap of two random similar SDRs given their number of bits n and the number of on bits w.
Linear encoder.
Examples
iex(1)> Sdr.simple(0, 100, 1, 21, 72)
#MapSet<[72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92]>
iex(1)> Sdr.simple(0, 100, 1, 21, 73)
#MapSet<[73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93]>
Use MapSet.size/1 to get the length of the MapSet. Use MapSet.to_list/1 to convert it to a list.
Sparsity of a SDR.
Examples
iex(1)> Sdr.sparsity(2048, 6)
0.0029296875
Union of two SDRs.
Examples
iex(1)> Sdr.union(MapSet.new([1, 2]), MapSet.new([2, 3]))
#MapSet<[1, 2, 3]>
Use MapSet.size/1 to get the length of the MapSet. Use MapSet.to_list/1 to convert it to a list.
Union of two random similar SDRs given their number of bits n and the number of on bits w.