Skip to content
This repository has been archived by the owner on Aug 11, 2023. It is now read-only.

Weird MethodError with sample #5

Closed
domluna opened this issue Dec 1, 2018 · 3 comments
Closed

Weird MethodError with sample #5

domluna opened this issue Dec 1, 2018 · 3 comments

Comments

@domluna
Copy link

domluna commented Dec 1, 2018

julia> import ReinforcementLearningBase: interact!, getstate, reset!, plotenv,
       actionspace, sample

julia> using ReinforcementLearningEnvironmentGym
[ Info: Recompiling stale cache file /Users/domluna/.julia/compiled/v1.0/ReinforcementLearningEnvironmentGym/NBild.ji for ReinforcementLearningEnvironmentGym [1053412c-b184-11e8-2eb2-ef51b44fed15]

julia>

julia>

julia>

julia> env = GymEnv("CartPole-v1")
/Users/domluna/.julia/conda/3/lib/python3.7/site-packages/gym/envs/registration.py:14: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
  result = entry_point.load(False)
GymEnv{ReinforcementLearningBase.DiscreteSpace,ReinforcementLearningBase.BoxSpace{Float32,1}}(PyObject <TimeLimit<CartPoleEnv<CartPole-v1>>>, ReinforcementLearningBase.BoxSpace{Float32,1}(Float32[-4.8, -3.40282e38, -0.418879, -3.40282e38], Float32[4.8, 3.40282e38, 0.418879, 3.40282e38]), ReinforcementLearningBase.DiscreteSpace(2, 1), PyObject array([-0.02771541,  0.03014857, -0.0028666 ,  0.00249575]))

julia> sample(env.actionspace)
ERROR: MethodError: no method matching sample(::ReinforcementLearningBase.DiscreteSpace)
Closest candidates are:
  sample(::ReinforcementLearningBase.MultiBinarySpace) at /Users/domluna/.julia/packages/ReinforcementLearningBase/rsuom/src/spaces/multibinaryspace.jl:9
  sample(::ReinforcementLearningBase.DiscreteSpace) at /Users/domluna/.julia/packages/ReinforcementLearningBase/rsuom/src/spaces/discretespace.jl:7
  sample(::ReinforcementLearningBase.BoxSpace) at /Users/domluna/.julia/packages/ReinforcementLearningBase/rsuom/src/spaces/boxspace.jl:30
  ...
Stacktrace:
 [1] top-level scope at none:0
@jbrea
Copy link
Contributor

jbrea commented Dec 1, 2018

I don't fully understand this issue, but I think if you replace the first line with

julia> import ReinforcementLearningEnvironmentGym: interact!, getstate, reset!, plotenv,
       actionspace, sample

it should work.

@domluna
Copy link
Author

domluna commented Dec 1, 2018

Thanks @jbrea that works but I'm not sure why. sample isn't defined anywhere in ReinforcementLearningEnvironmentGym, nor is it imported in the module.

@findmyway
Copy link
Member

I'm closing this issue since I just tagged a new release and sample is not included in the API now.

By the way, your JuliaFormatter.jl is awesome! 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants