Skip to content

Instantly share code, notes, and snippets.

View adamhaber's full-sized avatar

Adam Haber adamhaber

View GitHub Profile
@adamhaber
adamhaber / jax_psislw.py
Created October 24, 2022 17:41
psislw function ported to jax
from __future__ import division # For Python 2 compatibility
import jax.numpy as np
import jax
from functools import partial
from functools import partial
@partial(jax.jit, static_argnums=(1,2,3))
def psis_single(x, cutoff_ind, cutoffmin, k_min):
# improve numerical accuracy
x -= np.max(x)
{
"source":"great location and great community, some of the members of the management are super nice and friendly and some are hardly so. the maintenance situation could be improved.",
"label":[
1
],
"label-metadata":{
"job-name":"labeling-job/reviews-single-label-pilot-2",
"confidence-map":{
"1":0.04
},
@adamhaber
adamhaber / wrangled_comp.jl
Last active September 6, 2020 20:46
wrangled vs non-wrangled ERGM
using LinearAlgebra,Distributed, Statistics, GraphRecipes, BenchmarkTools, LinearAlgebra, LightGraphs, Plots, RCall, ProfileView, FunctionWrappers, LoopVectorization, ThreadPools, FunctionWranglers
using FunctionWrappers: FunctionWrapper
import LightGraphs:
AbstractGraph,
SimpleGraph,
SimpleDiGraph,
AbstractEdge,
SimpleEdge,
has_edge,
is_directed,
@adamhaber
adamhaber / erg_boilerplate.jl
Created September 6, 2020 07:31
ERG boilerplate
using Distributed, Statistics, GraphRecipes, BenchmarkTools, LinearAlgebra, LightGraphs, Plots, RCall, ProfileView, FunctionWrappers, LoopVectorization, ThreadPools
using FunctionWrappers: FunctionWrapper
using Profile
n = 100
g_orig = erdos_renyi(n, 0.05; is_directed = true)
g_adj = convert(Array{Bool, 2}, collect(adjacency_matrix(g_orig)));
struct erg{G <: AbstractArray{Bool}} <: AbstractGraph{Int}