A slightly modified deep Q learning approach is used from this paper. Requires chainer. To reproduce run code below with python 2.7; It will run training and monitor of the environment. Training data and some videos will be saved in "cartpole" folder near the script file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from neon.util.argparser import NeonArgparser | |
from neon.layers import Conv, Pooling, MergeBroadcast, BranchNode, Affine, Tree, Dropout | |
from neon.layers import GeneralizedCost, Multicost | |
from neon.initializers import Constant, Xavier | |
from neon.optimizers import GradientDescentMomentum, MultiOptimizer | |
from neon.transforms import Rectlin, Softmax, CrossEntropyMulti, TopKMisclassification | |
from neon.models import Model | |
from neon.data import ArrayIterator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from neon.util.argparser import NeonArgparser | |
from neon.layers import Conv, Pooling, MergeBroadcast, BranchNode, Affine, Tree, Dropout | |
from neon.layers import GeneralizedCost, Multicost | |
from neon.initializers import Constant, Xavier | |
from neon.optimizers import GradientDescentMomentum, MultiOptimizer | |
from neon.transforms import Rectlin, Softmax, CrossEntropyMulti, TopKMisclassification | |
from neon.models import Model | |
from neon.data import ArrayIterator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from neon.util.argparser import NeonArgparser | |
from neon.layers import Conv, Pooling, MergeBroadcast, BranchNode, Affine, Tree, Dropout | |
from neon.layers import GeneralizedCost, Multicost | |
from neon.initializers import Constant, Xavier | |
from neon.optimizers import GradientDescentMomentum, MultiOptimizer | |
from neon.transforms import Rectlin, Softmax, CrossEntropyMulti, TopKMisclassification | |
from neon.models import Model | |
from neon.data import ArrayIterator |
A slightly modified deep Q learning approach is used from this paper. Requires chainer.
To reproduce run code below with python 2.7; It will run training and monitor of the environment. Training data and some videos will be saved in "pendulum" folder near the script file.
Continuous space is discretized with 11 different actions.
It appears that there are some convergence problems; Maybe better selection of parameters would lead to a better objective value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import theano | |
from theano import tensor as T | |
# synapses to compute at once | |
N = 2 ** 13 | |
M = N | |
Sym_rep = 16 | |
x = np.random.randn(N).astype('float32') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import minimize, basinhopping, differential_evolution | |
import numpy as np | |
from autograd import numpy as np, grad | |
class SkoptProxy(): | |
def __init__(self, ModelClass, bounds): | |
self.ModelClass = ModelClass | |
self.X = [] | |
self.Y = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import minimize, basinhopping, differential_evolution | |
import numpy as np | |
from copy import deepcopy | |
from skopt import Optimizer | |
from skopt.learning import GaussianProcessRegressor, RandomForestRegressor, ExtraTreesRegressor | |
from skopt.learning.gaussian_process.kernels import Matern | |
from skopt import space | |
from sklearn.svm import SVR | |
class MultiTaskOptProb(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Comparison of parallel vs sequential optimization, | |
where constant lie appraoch is used. | |
""" | |
from threading import Thread | |
from copy import deepcopy | |
from skopt import Optimizer | |
from skopt.learning import ExtraTreesRegressor, GaussianProcessRegressor | |
from skopt.space import Real | |
import numpy as np |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from skopt import gp_minimize | |
from skopt.space import Real | |
from skopt.plots import plot_convergence | |
from skopt.plots import plot_objective, plot_evaluations | |
import numpy as np | |
np.random.seed(2) | |
# a dummy objective with 6 dimensions |
OlderNewer