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 numpy as np | |
| # Angular distance | |
| def angular_distance(r1, d1, r2, d2): | |
| r1 = np.radians(r1) | |
| r2 = np.radians(r2) | |
| d1 = np.radians(d1) | |
| d2 = np.radians(d2) | |
| a = np.sin(np.abs(d1 - d2)/2) ** 2 | |
| b = np.cos(d1) * np.cos(d2) * np.sin(np.abs(r1 - r2)/2) ** 2 |
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 requests_with_caching | |
| import json | |
| def get_movies_from_tastedive(title): | |
| url = 'https://tastedive.com/api/similar' | |
| param = {} | |
| param['q']= title | |
| param['type']= 'movies' | |
| param['limit']= 5 | |
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
| """ | |
| Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
| BSD License | |
| """ | |
| import numpy as np | |
| # data I/O | |
| data = open('input.txt', 'r').read() # should be simple plain text file | |
| chars = list(set(data)) | |
| data_size, vocab_size = len(data), len(chars) |
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
| ## Auto-Install the following packages | |
| .packs <- c("tidyverse", "lubridate", "ggrepel", "viridis", "scales") | |
| .success <- suppressWarnings(sapply(.packs, require, character.only = TRUE)) | |
| if (length(names(.success)[!.success])) { | |
| install.packages(names(.success)[!.success]) | |
| sapply(names(.success)[!.success], require, character.only = TRUE) | |
| } | |
| if (!require(mxmaps)) | |
| devtools::install_github("diegovalle/mxmaps") | |
| library(mxmaps) |