feat: hypervector string representations#30
Conversation
|
I would provide this as a package extension, as I don't think it makes sense to have this representations as default. I much prefer something along the lines of:
|
|
I split the code into a pkg extension. It works. Should anything else be added? A plotting recipe (maybe not a priority) |
|
I don't think so, I would format this (I can do it manually form this PR) and merge it. I would push forward with #28 |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
Could you put here an example of the string representations? Ideally on alone and one of hypervectors in an array, e.g.: julia> BinaryHV()
julia> [BinaryHV() for _ in 1:5]Just to see how this look, since structures have 2 types of string representations. |
julia> BinaryHV()
10000-element BinaryHV
1 / 0 : 4991 / 5009
┌ ┐
false ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 5 009
true ┤■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 4 991
└ ┘
┌────────────────────────┐ t rue
100 │▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ ┌──┐
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
│▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ │▄▄│
1 │▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄│ └──┘
└────────────────────────┘fa lse
1 100
julia> [BinaryHV()]
1-element Vector{BinaryHV}:
10000-element BinaryHV
mean ± std : 0.503 ± 0.5When UnicodePlots is not loaded, the matrices do not appear. |
|
Ok, by convention the "short" string representation should be 1 line high in order to not break vector/matrix visualization. I would just remove the newline between the '10000-element HV' and 'mean +- std...'. |
|
This should be fine: julia> [RealHV(), RealHV(), RealHV()]
3-element Vector{RealHV{Float64}}:
10000-element RealHV{Float64} - m ± sd: 0.0 ± 1.0
10000-element RealHV{Float64} - m ± sd: 0.0 ± 1.0
10000-element RealHV{Float64} - m ± sd: 0.0 ± 1.0 |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
LGTM, we can merge this if you feel is done |
A work in progress, trying some visuals. Might be overkill