Skip to content

Instantly share code, notes, and snippets.

View bkocis's full-sized avatar
:octocat:
diving in time

Balazs Kocsis bkocis

:octocat:
diving in time
View GitHub Profile
@phpenterprise
phpenterprise / custom-service.sh
Last active February 8, 2021 02:04
Configure Python as a service in AWS EC2
#!/bin/bash
#
# custom-service Start up custom-service
#
# chkconfig: 2345 55 25
# description: the custom service (Python)
#
# processname: custom-service
# Source function library
@karpathy
karpathy / pg-pong.py
Created May 30, 2016 22:50
Training a Neural Network ATARI Pong agent with Policy Gradients from raw pixels
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """
import numpy as np
import cPickle as pickle
import gym
# hyperparameters
H = 200 # number of hidden layer neurons
batch_size = 10 # every how many episodes to do a param update?
learning_rate = 1e-4
gamma = 0.99 # discount factor for reward
@tartakynov
tartakynov / fourex.py
Last active April 23, 2024 02:55
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x