WahomeKezia / Demowith_issues

0 stars 0 forks source link

Running Popular RL algorithms #4

Open WahomeKezia opened 1 year ago

WahomeKezia commented 1 year ago

### 1. td3 I want ot run this Algoritms in a multiprocessing run for the purpose of collecting data .

    from tqdm import tqdm
    #change the data file '../4738-learningfrommodels/benin.csv' to the location of the data file 
    location1="https://gist.githubusercontent.com/slremy/5adf90df6f4c096258f8d8af0f3039dc/raw/d85ac5f204771657b015055eb3b6b9f5dcf33956/location1.csv" # data from togo 
    location2="https://gist.githubusercontent.com/slremy/5adf90df6f4c096258f8d8af0f3039dc/raw/d85ac5f204771657b015055eb3b6b9f5dcf33956/location2.csv"  #data from benin

    # task = Task.init(project_name="RLtesting/non_garage", task_name="all2")
    results=[]
    for algo in [test_td3,test_ddpg,test_sarsa,test_dqn,test_sac,]: #][1:3]
        for location in [location1, location2]:
            with mp.Pool(processes=10) as pool:
                results = pool.map(algo, [location]*5) # changed from 30 to 5
                df = pd.DataFrame(results)
                df["algorithm"]=algo.__name__
                df["location"]="location1" if "togo" in location else "location2"
                df.to_csv(df["algorithm"][0]+df["location"][0]+"_2")
                results.append(df)

        df.to_csv("Results.csv") ```

my first error in running td3 is 

```File "/Users/keziawangeciwahome/miniconda3/envs/dqn/lib/python3.10/site-packages/Popular_RL_Algorithms/td3.py", line 22, in <module>
    from reacher import Reacher
ModuleNotFoundError: No module named 'reacher'
"""```
The above exception was the direct cause of the following exception:

```File "/Users/keziawangeciwahome/miniconda3/envs/dqn/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
ModuleNotFoundError: No module named 'reacher'

to solve this error ,I pip install reacher and got this error next error

      ImportError: cannot import name 'Reacher' from 'reacher' (unknown location)

I will put a pause on td3 because of this error ,

2. ddpg

The error is ,

ModuleNotFoundError: No module named 'common.buffers'
""" ```

The above exception was the direct cause of the following exception:

```  File "/Users/keziawangeciwahome/miniconda3/envs/dqn/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
ModuleNotFoundError: No module named 'common.buffers'

I will put a pause on ddpg too .

For this experiment , I will run dqn , sarsa and sac algorithms and collect their best rewards in one location , plot their performance and evaluate their performance .