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 / test.cpp
Created March 20, 2017 12:45
Maxi Object Timing Check
#include <iostream>
#include "/home/tollie/Development/Maximilian/maximilian.h"
#include <vector>
#include <algorithm>
#include <chrono>
size_t amount = 1;
std::vector<maxiOsc> maxiObjects;
void process()
@fedden
fedden / elitism.py
Last active October 12, 2017 17:52
dfo_elitism
for i, p in enumerate(self.population):
if elitism > 0 and i in n_fittest:
pass
@fedden
fedden / decay.py
Created October 12, 2017 18:06
dfo_decay
self.disturbance_threshold *= decay
@fedden
fedden / multi.py
Created October 12, 2017 18:11
multi_dfo
envs = [gym.make(self.env_name) for _ in range(multiprocessing.cpu_count())]
amount_per_thread = int(np.floor(self.population_size / multiprocessing.cpu_count()))
left_over = self.population_size - amount_per_thread * multiprocessing.cpu_count()
fitnesses = np.zeros(len(self.population))
def get_weights_reward(begin, size, env):
for i in range(begin, begin + size):
fitnesses[i] = -self.get_reward(self.population[i],
@fedden
fedden / god_fly.py
Created October 12, 2017 18:15
god fly dfo
swarms_best_index = np.argmin(fitnesses)
self.swarms_best_score = np.amin(fitnesses)
self.swarms_best = self.population[swarms_best_index]
if self.swarms_best_score <= self.all_time_best_score:
self.all_time_best_score = self.swarms_best_score
self.all_time_best = self.swarms_best
@fedden
fedden / original.py
Created October 12, 2017 18:22
original
if self.mode == 'original':
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 = self.swarms_best[x] - best_neighbour[x]
p[x] = best_neighbour[x] + leader_rate * update
@fedden
fedden / hybrid.py
Created October 12, 2017 18:28
hybrid
elif self.mode == 'hybrid':
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 = (best_neighbour[x] + self.swarms_best[x]) / 2.0 - p[x]
p[x] = p[x] + leader_rate * update
@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 / DFOGym.ipynb
Last active October 12, 2017 19:03
Using DFO to Optimise TensorFlow Neural Networks
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.