-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_buffer_negative.py
40 lines (32 loc) · 1.67 KB
/
clean_buffer_negative.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# The MIT License (MIT)
# Copyright (c) 2017 Riccardo Polvara
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
# PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
# FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# DQN tensorflow implementation for achieving autonomous landing.
from experience_replay_buffer import ExperienceReplayBuffer
def main():
replay_memory_size = 400000
replay_buffer_path = "/home/thebeast/Desktop/buffer_to_merge/negative/buffer_negative.pickle"
replay_buffer = ExperienceReplayBuffer(capacity=replay_memory_size)
#timer_start = time.time()
# Load the Replay buffer from file or accumulate experiences
replay_buffer.load(replay_buffer_path)
#timer_stop = time.time()
original_size = replay_buffer.return_size()
print "Original size: " + str(original_size)
# counter_removed = replay_buffer.clean_action_reward("descend", -1.0)
# print "New size: " + str(replay_buffer.return_size())
# print "Number experiences removed:" + str(counter_removed)
# print "Percentage removed experiences: " + str(100 * counter_removed/float(original_size)) + "%"
# replay_buffer.save("./clean_buffer_positive.pickle")
counter = replay_buffer.count_experiences("descend", -1.0)
print "Tot wrond experiences: " + str(counter)
if __name__ == "__main__":
main()