Skip to content

Instantly share code, notes, and snippets.

# source: https://facebook.github.io/prophet/docs/quick_start.html
from fbprophet import Prophet
COUNTRY = 'Italy'
# filter data
df_plot = df[df.countriesAndTerritories.isin([COUNTRY])]
df_plot = (df_plot.set_index('dateRep'))['cases'].sort_index()
m = Prophet(yearly_seasonality=False, daily_seasonality=True)
m.add_seasonality(name='monthly', period=30.5, fourier_order=3)
@ucaiado
ucaiado / pg-pong.py
Created September 14, 2018 02:49 — forked from karpathy/pg-pong.py
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
@ucaiado
ucaiado / foo.py
Created May 2, 2018 15:59
Use rl_trading library to collect book informations
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Use data already downloaded to recover the bid ask prices of differet
instruments
@author: ucaiado
Created on 05/02/2018
"""
@ucaiado
ucaiado / stacking_example.py
Created March 10, 2018 23:42 — forked from geffy/stacking_example.py
Stacking example
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 23 23:16:44 2017
@author: Marios Michailidis
This is an example that performs stacking to improve mean squared error
This examples uses 2 bases learners (a linear regression and a random forest)
and linear regression (again) as a meta learner to achieve the best score.
The initial train data are split in 2 halves to commence the stacking.
@ucaiado
ucaiado / client.py
Created January 11, 2018 04:56
Script client.py sends xy data over a datagram socket to the server.py which displays them on matplotlib. Run the server in one console and then the client on another. You should see an interactive display of xy data as they arrive. Using Python 3.
import time
import socket
import math
import json
addr = ("127.0.0.1", 12000)
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
clientSocket.settimeout(1)
@ucaiado
ucaiado / sample.md
Last active January 9, 2018 18:01
keep_jupyter_running_on_aws
$ cd path/to/run/jupyter
$ nohup jupyter notebook --ip=0.0.0.0 --no-browser &
$ cat nohup.out
# Enable tab completion
source ~/git-completion.bash
# colors!
green="\[\033[0;32m\]"
blue="\[\033[0;34m\]"
purple="\[\033[0;35m\]"
reset="\[\033[0m\]"
# Change command prompt
@ucaiado
ucaiado / multi-git.md
Created April 5, 2016 18:44 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@ucaiado
ucaiado / ipython_style.css
Created March 15, 2016 13:58
Ipython stylesheet
<style>
@font-face {
font-family: "Computer Modern";
src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunss.otf');
}
@font-face {
font-family: "Computer Modern";
font-weight: bold;
src: url('http://9dbb143991406a7c655e-aa5fcb0a5a4ec34cff238a2d56ca4144.r56.cf5.rackcdn.com/cmunsx.otf');
}
@ucaiado
ucaiado / gist:1aa43124a411222259d7
Last active October 8, 2015 19:07
Academic stuff

#ACADEMIC STUFF

####Some important codes

pandoc -S -o sample-paper.pdf --template=template1 --filter pandoc-citeproc sample-paper.md