Comments (11)
Should the 1d view also be vertical or remain horizontal?
from ndarray-show.
yes, 1d remains horizontal, thanks
from ndarray-show.
This indeed seems surprising/counterintuitive if you're working with ndarrays as matrices. I think it'd be best to increment a major version and swap the default order. I only see two dependants (crunch-js, ndarray-ldl-factorization), so hopefully it won't have a large effect, but I'm new here so not 100% confident.
from ndarray-show.
@mikolalysenko @Planeshifter — I never show
a matrix without first transposing. @indiejoseph has a fork that transposes the output. Does anyone support merging this? Otherwise I will create:
- A module that outputs the array in parsable format, à la numpy (effectively includes transposing, I think)
- Another module that mixes this method into ndarray's prototype for you so that, if you desire, console.log(A) is parsable js that reconstructs the array (though perhaps without a guarantee of being trailing-bit-perfect)
from ndarray-show.
I think reworking the order seems reasonable if we increment the major version. The default version should aim to be as intuitive as possible for common cases, and you can always get whatever other order you like by calling ndarray.transpose()
from ndarray-show.
Agreed. Okay. What about output formatting? Do you think aiming for parsable output is a worthwhile goal?
from ndarray-show.
Easily parseable output would be nice, but not at the expense of human readability.
from ndarray-show.
Oops. Nope. I can dig a little more, but doesn't currently appear possible to extend the ndarray prototype, so I'll probably forget about that module. nbd. Probably for the best. console.log(show(A))
isn't much worse than console.log(A)
.
from ndarray-show.
+1 The output of 2d-arrays currently does not adhere to the usual mathematical notation. Please transpose it! I agree that outputting 1d-arrays as a row makes sense in terms of screen space, but then at least you should add a ^T
or similar in the end.
from ndarray-show.
Sorry I've been slow on this! Was debating inside my head what the best variation is. I've just been using:
function show(label,data) {
if( typeof data === 'number' ) {
console.log(label+' = '+data)
} else if( data.dimension === 1 ) {
console.log(label+' = '+ndshow(data))
} else {
console.log(label+' =\n'+ndshow(data.transpose(1,0))+'\n')
}
}
Since most of the time I'm just trying to dump a matrix scalar/vector/matrix to the screen. I also wanted to add formatting configuration and maybe the output = valid input feature. (Edit: uses fixed width float; already has precision)
from ndarray-show.
(not that that should go into the module; only that it's what I'm usually really after.)
from ndarray-show.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndarray-show.