View rwalk_vector_search_cposc_2023.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View techlancaster-vectorsearch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View cooccurence_recommender.py
This file contains 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 argparse | |
import json | |
import sys | |
import warnings | |
import numpy as np | |
from scipy.sparse import load_npz, coo_matrix | |
class CooccurenceRecommender: | |
View s3_read_only_prefix_policy.json
This file contains 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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"s3:ListBucket" | |
], | |
"Resource": [ | |
"arn:aws:s3:::fancy-bucket" |
View goodreads_matrix.py
This file contains 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 json | |
from scipy.sparse import coo_matrix, save_npz | |
import numpy as np | |
print("reading data...") | |
with open("goodreads/interactions.json") as f: | |
data = json.load(f) | |
books = data["books"] | |
interactions = data["interactions"] |
View goodreads_data.py
This file contains 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 json | |
import csv | |
from collections import defaultdict | |
# load the mapping (supplied by the dataset) from id into book_id | |
with open("goodreads/book_id_map.csv") as f: | |
reader = csv.reader(f) | |
_ = next(reader) | |
book_id_map = {int(_id): int(book_id) for _id, book_id in reader} |
View quadprog_ospq_comp_1.R
This file contains 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
library(quadprog) | |
library(osqp) | |
# This gist compares the quadprog solver against OSPQ on a very simple problem. | |
## | |
## The following example comes directly from `?? quadprog` documentation` | |
## | |
## Assume we want to minimize: -(0 5 0) %*% b + 1/2 b^T b | |
## under the constraints: A^T b >= b0 |
View chis2015demo.R
This file contains 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
library(foreign) | |
library(car) | |
library(ggplot2) | |
library(scales) | |
# load the CHIS data | |
file <- "~/projects/CHIS/chis15_adult_stata/Data/ADULT.dta" # your file | |
CHIS <- read.dta(file, convert.factors = TRUE) | |
# Recode insurance type |
View ScalatraChunkedEncoding.scala
This file contains 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 org.json4s.{DefaultFormats, Formats} | |
import scala.language.postfixOps | |
import scalate.ScalateSupport | |
import org.scalatra._ | |
import java.io.PrintWriter | |
class Chunks extends ScalatraServlet with ScalateSupport { | |
/* | |
Simple example of chunked transfer encoding in Scalatra (scala web framework) | |
*/ |
View image_segmentation_demo.R
This file contains 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
# image segmentation demo | |
# author: rwalker (ryan@ryanwalker.us) | |
# license: MIT | |
library("jpeg") | |
library("png") | |
library("graphics") | |
library("ggplot2") | |
library("gridExtra") | |
####################################################################################### |
NewerOlder