In [1]:
%matplotlib qt4
from __future__ import division
from models import tools, optimize, models, filters
from models.tests import PerformanceTest
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
In [2]:
data = tools.load_data(limit=200000, offset=1500000)
data = data[filters.sequentize(data) & filters.for_staircase(data)]
print len(data)
In [4]:
def pfa_fun(gamma, delta):
elo = models.EloModel()
pfa = models.PFAModel(prior=elo, gamma=gamma, delta=delta)
pfa_test = PerformanceTest(pfa, landscape.data)
pfa_test.run()
return pfa_test.get_results().rmse
init_parameters = {'gamma': 2, 'delta': -1}
init_epsilons = {'gamma': 0.1, 'delta': 0.05}
landscape = optimize.GreedySearch(data)
landscape.search(pfa_fun, init_parameters, init_epsilons)
Out[4]:
In [28]:
landscape = optimize.GreedySearch2(data)
landscape.search_pfa(number_of_iter=10)
Out[28]:
In [5]:
def pfae_fun(gamma, delta):
elo = models.EloModel()
pfae = models.PFAExt(elo, gamma=gamma, delta=delta)
pfae_test = PerformanceTest(pfae, landscape.data)
pfae_test.run()
return pfae_test.get_results().rmse
init_parameters = {'gamma': 2, 'delta': -1}
init_epsilons = {'gamma': 0.1, 'delta': 0.05}
landscape = optimize.GreedySearch(data)
landscape.search(pfae_fun, init_parameters, init_epsilons)
Out[5]:
In [7]:
def pfag_fun(gamma, delta, decay):
elo = models.EloModel()
pfag = models.PFAGong(prior=elo, gamma=gamma, delta=delta, decay=decay)
pfag_test = PerformanceTest(pfag, landscape.data)
pfag_test.run()
return pfag_test.get_results().rmse
init_parameters = {'gamma': 2, 'delta': 0, 'decay': 0.5}
init_epsilons = {'gamma': 0.1, 'delta': 0.05, 'decay': 0.02}
landscape = optimize.GreedySearch(data)
landscape.search(pfag_fun, init_parameters, init_epsilons)
Out[7]:
In [50]:
landscape = optimize.GreedySearch2(data)
landscape.search_pfag(number_of_iter=10)
Out[50]:
In [4]:
def pfaet_fun(gamma, delta, a, c):
elo = models.EloModel()
pfaet = models.PFAExtTiming(
elo, gamma=gamma, delta=delta,
time_effect_fun=time_effect_fun, a=a, c=c)
pfaet_test = PerformanceTest(pfaet, landscape.data)
pfaet_test.run()
return pfaet_test.get_results().rmse
In [5]:
time_effect_fun = 'pow'
init_parameters = {'gamma': 2, 'delta': -1, 'a': 3, 'c': 0.3}
init_epsilons = {'gamma': 0.1, 'delta': 0.05, 'a': 0.1, 'c': 0.03}
landscape = optimize.GreedySearch(data)
landscape.search(pfaet_fun, init_parameters, init_epsilons, maxiter=30)
Out[5]:
In [6]:
time_effect_fun = 'log'
init_parameters = {'gamma': 2, 'delta': -1, 'a': 1.5, 'c': 0.1}
init_epsilons = {'gamma': 0.1, 'delta': 0.05, 'a': 0.1, 'c': 0.03}
landscape = optimize.GreedySearch(data)
landscape.search(pfaet_fun, init_parameters, init_epsilons, maxiter=30)
Out[6]:
In [7]:
time_effect_fun = 'exp'
init_parameters = {'gamma': 2, 'delta': -1, 'a': 1, 'c': 0.01}
init_epsilons = {'gamma': 0.1, 'delta': 0.05, 'a': 0.1, 'c': 0.005}
landscape = optimize.GreedySearch(data)
landscape.search(pfaet_fun, init_parameters, init_epsilons, maxiter=30)
Out[7]:
In [8]:
def pfagt_fun(a, c, b, d):
elo = models.EloModel()
pfagt = models.PFATiming(
elo,
time_effect_good=time_effect_fun, a=a, c=c,
time_effect_bad=time_effect_fun, b=b, d=d)
pfagt_test = PerformanceTest(pfagt, landscape.data)
pfagt_test.run()
return pfagt_test.get_results().rmse
In [9]:
time_effect_fun = 'pow'
init_parameters = {'a': 3, 'c': 0.3, 'b': 4, 'd': 0.4}
init_epsilons = {'a': 0.1, 'c': 0.03, 'b': 0.1, 'd': 0.04}
landscape = optimize.GreedySearch(data)
landscape.search(pfagt_fun, init_parameters, init_epsilons, maxiter=30)
Out[9]:
In [10]:
time_effect_fun = 'log'
init_parameters = {'a': 1.7, 'c': 0.1, 'b': 0.9, 'd': 0.1}
init_epsilons = {'a': 0.05, 'c': 0.005, 'b': 0.05, 'd': 0.005}
landscape = optimize.GreedySearch(data)
landscape.search(pfagt_fun, init_parameters, init_epsilons, maxiter=30)
Out[10]:
In [11]:
time_effect_fun = 'exp'
init_parameters = {'a': 1.5, 'c': 0.01, 'b': 1.3, 'd': 0.01}
init_epsilons = {'a': 0.1, 'c': 0.003, 'b': 0.1, 'd': 0.003}
landscape = optimize.GreedySearch(data)
landscape.search(pfagt_fun, init_parameters, init_epsilons, maxiter=30)
Out[11]:
In [49]:
landscape = optimize.GreedySearch2(data)
landscape.search_pfagt(number_of_iter=10)
Out[49]:
In [3]:
landscape = optimize.GreedySearch2(data)
landscape.search_pfagt(number_of_iter=10, time_effect_fun='exp')
Out[3]:
In [12]:
def pfart_fun(gamma, delta, zeta):
elo = models.EloModel()
pfart = models.PFAResponseTime(elo, gamma=gamma, delta=delta, zeta=zeta)
pfart_test = PerformanceTest(pfart, landscape.data)
pfart_test.run()
return pfart_test.get_results().rmse
init_parameters = {'gamma': 2, 'delta': -1, 'zeta': 1.5}
init_epsilons = {'gamma': 0.1, 'delta': 0.05, 'zeta': 0.1}
landscape = optimize.GreedySearch(data)
landscape.search(pfart_fun, init_parameters, init_epsilons, maxiter=30)
Out[12]:
In [ ]: