Skip to content

Instantly share code, notes, and snippets.

View yrevar's full-sized avatar

yrevar

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yrevar
yrevar / ocv_video_helper.py
Created April 23, 2017 17:46
OpenCV VideoCapture Helper
class VideoHelper(object):
def __init__(self, video_file, frame_start=0, frame_end=np.float('inf'), do_loop=True, preload_frames=1000):
self.preloaded = False
self.preload_frames = preload_frames
self._init_capture(video_file, frame_start, frame_end)
self.do_loop = do_loop
self.paused = False
import numpy as np
from search import *
## Flip-flop
class MaximizeAlternations(Problem):
def __init__(self, initial):
"""initial state is a numpy array with each element representing a bit 0 or 1,
goal state is same size as initial state with all bits turned 1"""
assert sum([n != 0 and n != 1 for n in initial]) == 0, "initial state must contain binary values."
self.initial = initial
@yrevar
yrevar / Exploration Functions.ipynb
Created June 25, 2017 20:55
Exploration Functions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yrevar
yrevar / Huber Loss.ipynb
Created July 1, 2017 05:19
Huber Loss: less sensitivity to outliers (https://en.wikipedia.org/wiki/Huber_loss)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yrevar
yrevar / matplotlib_cheat_sheet.ipynb
Last active April 11, 2019 21:35
Matplotlib Cheat Sheet. Adapted from: Hilpisch, Y. (2012).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yrevar
yrevar / logistic-regression.ipynb
Created June 21, 2018 18:36 — forked from vietjtnguyen/logistic-regression.ipynb
IPython Notebook on Logistic Regression
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.