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
| import pandas as pd | |
| import csv | |
| glove_df = pd.read_csv("glove.6B.50d.txt.zip", sep=" ", index_col=0, header=None, | |
| quoting=csv.QUOTE_NONE) | |
| "new york" in glove_df.index | |
| vocabs = list(glove_df.index) |
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
| # jupyter notebook --NotebookApp.iopub_data_rate_limit=1.0e10 | |
| import plotly.graph_objs as go | |
| import plotly.graph_objs as go | |
| import plotly.offline as offline | |
| from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot | |
| offline.init_notebook_mode() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| import os | |
| directory = "sample_dir" | |
| if not os.path.exists(directory): | |
| os.makedirs(directory) |
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
| ls *.png | awk '{print("mv "$1" "$1)}' | sed 's/png/jpg/2' | /bin/sh |
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
| import os | |
| from PIL import Image | |
| src_path = "./testing2/" | |
| out_path = "./" | |
| basewidth = 75 | |
| image_type = (".jpg", ".png", ".JPG", ".PNG", ".JPEG", ".tif", ".tiff", ".TIFF") | |
| image_paths = [] |
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
| import pandas as pd | |
| import os | |
| import shutil | |
| import sys | |
| if len(sys.argv) < 1: | |
| print "provide CSV file argument, followed by target directory argument,",\ | |
| " followed by which column to use from csv file (optional)" | |
| elif len(sys.argv) < 4: | |
| in_file = sys.argv[1] |
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
| import os | |
| import shutil | |
| src_path = "/Users/myazdaniUCSD/Desktop/hourly_colors/" | |
| num_chunks = 6 | |
| target_path = "/Users/myazdaniUCSD/Desktop/some_dir/" | |
| def chunks(l, n): | |
| """ Yield successive n-sized chunks from l. | |
| """ |
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
| def chunks(l, n): | |
| """ Yield successive n-sized chunks from l. | |
| """ | |
| for i in xrange(0, len(l), n): | |
| yield l[i:i+n] |
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
| normalized.probs = function(x) {return(x/sum(x))} | |
| res.H = relevant.images[,normalized.probs(.SD), by = filename.path, .SDcols = paste0("H", c(1:180))] |