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
Simulator.run(): Trial 95 | |
Environment.reset(): Trial set up with start = (6, 4), destination = (2, 1), deadline = 35 | |
RoutePlanner.route_to(): destination = (2, 1) | |
LearningAgent.update(): deadline = 35, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = left, reward = 2.0 | |
LearningAgent.update(): deadline = 34, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = None, reward = 0.0 | |
LearningAgent.update(): deadline = 33, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = None, reward = 0.0 | |
LearningAgent.update(): deadline = 32, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = forward, reward = 2.0 | |
LearningAgent.update(): deadline = 31, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = forward, reward = 2.0 | |
LearningAgent.update(): deadline = 30, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = forward, reward = 2. |
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
# Format of results | |
(light, next_waypoint)[None, 'forward', 'left', 'right'] | |
('green', 'right', None) ['4.00', '4.00', '4.00', '4.00'] | |
('red', 'right', 'left') ['4.00', '4.00', '4.00', '4.00'] | |
('red', 'forward', None) ['4.00', '4.00', '4.00', '4.00'] | |
('green', 'right', 'left') ['1.44', '4.00', '4.00', '4.00'] | |
('red', None, 'left') ['0.00', '-0.91', '-0.99', '-0.07'] | |
('green', None, None) ['4.00', '4.00', '4.00', '4.00'] | |
('green', 'left', 'left') ['1.44', '4.00', '4.00', '4.00'] |
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 random | |
from environment import Agent, Environment | |
from planner import RoutePlanner | |
from simulator import Simulator | |
class LearningAgent(Agent): | |
"""An agent that learns to drive in the smartcab world.""" | |
def __init__(self, env): | |
super(LearningAgent, self).__init__(env) # sets self.env = env, state = None, next_waypoint = None, and a default color |
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
# Format of results | |
(light, oncoming, next_waypoint)[None, 'forward', 'left', 'right'] | |
('green', 'right', None) ['4.00', '4.00', '4.00', '4.00'] | |
('red', 'right', 'left') ['4.00', '4.00', '4.00', '4.00'] | |
('red', 'forward', None) ['4.00', '4.00', '4.00', '4.00'] | |
('green', 'right', 'left') ['4.00', '4.00', '4.00', '4.00'] | |
('red', None, 'left') ['0.01', '-0.37', '-0.50', '0.57'] | |
('green', None, None) ['4.00', '4.00', '4.00', '4.00'] | |
('green', 'left', 'left') ['3.16', '2.94', '3.40', '4.00'] |
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 random | |
from environment import Agent, Environment | |
from planner import RoutePlanner | |
from simulator import Simulator | |
class LearningAgent(Agent): | |
"""An agent that learns to drive in the smartcab world.""" | |
def __init__(self, env): | |
super(LearningAgent, self).__init__(env) # sets self.env = env, state = None, next_waypoint = None, and a default color |
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
Environment.reset(): Trial set up with start = (8, 6), destination = (1, 4), deadline = 45 | |
RoutePlanner.route_to(): destination = (1, 4) | |
LearningAgent.update(): deadline = 45, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = left, reward = 2.0 | |
LearningAgent.update(): deadline = 44, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = left, reward = -1.0 | |
LearningAgent.update(): deadline = 43, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = left, reward = -1.0 | |
LearningAgent.update(): deadline = 42, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = None, reward = 0.0 | |
LearningAgent.update(): deadline = 41, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = forward, reward = -1.0 | |
LearningAgent.update(): deadline = 40, inputs = {'light': 'green', 'oncoming': None, 'right': None, 'left': None}, action = right, reward = -0.5 | |
LearningAgent.update(): deadl |
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
Simulator.run(): Trial 0 | |
Environment.reset(): Trial set up with start = (3, 6), destination = (7, 5), deadline = 25 | |
RoutePlanner.route_to(): destination = (7, 5) | |
LearningAgent.update(): deadline = 25, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = None, reward = 0.0 | |
LearningAgent.update(): deadline = 24, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = left, reward = -1.0 | |
LearningAgent.update(): deadline = 23, inputs = {'light': 'red', 'oncoming': None, 'right': 'forward', 'left': None}, action = None, reward = 0.0 | |
LearningAgent.update(): deadline = 22, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = right, reward = 2.0 | |
LearningAgent.update(): deadline = 21, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = forward, reward = -1.0 | |
LearningAgent.update(): deadline = 20, inputs = {'light': 'red', 'oncoming': None, 'right': None, 'left': None}, action = right, reward = -0.5 | |
Lea |
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 random | |
from environment import Agent, Environment | |
from planner import RoutePlanner | |
from simulator import Simulator | |
class LearningAgent(Agent): | |
"""An agent that learns to drive in the smartcab world.""" | |
def __init__(self, env): |
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
# Seeking email that sent the most emails from email logs (text file) | |
# 1. Request file name | |
fname = raw_input('Enter file name: ') | |
# 2. File handle | |
fhandle = open(fname) | |
# 3. Create dictionary | |
counts = dict() |
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
# Collate list of timings and counts, sort, and find most/least common timings in an email log | |
# This script uses mbox.txt to give you an example of how it might work | |
# 1. Prompt for file to load | |
fname = input('Enter file name: ') | |
# 2. File handle to access file | |
fhandle = open(fname) | |
# 3a. Create counts dictionary |