Skip to content

Instantly share code, notes, and snippets.

View fedden's full-sized avatar
🤖
Training deep audio models

Leon Fedden fedden

🤖
Training deep audio models
View GitHub Profile
@fedden
fedden / n_fittest.py
Created October 12, 2017 18:48
n_fittest
elif self.mode == 'n_fittest':
if r[i][x] < self.disturbance_threshold:
p[x] = np.random.normal(dev, mean)
else:
leader_rate = np.random.uniform(0.0, 1.0)
update = np.average(self.population[n_fittest]) - best_neighbour[x]
p[x] = best_neighbour[x] + leader_rate * update
@fedden
fedden / rand.py
Created October 12, 2017 18:58
randoms
elif self.mode == 'random_gauss':
p[x] = np.random.normal(dev, mean)
elif self.mode == 'random_uniform':
p[x] = np.random.sample()
@fedden
fedden / es.ipynb
Created October 15, 2017 21:43
es
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fedden
fedden / diffusion.cpp
Created October 27, 2017 15:17
diffusion
for (auto& agent : unhappy_agents)
{
if (happy_agents.size() > 0)
{
size_t random_index = uniform_random.get_next(agent_size - 1);
if (agents[random_index]->happy)
{
set_agent_randomly_in_same_quadrant(agents[random_index],
agent,
agents,
@fedden
fedden / test_phase.cpp
Created October 27, 2017 15:17
test_phase
for (auto& agent : agents)
{
if (agent->set_happy(partial_grid))
{
happy_agents.push_back(agent);
const size_t hill_index = get_hill_index((*agent), partial_size, grid_size);
if (++most_frequent_hill_indices[hill_index] > max_indices)
{
max_indices = most_frequent_hill_indices[hill_index];
@fedden
fedden / ccxt.py
Created November 2, 2017 13:48
How to load poloniex market data CCXT
import ccxt
# Load the poloniex exhange. There is
# limited functionality available with the
# public API where you don't need to key e.g
# we can query the exchanges's state. We
# can't place trades without setting up a key
# and passing this to ccxt.
poloniex = ccxt.poloniex()
poloniex.load_markets()
@fedden
fedden / dash.bash
Created November 3, 2017 11:24
Dash install
pip install dash # The core dash backend
pip install dash-renderer # The dash front-end
pip install dash-html-components # HTML components
pip install dash-core-components # Supercharged components
pip install plotly --upgrade # Latest Plotly graphing library
@fedden
fedden / all_market_data.py
Created November 3, 2017 11:26
Print Market Data
import ccxt
import time
exchange = ccxt.poloniex()
exchange.load_markets()
delay_seconds = exchange.rateLimit / 1000
symbols = dict()
iteration = 0
@fedden
fedden / dash_market_price.py
Created November 3, 2017 11:42
Dash Market Price Grapher
from collections import deque
import ccxt
import time
import datetime
import dash
from dash.dependencies import Input, Output, Event
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objs as go
import threading
@fedden
fedden / price.ipynb
Created November 3, 2017 16:18
Stock Market Price Prediction TensorFlow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.