-
Notifications
You must be signed in to change notification settings - Fork 0
Dummy script: output format #2
Comments
The following code generates a dictionary with number keys along with an array of points on the 2D (or 3D) graph generated. So this could be the printJson function (for now assuming access to is either global or passed as an argument to this function): import codecs, json
M = {0:[],1:[],2:[],3:[],4:[],5:[],6:[],7:[],8:[],9:[]}
i = 0
X_new_list = X_new.tolist()
y_list = y.tolist()
while i < length:
M[y[i]].append(X_new_list[i])
i++
json.dump(M, codecs.open(args['output'], 'w', encoding='utf-8')) This assumes X_new was generated by the function and arguments defined by the user through command line parameters. How does this look? You could also define M by looping through y -- let me know if you want that more general code too... |
I got to get use to this ... committing a minute ago dropped my indentation of the while loop. |
Oops, I left out the line length = len(X_new_list) just before the while-loop begins. |
This is a good starting point. Here's my initial feedback, in no particular order:
|
Specification as laid out in the first post could look something like this:
Which, as a Python function, would look something like this: import json
def dumpJSON(X_proj, X_orig, outfile, y = None):
out = []
for index, (x_proj, x_orig) in enumerate(zip(X_proj, X_orig)):
d = {"x": x_proj, "y": None, "data": x_orig}
if y is not None:
d["y"] = y[index]
out.append(d)
json.dump(out, open(outfile, "w")) This is obviously still an oversimplification because |
If you place label ([,z]) upstream, it requires less space, The portion is linear relative to the data set. Also, upstream ([,z]) values allow for iterating through all sets with linear time fewer references to correlated colors/shapes assigned to the MNIST dataset expected digital interpretation. As for passing the full videos, I agree. I believe we could have a different API call for retrieving the correlated data, and we could do that by replacing the "data" value with an "index" value. Javascript could make API calls asking for the raw data found in specified "index" when a user clicks on one of the vertexes in the graph. By that I mean we would create html objects with properties passed to bokeh functions and other values defined by a jQuery (or a more recent, equitable replacement) AJAX GET API call. How does this sound? |
Thank you for fixing my first response, it looks good now! |
I checked in a new version of dummy script. Let me know any concerns regarding style and/or functionality. |
@submyers I have gone ahead and hooked the |
I think there's a good argument for JSON output format: it's very flexible, allows for hierarchies (which I think is good for embedding "original data" into the projected data), and it's kinda-sorta human-readable.
As for the actual layout of the JSON file, here's what I'm thinking:
Just a first stab. Anything else?
The text was updated successfully, but these errors were encountered: