Skip to content

Instantly share code, notes, and snippets.

View jerheff's full-sized avatar

Jeremy Heffner jerheff

  • Winston Salem NC
View GitHub Profile
# Example use of function calling to return structured data from GPT API
import asyncio
import json
import os
import sys
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
@jerheff
jerheff / gist:179cbef6abbaace3c1ef685482f2b09f
Created March 12, 2017 01:30
TensorFlow CPU build with optimizations
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-msse4.2 //tensorflow/tools/pip_package:build_pip_package
@jerheff
jerheff / binary_crossentropy_with_ranking.py
Created January 9, 2016 01:08
Experimental binary cross entropy with ranking loss function
def binary_crossentropy_with_ranking(y_true, y_pred):
""" Trying to combine ranking loss with numeric precision"""
# first get the log loss like normal
logloss = K.mean(K.binary_crossentropy(y_pred, y_true), axis=-1)
# next, build a rank loss
# clip the probabilities to keep stability
y_pred_clipped = K.clip(y_pred, K.epsilon(), 1-K.epsilon())
setwd("~/Desktop/R-tutorial/")
####
# Mapping example
####
# load packages
require(rgdal)
require(raster)
require(leaflet)