<gh_stars>1-10
import matplotlib
import gym
import pickle

import os
import sys

sys.path.append(os.path.dirname(sys.path[0]))
from lib import plotting
from lib import EpsilonFunction
from lib.RL_Library import TileCodeEstimator, TD_lambda, LSPI

matplotlib.style.use('ggplot')

test = "MountainCar-v0"
state_labels = ['x', 'x_dot']
NLayers = 5
NTiles = 10

env = gym.envs.make(test)

weights = None
estimator = TileCodeEstimator(env, weights, state_labels, NLayers=NLayers, NTiles=NTiles)
stats, estimator = TD_lambda(env, estimator, 10000, EpsilonFunction.DecayEpsilonFunction, display=False, alpha=1e-3)

weights = estimator.weights
pickle.dump(weights, open( "savedmodel.txt", "wb" ) )

import matplotlib
import gym
import pickle

import os
import sys

sys.path.append(os.path.dirname(sys.path[0]))
from lib import plotting
from lib import EpsilonFunction
from lib.RL_Library import TileCodeEstimator, TD_lambda, LSPI

matplotlib.style.use('ggplot')

test = "MountainCar-v0"
state_labels = ['x', 'x_dot']
NLayers = 5
NTiles = 10

env = gym.envs.make(test)

weights = None
estimator = TileCodeEstimator(env, weights, state_labels, NLayers=NLayers, NTiles=NTiles)
stats, estimator = TD_lambda(env, estimator, 10000, EpsilonFunction.DecayEpsilonFunction, display=False, alpha=1e-3)

weights = estimator.weights
pickle.dump(weights, open( "savedmodel.txt", "wb" ) )