refactor: improve string representations#45
Open
cvigilv wants to merge 2 commits intoMichielStock:mainfrom
Open
refactor: improve string representations#45cvigilv wants to merge 2 commits intoMichielStock:mainfrom
cvigilv wants to merge 2 commits intoMichielStock:mainfrom
Conversation
Collaborator
Author
|
Other types: julia> BipolarHV()
10000-element BipolarHV with 5056 positives and 4944 negatives:
-1
1
1
1
1
⋮
-1
-1
-1
-1
-1
julia> BinaryHV()
10000-element BinaryHV with 5036 true and 4964 false:
0
1
0
0
0
⋮
1
0
1
0
1
julia> RealHV()
10000-element RealHV{Float64} with μ ± σ = -0.006 ± 1.006:
2.6116202595969775
-1.892508377213708
0.9741403645815744
0.1405009525163469
0.07264655332880232
⋮
-1.4794770328987807
1.034756806145206
1.0380093547827494
-0.45964829544811403
-0.09244997040145336
julia> GradedBipolarHV()
10000-element GradedBipolarHV{Float64} with μ ± σ = 0.005 ± 0.582:
0.6717833224869785
0.5510791674269708
0.49664159888119963
-0.9390257335078157
0.49205261393994837
⋮
-0.7215113112299928
-0.4892236308339185
0.7215516291881439
-0.2712029753388182
-0.6529738849222699
julia> GradedHV()
10000-element GradedHV{Float64} with μ ± σ = 0.501 ± 0.288:
0.7441905938351135
0.10305724672731151
0.7835908217384924
0.08008971804310389
0.9566298321570428
⋮
0.2922459670460071
0.032410308351557705
0.5892633828477645
0.04585572654633515
0.5148917368076651
Thinking on adding the distribution function for the relevant hypervectors, LMKWYT |
Collaborator
Author
|
I was thinking on this styles: D-element BinaryHV with X trues & Y falses
D-element BipolarHV with X positives & Y negatives
D-element TernaryHV with X positives, Y zeros & Z negatives
D-element RealHV{T} with μ ± σ = X ± Y (distr = Distributions.Normal{Float64}(μ=0.0, σ=1.0) )
D-element GradedHV{T} with μ ± σ = X ± Y (distr = Distributions.Beta{Float64}(α=1.0, β=1.0) )
D-element GradedBipolarHV{T} with μ ± σ = X ± Y (distr = ...)Alternatively, I was thinking on something along the line of: BinaryHV(D=D, true=X, false=Y)
BipolarHV(D=D, positive=X, negative=Y)
TernaryHV(D=D, positives=X, zero=Y, negative=Z)
RealHV{T}(D=D, μ = X, σ = Y, distr=Distributions.Normal{Float64}(μ=0.0, σ=1.0))
... |
Owner
|
Good for me. The representations can still be improved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was playing around with doing some changes to the string representations as during my time using this I found them difficult to parse for some problems. For example, the old version was:
and the new is:
This version is closer to how vectors are represented in Julia. I think something in between would be better, but I would like to know your opinion before investing more time into this as this takes some tinkering since it's more about UX than anything.
I would combine the built-in vector print for long-style and the type one-liner for the short form: