SYMBOL INDEX (2621 symbols across 66 files) FILE: agents.py class Thing (line 47) | class Thing: method __repr__ (line 52) | def __repr__(self): method is_alive (line 55) | def is_alive(self): method show_state (line 59) | def show_state(self): method display (line 63) | def display(self, canvas, x, y, width, height): class Agent (line 69) | class Agent(Thing): method __init__ (line 82) | def __init__(self, program=None): method can_grab (line 95) | def can_grab(self, thing): function TraceAgent (line 101) | def TraceAgent(agent): function TableDrivenAgentProgram (line 118) | def TableDrivenAgentProgram(table): function RandomAgentProgram (line 136) | def RandomAgentProgram(actions): function SimpleReflexAgentProgram (line 153) | def SimpleReflexAgentProgram(rules, interpret_input): function ModelBasedReflexAgentProgram (line 168) | def ModelBasedReflexAgentProgram(rules, update_state, model): function rule_match (line 184) | def rule_match(state, rules): function RandomVacuumAgent (line 197) | def RandomVacuumAgent(): function TableDrivenVacuumAgent (line 209) | def TableDrivenVacuumAgent(): function ReflexVacuumAgent (line 231) | def ReflexVacuumAgent(): function ModelBasedVacuumAgent (line 255) | def ModelBasedVacuumAgent(): class Environment (line 285) | class Environment: method __init__ (line 296) | def __init__(self): method thing_classes (line 300) | def thing_classes(self): method percept (line 303) | def percept(self, agent): method execute_action (line 307) | def execute_action(self, agent, action): method default_location (line 311) | def default_location(self, thing): method exogenous_change (line 315) | def exogenous_change(self): method is_done (line 319) | def is_done(self): method step (line 323) | def step(self): method run (line 339) | def run(self, steps=1000): method list_things_at (line 346) | def list_things_at(self, location, tclass=Thing): method some_things_at (line 354) | def some_things_at(self, location, tclass=Thing): method add_thing (line 359) | def add_thing(self, thing, location=None): method delete_thing (line 374) | def delete_thing(self, thing): class Direction (line 387) | class Direction: method __init__ (line 401) | def __init__(self, direction): method __add__ (line 404) | def __add__(self, heading): method move_forward (line 442) | def move_forward(self, from_location): class XYEnvironment (line 466) | class XYEnvironment(Environment): method __init__ (line 475) | def __init__(self, width=10, height=10): method things_near (line 487) | def things_near(self, location, radius=None): method percept (line 496) | def percept(self, agent): method execute_action (line 500) | def execute_action(self, agent, action): method default_location (line 520) | def default_location(self, thing): method move_to (line 527) | def move_to(self, thing, destination): method add_thing (line 541) | def add_thing(self, thing, location=None, exclude_duplicate_class_item... method is_inbounds (line 552) | def is_inbounds(self, location): method random_location_inbounds (line 557) | def random_location_inbounds(self, exclude=None): method delete_thing (line 567) | def delete_thing(self, thing): method add_walls (line 576) | def add_walls(self): method add_observer (line 589) | def add_observer(self, observer): method turn_heading (line 598) | def turn_heading(self, heading, inc): class Obstacle (line 603) | class Obstacle(Thing): class Wall (line 609) | class Wall(Obstacle): class GraphicEnvironment (line 616) | class GraphicEnvironment(XYEnvironment): method __init__ (line 617) | def __init__(self, width=10, height=10, boundary=True, color={}, displ... method get_world (line 630) | def get_world(self): method run (line 660) | def run(self, steps=1000, delay=1): method update (line 670) | def update(self, delay=1): method reveal (line 674) | def reveal(self): method draw_world (line 685) | def draw_world(self): method conceal (line 693) | def conceal(self): class ContinuousWorld (line 702) | class ContinuousWorld(Environment): method __init__ (line 705) | def __init__(self, width=10, height=10): method add_obstacle (line 710) | def add_obstacle(self, coordinates): class PolygonObstacle (line 714) | class PolygonObstacle(Obstacle): method __init__ (line 716) | def __init__(self, coordinates): class Dirt (line 726) | class Dirt(Thing): class VacuumEnvironment (line 730) | class VacuumEnvironment(XYEnvironment): method __init__ (line 736) | def __init__(self, width=10, height=10): method thing_classes (line 740) | def thing_classes(self): method percept (line 744) | def percept(self, agent): method execute_action (line 752) | def execute_action(self, agent, action): class TrivialVacuumEnvironment (line 767) | class TrivialVacuumEnvironment(Environment): method __init__ (line 773) | def __init__(self): method thing_classes (line 778) | def thing_classes(self): method percept (line 781) | def percept(self, agent): method execute_action (line 785) | def execute_action(self, agent, action): method default_location (line 799) | def default_location(self, thing): class Gold (line 808) | class Gold(Thing): method __eq__ (line 810) | def __eq__(self, rhs): class Bump (line 817) | class Bump(Thing): class Glitter (line 821) | class Glitter(Thing): class Pit (line 825) | class Pit(Thing): class Breeze (line 829) | class Breeze(Thing): class Arrow (line 833) | class Arrow(Thing): class Scream (line 837) | class Scream(Thing): class Wumpus (line 841) | class Wumpus(Agent): class Stench (line 846) | class Stench(Thing): class Explorer (line 850) | class Explorer(Agent): method can_grab (line 856) | def can_grab(self, thing): class WumpusEnvironment (line 861) | class WumpusEnvironment(XYEnvironment): method __init__ (line 866) | def __init__(self, agent_program, width=6, height=6): method init_world (line 870) | def init_world(self, program): method get_world (line 900) | def get_world(self, show_walls=True): method percepts_from (line 917) | def percepts_from(self, agent, location, tclass=Thing): method percept (line 937) | def percept(self, agent): method execute_action (line 956) | def execute_action(self, agent, action): method in_danger (line 984) | def in_danger(self, agent): method is_done (line 994) | def is_done(self): function compare_agents (line 1014) | def compare_agents(EnvFactory, AgentFactories, n=10, steps=1000): function test_agent (line 1032) | def test_agent(AgentFactory, steps, envs): FILE: agents4e.py class Thing (line 52) | class Thing: method __repr__ (line 57) | def __repr__(self): method is_alive (line 60) | def is_alive(self): method show_state (line 64) | def show_state(self): method display (line 68) | def display(self, canvas, x, y, width, height): class Agent (line 74) | class Agent(Thing): method __init__ (line 87) | def __init__(self, program=None): method can_grab (line 100) | def can_grab(self, thing): function TraceAgent (line 106) | def TraceAgent(agent): function TableDrivenAgentProgram (line 123) | def TableDrivenAgentProgram(table): function RandomAgentProgram (line 141) | def RandomAgentProgram(actions): function SimpleReflexAgentProgram (line 158) | def SimpleReflexAgentProgram(rules, interpret_input): function ModelBasedReflexAgentProgram (line 173) | def ModelBasedReflexAgentProgram(rules, update_state, transition_model, ... function rule_match (line 189) | def rule_match(state, rules): function RandomVacuumAgent (line 202) | def RandomVacuumAgent(): function TableDrivenVacuumAgent (line 214) | def TableDrivenVacuumAgent(): function ReflexVacuumAgent (line 236) | def ReflexVacuumAgent(): function ModelBasedVacuumAgent (line 260) | def ModelBasedVacuumAgent(): class Environment (line 290) | class Environment: method __init__ (line 301) | def __init__(self): method thing_classes (line 305) | def thing_classes(self): method percept (line 308) | def percept(self, agent): method execute_action (line 312) | def execute_action(self, agent, action): method default_location (line 316) | def default_location(self, thing): method exogenous_change (line 320) | def exogenous_change(self): method is_done (line 324) | def is_done(self): method step (line 328) | def step(self): method run (line 344) | def run(self, steps=1000): method list_things_at (line 351) | def list_things_at(self, location, tclass=Thing): method some_things_at (line 359) | def some_things_at(self, location, tclass=Thing): method add_thing (line 364) | def add_thing(self, thing, location=None): method delete_thing (line 379) | def delete_thing(self, thing): class Direction (line 392) | class Direction: method __init__ (line 406) | def __init__(self, direction): method __add__ (line 409) | def __add__(self, heading): method move_forward (line 447) | def move_forward(self, from_location): class XYEnvironment (line 471) | class XYEnvironment(Environment): method __init__ (line 480) | def __init__(self, width=10, height=10): method things_near (line 492) | def things_near(self, location, radius=None): method percept (line 501) | def percept(self, agent): method execute_action (line 505) | def execute_action(self, agent, action): method default_location (line 522) | def default_location(self, thing): method move_to (line 529) | def move_to(self, thing, destination): method add_thing (line 543) | def add_thing(self, thing, location=None, exclude_duplicate_class_item... method is_inbounds (line 554) | def is_inbounds(self, location): method random_location_inbounds (line 559) | def random_location_inbounds(self, exclude=None): method delete_thing (line 569) | def delete_thing(self, thing): method add_walls (line 581) | def add_walls(self): method add_observer (line 594) | def add_observer(self, observer): method turn_heading (line 603) | def turn_heading(self, heading, inc): class Obstacle (line 608) | class Obstacle(Thing): class Wall (line 614) | class Wall(Obstacle): class GraphicEnvironment (line 621) | class GraphicEnvironment(XYEnvironment): method __init__ (line 622) | def __init__(self, width=10, height=10, boundary=True, color={}, displ... method get_world (line 635) | def get_world(self): method run (line 665) | def run(self, steps=1000, delay=1): method update (line 675) | def update(self, delay=1): method reveal (line 679) | def reveal(self): method draw_world (line 690) | def draw_world(self): method conceal (line 698) | def conceal(self): class ContinuousWorld (line 707) | class ContinuousWorld(Environment): method __init__ (line 710) | def __init__(self, width=10, height=10): method add_obstacle (line 715) | def add_obstacle(self, coordinates): class PolygonObstacle (line 719) | class PolygonObstacle(Obstacle): method __init__ (line 721) | def __init__(self, coordinates): class Dirt (line 731) | class Dirt(Thing): class VacuumEnvironment (line 735) | class VacuumEnvironment(XYEnvironment): method __init__ (line 741) | def __init__(self, width=10, height=10): method thing_classes (line 745) | def thing_classes(self): method percept (line 749) | def percept(self, agent): method execute_action (line 757) | def execute_action(self, agent, action): class TrivialVacuumEnvironment (line 772) | class TrivialVacuumEnvironment(Environment): method __init__ (line 778) | def __init__(self): method thing_classes (line 783) | def thing_classes(self): method percept (line 786) | def percept(self, agent): method execute_action (line 790) | def execute_action(self, agent, action): method default_location (line 804) | def default_location(self, thing): class Gold (line 813) | class Gold(Thing): method __eq__ (line 815) | def __eq__(self, rhs): class Bump (line 822) | class Bump(Thing): class Glitter (line 826) | class Glitter(Thing): class Pit (line 830) | class Pit(Thing): class Breeze (line 834) | class Breeze(Thing): class Arrow (line 838) | class Arrow(Thing): class Scream (line 842) | class Scream(Thing): class Wumpus (line 846) | class Wumpus(Agent): class Stench (line 851) | class Stench(Thing): class Explorer (line 855) | class Explorer(Agent): method can_grab (line 861) | def can_grab(self, thing): class WumpusEnvironment (line 866) | class WumpusEnvironment(XYEnvironment): method __init__ (line 871) | def __init__(self, agent_program, width=6, height=6): method init_world (line 875) | def init_world(self, program): method get_world (line 905) | def get_world(self, show_walls=True): method percepts_from (line 922) | def percepts_from(self, agent, location, tclass=Thing): method percept (line 942) | def percept(self, agent): method execute_action (line 961) | def execute_action(self, agent, action): method in_danger (line 1003) | def in_danger(self, agent): method is_done (line 1013) | def is_done(self): function compare_agents (line 1033) | def compare_agents(EnvFactory, AgentFactories, n=10, steps=1000): function test_agent (line 1051) | def test_agent(AgentFactory, steps, envs): FILE: csp.py class CSP (line 17) | class CSP(search.Problem): method __init__ (line 54) | def __init__(self, variables, domains, neighbors, constraints): method assign (line 65) | def assign(self, var, val, assignment): method unassign (line 70) | def unassign(self, var, assignment): method nconflicts (line 77) | def nconflicts(self, var, val, assignment): method display (line 86) | def display(self, assignment): method actions (line 93) | def actions(self, state): method result (line 104) | def result(self, state, action): method goal_test (line 109) | def goal_test(self, state): method support_pruning (line 118) | def support_pruning(self): method suppose (line 124) | def suppose(self, var, value): method prune (line 131) | def prune(self, var, value, removals): method choices (line 137) | def choices(self, var): method infer_assignment (line 141) | def infer_assignment(self): method restore (line 147) | def restore(self, removals): method conflicted_vars (line 154) | def conflicted_vars(self, current): function no_arc_heuristic (line 164) | def no_arc_heuristic(csp, queue): function dom_j_up (line 168) | def dom_j_up(csp, queue): function AC3 (line 172) | def AC3(csp, queue=None, removals=None, arc_heuristic=dom_j_up): function revise (line 191) | def revise(csp, Xi, Xj, removals, checks=0): function AC3b (line 213) | def AC3b(csp, queue=None, removals=None, arc_heuristic=dom_j_up): function partition (line 263) | def partition(csp, Xi, Xj, checks=0): function AC4 (line 297) | def AC4(csp, queue=None, removals=None, arc_heuristic=dom_j_up): function first_unassigned_variable (line 346) | def first_unassigned_variable(assignment, csp): function mrv (line 351) | def mrv(assignment, csp): function num_legal_values (line 357) | def num_legal_values(csp, var, assignment): function unordered_domain_values (line 367) | def unordered_domain_values(var, assignment, csp): function lcv (line 372) | def lcv(var, assignment, csp): function no_inference (line 380) | def no_inference(csp, var, value, assignment, removals): function forward_checking (line 384) | def forward_checking(csp, var, value, assignment, removals): function mac (line 397) | def mac(csp, var, value, assignment, removals, constraint_propagation=AC... function backtracking_search (line 405) | def backtracking_search(csp, select_unassigned_variable=first_unassigned... function min_conflicts (line 434) | def min_conflicts(csp, max_steps=100000): function min_conflicts_value (line 452) | def min_conflicts_value(csp, var, current): function tree_csp_solver (line 461) | def tree_csp_solver(csp): function topological_sort (line 480) | def topological_sort(X, root): function build_topological (line 507) | def build_topological(node, parent, neighbors, visited, stack, parents): function make_arc_consistent (line 519) | def make_arc_consistent(Xj, Xk, csp): function assign_value (line 538) | def assign_value(Xj, Xk, csp, assignment): class UniversalDict (line 554) | class UniversalDict: method __init__ (line 562) | def __init__(self, value): self.value = value method __getitem__ (line 564) | def __getitem__(self, key): return self.value method __repr__ (line 566) | def __repr__(self): return '{{Any: {0!r}}}'.format(self.value) function different_values_constraint (line 569) | def different_values_constraint(A, a, B, b): function MapColoringCSP (line 574) | def MapColoringCSP(colors, neighbors): function parse_neighbors (line 584) | def parse_neighbors(neighbors): function queen_constraint (line 628) | def queen_constraint(A, a, B, b): class NQueensCSP (line 634) | class NQueensCSP(CSP): method __init__ (line 655) | def __init__(self, n): method nconflicts (line 664) | def nconflicts(self, var, val, assignment): method assign (line 674) | def assign(self, var, val, assignment): method unassign (line 683) | def unassign(self, var, assignment): method record_conflict (line 689) | def record_conflict(self, assignment, var, val, delta): method display (line 696) | def display(self, assignment): function flatten (line 722) | def flatten(seqs): class Sudoku (line 742) | class Sudoku(CSP): method __init__ (line 788) | def __init__(self, grid): method display (line 799) | def display(self, assignment): function Zebra (line 816) | def Zebra(): function solve_zebra (line 883) | def solve_zebra(algorithm=min_conflicts, **args): class NaryCSP (line 898) | class NaryCSP: method __init__ (line 907) | def __init__(self, domains, constraints): method __str__ (line 919) | def __str__(self): method display (line 923) | def display(self, assignment=None): method consistent (line 929) | def consistent(self, assignment): class Constraint (line 939) | class Constraint: method __init__ (line 947) | def __init__(self, scope, condition): method __repr__ (line 951) | def __repr__(self): method holds (line 954) | def holds(self, assignment): function all_diff_constraint (line 962) | def all_diff_constraint(*values): function is_word_constraint (line 967) | def is_word_constraint(words): function meet_at_constraint (line 976) | def meet_at_constraint(p1, p2): function adjacent_constraint (line 986) | def adjacent_constraint(x, y): function sum_constraint (line 991) | def sum_constraint(n): function is_constraint (line 1001) | def is_constraint(val): function ne_constraint (line 1011) | def ne_constraint(val): function no_heuristic (line 1021) | def no_heuristic(to_do): function sat_up (line 1025) | def sat_up(to_do): class ACSolver (line 1029) | class ACSolver: method __init__ (line 1032) | def __init__(self, csp): method GAC (line 1038) | def GAC(self, orig_domains=None, to_do=None, arc_heuristic=sat_up): method new_to_do (line 1091) | def new_to_do(self, var, const): method any_holds (line 1101) | def any_holds(self, domains, const, env, other_vars, ind=0, checks=0): method domain_splitting (line 1120) | def domain_splitting(self, domains=None, to_do=None, arc_heuristic=sat... function partition_domain (line 1143) | def partition_domain(dom): class ACSearchSolver (line 1151) | class ACSearchSolver(search.Problem): method __init__ (line 1155) | def __init__(self, csp, arc_heuristic=sat_up): method goal_test (line 1163) | def goal_test(self, node): method actions (line 1167) | def actions(self, state): method result (line 1180) | def result(self, state, action): function ac_solver (line 1184) | def ac_solver(csp, arc_heuristic=sat_up): function ac_search_solver (line 1189) | def ac_search_solver(csp, arc_heuristic=sat_up): class Crossword (line 1227) | class Crossword(NaryCSP): method __init__ (line 1229) | def __init__(self, puzzle, words): method display (line 1260) | def display(self, assignment=None): class Kakuro (line 1327) | class Kakuro(NaryCSP): method __init__ (line 1329) | def __init__(self, puzzle): method display (line 1382) | def display(self, assignment=None): FILE: deep_learning4e.py class Node (line 15) | class Node: method __init__ (line 22) | def __init__(self, weights=None, value=None): class Layer (line 27) | class Layer: method __init__ (line 33) | def __init__(self, size): method forward (line 36) | def forward(self, inputs): class Activation (line 41) | class Activation: method function (line 43) | def function(self, x): method derivative (line 46) | def derivative(self, x): method __call__ (line 49) | def __call__(self, x): class Sigmoid (line 53) | class Sigmoid(Activation): method function (line 55) | def function(self, x): method derivative (line 58) | def derivative(self, value): class ReLU (line 62) | class ReLU(Activation): method function (line 64) | def function(self, x): method derivative (line 67) | def derivative(self, value): class ELU (line 71) | class ELU(Activation): method __init__ (line 73) | def __init__(self, alpha=0.01): method function (line 76) | def function(self, x): method derivative (line 79) | def derivative(self, value): class LeakyReLU (line 83) | class LeakyReLU(Activation): method __init__ (line 85) | def __init__(self, alpha=0.01): method function (line 88) | def function(self, x): method derivative (line 91) | def derivative(self, value): class Tanh (line 95) | class Tanh(Activation): method function (line 97) | def function(self, x): method derivative (line 100) | def derivative(self, value): class SoftMax (line 104) | class SoftMax(Activation): method function (line 106) | def function(self, x): method derivative (line 109) | def derivative(self, x): class SoftPlus (line 113) | class SoftPlus(Activation): method function (line 115) | def function(self, x): method derivative (line 118) | def derivative(self, x): class Linear (line 122) | class Linear(Activation): method function (line 124) | def function(self, x): method derivative (line 127) | def derivative(self, x): class InputLayer (line 131) | class InputLayer(Layer): method __init__ (line 134) | def __init__(self, size=3): method forward (line 137) | def forward(self, inputs): class OutputLayer (line 145) | class OutputLayer(Layer): method __init__ (line 148) | def __init__(self, size=3): method forward (line 151) | def forward(self, inputs, activation=SoftMax): class DenseLayer (line 159) | class DenseLayer(Layer): method __init__ (line 167) | def __init__(self, in_size=3, out_size=3, activation=Sigmoid): method forward (line 176) | def forward(self, inputs): class ConvLayer1D (line 187) | class ConvLayer1D(Layer): method __init__ (line 193) | def __init__(self, size=3, kernel_size=3): method forward (line 199) | def forward(self, features): class MaxPoolingLayer1D (line 211) | class MaxPoolingLayer1D(Layer): method __init__ (line 217) | def __init__(self, size=3, kernel_size=3): method forward (line 222) | def forward(self, features): class BatchNormalizationLayer (line 237) | class BatchNormalizationLayer(Layer): method __init__ (line 240) | def __init__(self, size, eps=0.001): method forward (line 247) | def forward(self, inputs): function init_examples (line 262) | def init_examples(examples, idx_i, idx_t, o_units): function stochastic_gradient_descent (line 282) | def stochastic_gradient_descent(dataset, net, loss, epochs=1000, l_rate=... function adam (line 314) | def adam(dataset, net, loss, epochs=1000, rho=(0.9, 0.999), delta=1 / 10... function BackPropagation (line 371) | def BackPropagation(inputs, targets, theta, net, loss): function get_batch (line 425) | def get_batch(examples, batch_size=1): class NeuralNetworkLearner (line 431) | class NeuralNetworkLearner: method __init__ (line 437) | def __init__(self, dataset, hidden_layer_sizes, l_rate=0.01, epochs=10... method fit (line 461) | def fit(self, X, y): method predict (line 466) | def predict(self, example): class PerceptronLearner (line 480) | class PerceptronLearner: method __init__ (line 485) | def __init__(self, dataset, l_rate=0.01, epochs=1000, batch_size=10, o... method fit (line 502) | def fit(self, X, y): method predict (line 507) | def predict(self, example): function keras_dataset_loader (line 512) | def keras_dataset_loader(dataset, max_length=500): function SimpleRNNLearner (line 526) | def SimpleRNNLearner(train_data, val_data, epochs=2, verbose=False): function AutoencoderLearner (line 558) | def AutoencoderLearner(inputs, encoding_size, epochs=200, verbose=False): FILE: games.py function minmax_decision (line 20) | def minmax_decision(state, game): function expect_minmax (line 49) | def expect_minmax(state, game): function alpha_beta_search (line 89) | def alpha_beta_search(state, game): function alpha_beta_cutoff_search (line 130) | def alpha_beta_cutoff_search(state, game, d=4, cutoff_test=None, eval_fn... function query_player (line 178) | def query_player(game, state): function random_player (line 196) | def random_player(game, state): function alpha_beta_player (line 201) | def alpha_beta_player(game, state): function minmax_player (line 205) | def minmax_player(game,state): function expect_minmax_player (line 209) | def expect_minmax_player(game, state): class Game (line 217) | class Game: method actions (line 226) | def actions(self, state): method result (line 230) | def result(self, state, move): method utility (line 234) | def utility(self, state, player): method terminal_test (line 238) | def terminal_test(self, state): method to_move (line 242) | def to_move(self, state): method display (line 246) | def display(self, state): method __repr__ (line 250) | def __repr__(self): method play_game (line 253) | def play_game(self, *players): class StochasticGame (line 265) | class StochasticGame(Game): method chances (line 271) | def chances(self, state): method outcome (line 275) | def outcome(self, state, chance): method probability (line 279) | def probability(self, chance): method play_game (line 283) | def play_game(self, *players): class Fig52Game (line 297) | class Fig52Game(Game): method actions (line 307) | def actions(self, state): method result (line 310) | def result(self, state, move): method utility (line 313) | def utility(self, state, player): method terminal_test (line 319) | def terminal_test(self, state): method to_move (line 322) | def to_move(self, state): class Fig52Extended (line 326) | class Fig52Extended(Game): method actions (line 332) | def actions(self, state): method result (line 335) | def result(self, state, move): method utility (line 338) | def utility(self, state, player): method terminal_test (line 344) | def terminal_test(self, state): method to_move (line 347) | def to_move(self, state): class TicTacToe (line 351) | class TicTacToe(Game): method __init__ (line 357) | def __init__(self, h=3, v=3, k=3): method actions (line 365) | def actions(self, state): method result (line 369) | def result(self, state, move): method utility (line 380) | def utility(self, state, player): method terminal_test (line 384) | def terminal_test(self, state): method display (line 388) | def display(self, state): method compute_utility (line 395) | def compute_utility(self, board, move, player): method k_in_row (line 405) | def k_in_row(self, board, move, player, delta_x_y): class ConnectFour (line 421) | class ConnectFour(TicTacToe): method __init__ (line 426) | def __init__(self, h=7, v=6, k=4): method actions (line 429) | def actions(self, state): class Gomoku (line 433) | class Gomoku(TicTacToe): method __init__ (line 436) | def __init__(self, h=15, v=16, k=5): class Backgammon (line 440) | class Backgammon(StochasticGame): method __init__ (line 445) | def __init__(self): method actions (line 460) | def actions(self, state): method result (line 473) | def result(self, state, move): method utility (line 485) | def utility(self, state, player): method terminal_test (line 489) | def terminal_test(self, state): method get_all_moves (line 493) | def get_all_moves(self, board, player): method display (line 507) | def display(self, state): method compute_utility (line 516) | def compute_utility(self, board, move, player): method checkers_at_home (line 524) | def checkers_at_home(self, board, player): method is_legal_move (line 532) | def is_legal_move(self, board, start, steps, player): method move_checker (line 558) | def move_checker(self, board, start, steps, player): method is_point_open (line 568) | def is_point_open(self, player, point): method chances (line 575) | def chances(self, state): method outcome (line 580) | def outcome(self, state, chance): method probability (line 588) | def probability(self, chance): FILE: games4e.py function minmax_decision (line 20) | def minmax_decision(state, game): function expect_minmax (line 49) | def expect_minmax(state, game): function alpha_beta_search (line 89) | def alpha_beta_search(state, game): function alpha_beta_cutoff_search (line 130) | def alpha_beta_cutoff_search(state, game, d=4, cutoff_test=None, eval_fn... function monte_carlo_tree_search (line 178) | def monte_carlo_tree_search(state, game, N=1000): function query_player (line 229) | def query_player(game, state): function random_player (line 247) | def random_player(game, state): function alpha_beta_player (line 252) | def alpha_beta_player(game, state): function expect_min_max_player (line 256) | def expect_min_max_player(game, state): function mcts_player (line 260) | def mcts_player(game, state): class Game (line 268) | class Game: method actions (line 277) | def actions(self, state): method result (line 281) | def result(self, state, move): method utility (line 285) | def utility(self, state, player): method terminal_test (line 289) | def terminal_test(self, state): method to_move (line 293) | def to_move(self, state): method display (line 297) | def display(self, state): method __repr__ (line 301) | def __repr__(self): method play_game (line 304) | def play_game(self, *players): class StochasticGame (line 316) | class StochasticGame(Game): method chances (line 322) | def chances(self, state): method outcome (line 326) | def outcome(self, state, chance): method probability (line 330) | def probability(self, chance): method play_game (line 334) | def play_game(self, *players): class Fig52Game (line 348) | class Fig52Game(Game): method actions (line 358) | def actions(self, state): method result (line 361) | def result(self, state, move): method utility (line 364) | def utility(self, state, player): method terminal_test (line 370) | def terminal_test(self, state): method to_move (line 373) | def to_move(self, state): class Fig52Extended (line 377) | class Fig52Extended(Game): method actions (line 383) | def actions(self, state): method result (line 386) | def result(self, state, move): method utility (line 389) | def utility(self, state, player): method terminal_test (line 395) | def terminal_test(self, state): method to_move (line 398) | def to_move(self, state): class TicTacToe (line 402) | class TicTacToe(Game): method __init__ (line 408) | def __init__(self, h=3, v=3, k=3): method actions (line 416) | def actions(self, state): method result (line 420) | def result(self, state, move): method utility (line 431) | def utility(self, state, player): method terminal_test (line 435) | def terminal_test(self, state): method display (line 439) | def display(self, state): method compute_utility (line 446) | def compute_utility(self, board, move, player): method k_in_row (line 456) | def k_in_row(self, board, move, player, delta_x_y): class ConnectFour (line 472) | class ConnectFour(TicTacToe): method __init__ (line 477) | def __init__(self, h=7, v=6, k=4): method actions (line 480) | def actions(self, state): class Backgammon (line 485) | class Backgammon(StochasticGame): method __init__ (line 490) | def __init__(self): method actions (line 505) | def actions(self, state): method result (line 518) | def result(self, state, move): method utility (line 530) | def utility(self, state, player): method terminal_test (line 534) | def terminal_test(self, state): method get_all_moves (line 538) | def get_all_moves(self, board, player): method display (line 552) | def display(self, state): method compute_utility (line 561) | def compute_utility(self, board, move, player): method checkers_at_home (line 569) | def checkers_at_home(self, board, player): method is_legal_move (line 577) | def is_legal_move(self, board, start, steps, player): method move_checker (line 603) | def move_checker(self, board, start, steps, player): method is_point_open (line 613) | def is_point_open(self, player, point): method chances (line 620) | def chances(self, state): method outcome (line 625) | def outcome(self, state, chance): method probability (line 633) | def probability(self, chance): FILE: gui/eight_puzzle.py function scramble (line 22) | def scramble(): function solve (line 39) | def solve(): function solve_steps (line 45) | def solve_steps(): function exchange (line 61) | def exchange(index): function create_buttons (line 97) | def create_buttons(): function create_static_buttons (line 130) | def create_static_buttons(): function init (line 139) | def init(): FILE: gui/genetic_algorithm_example.py function update_max_population (line 55) | def update_max_population(slider_value): function update_mutation_rate (line 60) | def update_mutation_rate(slider_value): function update_f_thres (line 65) | def update_f_thres(slider_value): function update_ngen (line 70) | def update_ngen(slider_value): function fitness_fn (line 76) | def fitness_fn(_list): function raise_frame (line 88) | def raise_frame(frame, init=False, update_target=False, target_entry=Non... function genetic_algorithm_stepwise (line 145) | def genetic_algorithm_stepwise(population): FILE: gui/grid_mdp.py function extents (line 43) | def extents(f): function display (line 50) | def display(gridmdp, _height, _width): function display_best_policy (line 67) | def display_best_policy(_best_policy, _height, _width): function initialize_dialogbox (line 83) | def initialize_dialogbox(_width, _height, gridmdp, terminals, buttons): function update_table (line 132) | def update_table(i, j, gridmdp, terminals, buttons, reward, term, wall, ... function initialize_update_table (line 166) | def initialize_update_table(_width, _height, gridmdp, terminals, buttons... function reset_all (line 176) | def reset_all(_height, i, j, gridmdp, terminals, buttons, reward, term, ... function initialize_reset_all (line 197) | def initialize_reset_all(_width, _height, gridmdp, terminals, buttons, r... function external_reset (line 207) | def external_reset(_width, _height, gridmdp, terminals, buttons): function widget_disability_checks (line 216) | def widget_disability_checks(i, j, gridmdp, terminals, label_reward, ent... function flatten_list (line 231) | def flatten_list(_list): function initialize_widget_disability_checks (line 236) | def initialize_widget_disability_checks(_width, _height, gridmdp, termin... function dialogbox (line 268) | def dialogbox(i, j, gridmdp, terminals, buttons, _height): class MDPapp (line 320) | class MDPapp(tk.Tk): method __init__ (line 322) | def __init__(self, *args, **kwargs): method placeholder_function (line 365) | def placeholder_function(self): method exit (line 370) | def exit(self): method new (line 375) | def new(self): method get_page (line 385) | def get_page(self, page_class): method view_matrix (line 389) | def view_matrix(self): method view_terminals (line 398) | def view_terminals(self): method initialize (line 403) | def initialize(self): method master_reset (line 409) | def master_reset(self): method build (line 414) | def build(self): method show_frame (line 429) | def show_frame(self, controller, cb=False): class HomePage (line 438) | class HomePage(tk.Frame): method __init__ (line 440) | def __init__(self, parent, controller): class BuildMDP (line 505) | class BuildMDP(tk.Frame): method __init__ (line 507) | def __init__(self, parent, controller): method create_buttons (line 516) | def create_buttons(self): method initialize (line 543) | def initialize(self): method master_reset (line 550) | def master_reset(self): class SolveMDP (line 558) | class SolveMDP(tk.Frame): method __init__ (line 560) | def __init__(self, parent, controller): method process_data (line 573) | def process_data(self, terminals, _height, _width, gridmdp): method create_graph (line 595) | def create_graph(self, gridmdp, terminals, _height, _width): method animate_graph (line 612) | def animate_graph(self, i): method initialize_value_iteration_parameters (line 651) | def initialize_value_iteration_parameters(self, mdp): method value_iteration_metastep (line 656) | def value_iteration_metastep(self, mdp, iterations=20): FILE: gui/romania_problem.py function create_map (line 24) | def create_map(root): function make_line (line 256) | def make_line(map, x0, y0, x1, y1, distance): function make_rectangle (line 262) | def make_rectangle(map, x0, y0, margin, city_name): function make_legend (line 287) | def make_legend(map): function tree_search (line 304) | def tree_search(problem): function graph_search (line 332) | def graph_search(problem): function display_frontier (line 363) | def display_frontier(queue): function display_current (line 374) | def display_current(node): function display_explored (line 381) | def display_explored(node): function display_final (line 388) | def display_final(cities): function breadth_first_tree_search (line 395) | def breadth_first_tree_search(problem): function depth_first_tree_search (line 420) | def depth_first_tree_search(problem): function breadth_first_graph_search (line 446) | def breadth_first_graph_search(problem): function depth_first_graph_search (line 475) | def depth_first_graph_search(problem): function best_first_graph_search (line 503) | def best_first_graph_search(problem, f): function uniform_cost_search (line 543) | def uniform_cost_search(problem): function astar_search (line 548) | def astar_search(problem, h=None): function on_click (line 559) | def on_click(): function reset_map (line 615) | def reset_map(): FILE: gui/tic-tac-toe.py function create_frames (line 22) | def create_frames(root): function create_buttons (line 55) | def create_buttons(frame): function on_click (line 71) | def on_click(button): function check_victory (line 127) | def check_victory(button): function get_coordinates (line 165) | def get_coordinates(button): function get_button (line 176) | def get_button(x, y): function reset_game (line 184) | def reset_game(): function disable_game (line 199) | def disable_game(): function exit_game (line 209) | def exit_game(root): FILE: gui/tsp.py class TSProblem (line 12) | class TSProblem(Problem): method two_opt (line 15) | def two_opt(self, state): method actions (line 25) | def actions(self, state): method result (line 29) | def result(self, state, action): method path_cost (line 33) | def path_cost(self, c, state1, action, state2): method value (line 41) | def value(self, state): class TSPGui (line 46) | class TSPGui(): method __init__ (line 52) | def __init__(self, root, all_cities): method create_checkboxes (line 67) | def create_checkboxes(self, side=LEFT, anchor=W): method create_buttons (line 85) | def create_buttons(self): method create_dropdown_menu (line 93) | def create_dropdown_menu(self): method run_traveling_salesman (line 102) | def run_traveling_salesman(self): method calculate_canvas_size (line 114) | def calculate_canvas_size(self): method create_canvas (line 137) | def create_canvas(self, problem): method exp_schedule (line 189) | def exp_schedule(k=100, lam=0.03, limit=1000): method simulated_annealing_with_tunable_T (line 194) | def simulated_annealing_with_tunable_T(self, problem, map_canvas, sche... method genetic_algorithm (line 221) | def genetic_algorithm(self, problem, map_canvas): method hill_climbing (line 281) | def hill_climbing(self, problem, map_canvas): method on_closing (line 315) | def on_closing(self): FILE: gui/vacuum_agent.py class Gui (line 11) | class Gui(Environment): method __init__ (line 16) | def __init__(self, root, height=300, width=380): method thing_classes (line 28) | def thing_classes(self): method percept (line 33) | def percept(self, agent): method execute_action (line 37) | def execute_action(self, agent, action): method default_location (line 55) | def default_location(self, thing): method create_canvas (line 59) | def create_canvas(self): method create_buttons (line 68) | def create_buttons(self): method dirt_switch (line 79) | def dirt_switch(self, button): method read_env (line 87) | def read_env(self): method update_env (line 101) | def update_env(self, agent): function create_agent (line 112) | def create_agent(env, agent): function move_agent (line 124) | def move_agent(env, agent, before_step): FILE: gui/xy_vacuum_environment.py class Gui (line 9) | class Gui(VacuumEnvironment): method __init__ (line 16) | def __init__(self, root, width=7, height=7, elements=None): method create_frames (line 26) | def create_frames(self): method create_buttons (line 34) | def create_buttons(self): method create_walls (line 47) | def create_walls(self): method display_element (line 63) | def display_element(self, button): method execute_action (line 74) | def execute_action(self, agent, action): method read_env (line 105) | def read_env(self): method update_env (line 119) | def update_env(self): method reset_env (line 128) | def reset_env(self, agt): function XYReflexAgentProgram (line 143) | def XYReflexAgentProgram(percept): class XYReflexAgent (line 162) | class XYReflexAgent(Agent): method __init__ (line 165) | def __init__(self, program=None): FILE: ipyviews.py class ContinuousWorldView (line 28) | class ContinuousWorldView: method __init__ (line 31) | def __init__(self, world, fill="#AAA"): method object_name (line 37) | def object_name(self): method handle_add_obstacle (line 44) | def handle_add_obstacle(self, vertices): method handle_remove_obstacle (line 51) | def handle_remove_obstacle(self): method get_polygon_obstacles_coordinates (line 54) | def get_polygon_obstacles_coordinates(self): method show (line 61) | def show(self): class GridWorldView (line 89) | class GridWorldView: method __init__ (line 96) | def __init__(self, world, block_size=30, default_fill="white"): method object_name (line 103) | def object_name(self): method set_label (line 110) | def set_label(self, coordinates, label): method set_representation (line 117) | def set_representation(self, thing, repr_type, source): method handle_click (line 129) | def handle_click(self, coordinates): method map_to_render (line 134) | def map_to_render(self): method show (line 152) | def show(self): FILE: js/canvas.js function output_callback (line 9) | function output_callback(out, block){ function click_callback (line 23) | function click_callback(element, event, varname){ function rgbToHex (line 33) | function rgbToHex(r,g,b){ function toRad (line 40) | function toRad(x){ function Canvas (line 45) | function Canvas(id){ FILE: js/continuousworld.js function handle_output (line 2) | function handle_output(out, block){ function polygon_complete (line 6) | function polygon_complete(canvas, vertices){ function drawPolygon (line 16) | function drawPolygon(array) { function getPosition (line 28) | function getPosition(obj,event) { function drawPoint (line 55) | function drawPoint(x, y) { function initalizeObstacles (line 62) | function initalizeObstacles(objects) { FILE: js/gridworld.js function handle_output (line 3) | function handle_output(out, block){ function handle_click (line 8) | function handle_click(canvas,coord) { function generateGridWorld (line 21) | function generateGridWorld(state,size,elements) FILE: knowledge.py function current_best_learning (line 15) | def current_best_learning(examples, h, examples_so_far=None): function specializations (line 43) | def specializations(examples_so_far, h): function generalizations (line 64) | def generalizations(examples_so_far, h): function add_or (line 102) | def add_or(examples_so_far, h): function version_space_learning (line 127) | def version_space_learning(examples): function version_space_update (line 141) | def version_space_update(V, e): function all_hypotheses (line 145) | def all_hypotheses(examples): function values_table (line 158) | def values_table(examples): function build_attr_combinations (line 179) | def build_attr_combinations(s, values): function build_h_combinations (line 203) | def build_h_combinations(hypotheses): function minimal_consistent_det (line 221) | def minimal_consistent_det(E, A): function consistent_det (line 231) | def consistent_det(A, E): class FOILContainer (line 247) | class FOILContainer(FolKB): method __init__ (line 250) | def __init__(self, clauses=None): method tell (line 255) | def tell(self, sentence): method foil (line 263) | def foil(self, examples, target): method new_clause (line 280) | def new_clause(self, examples, target): method extend_example (line 295) | def extend_example(self, example, literal): method new_literals (line 302) | def new_literals(self, clause): method choose_literal (line 316) | def choose_literal(self, literals, examples): method gain (line 320) | def gain(self, l, examples): method update_examples (line 352) | def update_examples(self, target, examples, extended_examples): function check_all_consistency (line 369) | def check_all_consistency(examples, h): function check_negative_consistency (line 378) | def check_negative_consistency(examples, h): function disjunction_value (line 390) | def disjunction_value(e, d): function guess_value (line 404) | def guess_value(e, h): function is_consistent (line 413) | def is_consistent(e, h): function false_positive (line 417) | def false_positive(e, h): function false_negative (line 421) | def false_negative(e, h): FILE: learning.py class DataSet (line 13) | class DataSet: method __init__ (line 40) | def __init__(self, examples=None, attrs=None, attr_names=None, target=... method set_problem (line 76) | def set_problem(self, target, inputs=None, exclude=()): method check_me (line 94) | def check_me(self): method add_example (line 104) | def add_example(self, example): method check_example (line 109) | def check_example(self, example): method attr_num (line 117) | def attr_num(self, attr): method update_values (line 126) | def update_values(self): method sanitize (line 129) | def sanitize(self, example): method classes_to_numbers (line 133) | def classes_to_numbers(self, classes=None): method remove_examples (line 141) | def remove_examples(self, value=''): method split_values_by_classes (line 146) | def split_values_by_classes(self): method find_means_and_deviations (line 157) | def find_means_and_deviations(self): method __repr__ (line 187) | def __repr__(self): function parse_csv (line 191) | def parse_csv(input, delim=','): function err_ratio (line 204) | def err_ratio(predict, dataset, examples=None): function grade_learner (line 221) | def grade_learner(predict, tests): function train_test_split (line 229) | def train_test_split(dataset, start=None, end=None, test_split=None): function cross_validation_wrapper (line 252) | def cross_validation_wrapper(learner, dataset, k=10, trials=1): function cross_validation (line 278) | def cross_validation(learner, dataset, size=None, k=10, trials=1): function leave_one_out (line 311) | def leave_one_out(learner, dataset, size=None): function learning_curve (line 316) | def learning_curve(learner, dataset, trials=10, sizes=None): function PluralityLearner (line 327) | def PluralityLearner(dataset): class DecisionFork (line 341) | class DecisionFork: method __init__ (line 347) | def __init__(self, attr, attr_name=None, default_child=None, branches=... method __call__ (line 354) | def __call__(self, example): method add (line 363) | def add(self, val, subtree): method display (line 367) | def display(self, indent=0): method __repr__ (line 374) | def __repr__(self): class DecisionLeaf (line 378) | class DecisionLeaf: method __init__ (line 381) | def __init__(self, result): method __call__ (line 384) | def __call__(self, example): method display (line 387) | def display(self): method __repr__ (line 390) | def __repr__(self): function DecisionTreeLearner (line 394) | def DecisionTreeLearner(dataset): function information_content (line 451) | def information_content(values): function DecisionListLearner (line 457) | def DecisionListLearner(dataset): function NearestNeighborLearner (line 493) | def NearestNeighborLearner(dataset, k=1): function LinearLearner (line 504) | def LinearLearner(dataset, learning_rate=0.01, epochs=100): function LogisticLinearLeaner (line 545) | def LogisticLinearLeaner(dataset, learning_rate=0.01, epochs=100): function NeuralNetLearner (line 589) | def NeuralNetLearner(dataset, hidden_layer_sizes=None, learning_rate=0.0... function BackPropagationLearner (line 629) | def BackPropagationLearner(dataset, net, learning_rate, epochs, activati... function PerceptronLearner (line 731) | def PerceptronLearner(dataset, learning_rate=0.01, epochs=100): class NNUnit (line 753) | class NNUnit: method __init__ (line 760) | def __init__(self, activation=sigmoid, weights=None, inputs=None): function network (line 767) | def network(input_units, hidden_layer_sizes, output_units, activation=si... function init_examples (line 787) | def init_examples(examples, idx_i, idx_t, o_units): function find_max_node (line 806) | def find_max_node(nodes): class SVC (line 810) | class SVC: method __init__ (line 812) | def __init__(self, kernel=linear_kernel, C=1.0, verbose=False): method fit (line 821) | def fit(self, X, y): method solve_qp (line 842) | def solve_qp(self, X, y): method predict_score (line 860) | def predict_score(self, X): method predict (line 868) | def predict(self, X): class SVR (line 875) | class SVR: method __init__ (line 877) | def __init__(self, kernel=linear_kernel, C=1.0, epsilon=0.1, verbose=F... method fit (line 887) | def fit(self, X, y): method solve_qp (line 912) | def solve_qp(self, X, y): method predict (line 934) | def predict(self, X): class MultiClassLearner (line 940) | class MultiClassLearner: method __init__ (line 942) | def __init__(self, clf, decision_function='ovr'): method fit (line 947) | def fit(self, X, y): method predict (line 978) | def predict(self, X): function EnsembleLearner (line 1005) | def EnsembleLearner(learners): function ada_boost (line 1019) | def ada_boost(dataset, L, K): function weighted_majority (line 1041) | def weighted_majority(predictors, weights): function weighted_mode (line 1050) | def weighted_mode(values, weights): function RandomForest (line 1062) | def RandomForest(dataset, n=5): function WeightedLearner (line 1086) | def WeightedLearner(unweighted_learner): function replicated_dataset (line 1099) | def replicated_dataset(dataset, weights, n=None): function weighted_replicate (line 1107) | def weighted_replicate(seq, weights, n): function accuracy_score (line 1125) | def accuracy_score(y_pred, y_true): function r2_score (line 1130) | def r2_score(y_pred, y_true): function RestaurantDataSet (line 1147) | def RestaurantDataSet(examples=None): function T (line 1159) | def T(attr_name, branches): function SyntheticRestaurant (line 1189) | def SyntheticRestaurant(n=20): function Majority (line 1200) | def Majority(k, n): function Parity (line 1213) | def Parity(k, n, name='parity'): function Xor (line 1226) | def Xor(n): function ContinuousXor (line 1231) | def ContinuousXor(n): function compare (line 1240) | def compare(algorithms=None, datasets=None, k=10, trials=1): FILE: learning4e.py class DataSet (line 14) | class DataSet: method __init__ (line 41) | def __init__(self, examples=None, attrs=None, attr_names=None, target=... method set_problem (line 77) | def set_problem(self, target, inputs=None, exclude=()): method check_me (line 95) | def check_me(self): method add_example (line 105) | def add_example(self, example): method check_example (line 110) | def check_example(self, example): method attr_num (line 118) | def attr_num(self, attr): method update_values (line 127) | def update_values(self): method sanitize (line 130) | def sanitize(self, example): method classes_to_numbers (line 134) | def classes_to_numbers(self, classes=None): method remove_examples (line 142) | def remove_examples(self, value=''): method split_values_by_classes (line 147) | def split_values_by_classes(self): method find_means_and_deviations (line 158) | def find_means_and_deviations(self): method __repr__ (line 188) | def __repr__(self): function parse_csv (line 192) | def parse_csv(input, delim=','): function err_ratio (line 205) | def err_ratio(learner, dataset, examples=None): function grade_learner (line 222) | def grade_learner(learner, tests): function train_test_split (line 230) | def train_test_split(dataset, start=None, end=None, test_split=None): function model_selection (line 253) | def model_selection(learner, dataset, k=10, trials=1): function cross_validation (line 278) | def cross_validation(learner, dataset, size=None, k=10, trials=1): function leave_one_out (line 307) | def leave_one_out(learner, dataset, size=None): function learning_curve (line 312) | def learning_curve(learner, dataset, trials=10, sizes=None): class PluralityLearner (line 323) | class PluralityLearner: method __init__ (line 329) | def __init__(self, dataset): method predict (line 332) | def predict(self, example): class DecisionFork (line 337) | class DecisionFork: method __init__ (line 343) | def __init__(self, attr, attr_name=None, default_child=None, branches=... method __call__ (line 350) | def __call__(self, example): method add (line 359) | def add(self, val, subtree): method display (line 363) | def display(self, indent=0): method __repr__ (line 370) | def __repr__(self): class DecisionLeaf (line 374) | class DecisionLeaf: method __init__ (line 377) | def __init__(self, result): method __call__ (line 380) | def __call__(self, example): method display (line 383) | def display(self): method __repr__ (line 386) | def __repr__(self): class DecisionTreeLearner (line 390) | class DecisionTreeLearner: method __init__ (line 393) | def __init__(self, dataset): method decision_tree_learning (line 397) | def decision_tree_learning(self, examples, attrs, parent_examples=()): method plurality_value (line 411) | def plurality_value(self, examples): method count (line 420) | def count(self, attr, val, examples): method all_same_class (line 424) | def all_same_class(self, examples): method choose_attribute (line 429) | def choose_attribute(self, attrs, examples): method information_gain (line 433) | def information_gain(self, attr, examples): method split_by (line 445) | def split_by(self, attr, examples): method predict (line 449) | def predict(self, x): function information_content (line 453) | def information_content(values): class DecisionListLearner (line 459) | class DecisionListLearner: method __init__ (line 465) | def __init__(self, dataset): method decision_list_learning (line 468) | def decision_list_learning(self, examples): method find_examples (line 476) | def find_examples(self, examples): method passes (line 483) | def passes(self, example, test): method predict (line 487) | def predict(self, example): class NearestNeighborLearner (line 494) | class NearestNeighborLearner: method __init__ (line 497) | def __init__(self, dataset, k=1): method predict (line 501) | def predict(self, example): class SVC (line 507) | class SVC: method __init__ (line 509) | def __init__(self, kernel=linear_kernel, C=1.0, verbose=False): method fit (line 518) | def fit(self, X, y): method solve_qp (line 539) | def solve_qp(self, X, y): method predict_score (line 557) | def predict_score(self, X): method predict (line 565) | def predict(self, X): class SVR (line 572) | class SVR: method __init__ (line 574) | def __init__(self, kernel=linear_kernel, C=1.0, epsilon=0.1, verbose=F... method fit (line 584) | def fit(self, X, y): method solve_qp (line 609) | def solve_qp(self, X, y): method predict (line 630) | def predict(self, X): class MultiClassLearner (line 636) | class MultiClassLearner: method __init__ (line 638) | def __init__(self, clf, decision_function='ovr'): method fit (line 643) | def fit(self, X, y): method predict (line 674) | def predict(self, X): function LinearLearner (line 701) | def LinearLearner(dataset, learning_rate=0.01, epochs=100): function LogisticLinearLeaner (line 742) | def LogisticLinearLeaner(dataset, learning_rate=0.01, epochs=100): class EnsembleLearner (line 786) | class EnsembleLearner: method __init__ (line 789) | def __init__(self, learners): method train (line 792) | def train(self, dataset): method predict (line 795) | def predict(self, example): function ada_boost (line 799) | def ada_boost(dataset, L, K): class weighted_majority (line 821) | class weighted_majority: method __init__ (line 824) | def __init__(self, predictors, weights): method predict (line 828) | def predict(self, example): function weighted_mode (line 832) | def weighted_mode(values, weights): class RandomForest (line 844) | class RandomForest: method __init__ (line 847) | def __init__(self, dataset, n=5): method data_bagging (line 854) | def data_bagging(self, m=0): method feature_bagging (line 859) | def feature_bagging(self, p=0.7): method predict (line 864) | def predict(self, example): function WeightedLearner (line 868) | def WeightedLearner(unweighted_learner): function replicated_dataset (line 885) | def replicated_dataset(dataset, weights, n=None): function weighted_replicate (line 893) | def weighted_replicate(seq, weights, n): function accuracy_score (line 911) | def accuracy_score(y_pred, y_true): function r2_score (line 916) | def r2_score(y_pred, y_true): function RestaurantDataSet (line 933) | def RestaurantDataSet(examples=None): function T (line 945) | def T(attr_name, branches): function SyntheticRestaurant (line 975) | def SyntheticRestaurant(n=20): function Majority (line 986) | def Majority(k, n): function Parity (line 999) | def Parity(k, n, name='parity'): function Xor (line 1012) | def Xor(n): function ContinuousXor (line 1017) | def ContinuousXor(n): function compare (line 1026) | def compare(algorithms=None, datasets=None, k=10, trials=1): FILE: logic.py class KB (line 48) | class KB: method __init__ (line 59) | def __init__(self, sentence=None): method tell (line 63) | def tell(self, sentence): method ask (line 67) | def ask(self, query): method ask_generator (line 71) | def ask_generator(self, query): method retract (line 75) | def retract(self, sentence): class PropKB (line 80) | class PropKB(KB): method __init__ (line 83) | def __init__(self, sentence=None): method tell (line 87) | def tell(self, sentence): method ask_generator (line 91) | def ask_generator(self, query): method ask_if_true (line 96) | def ask_if_true(self, query): method retract (line 102) | def retract(self, sentence): function KBAgentProgram (line 112) | def KBAgentProgram(kb): function is_symbol (line 138) | def is_symbol(s): function is_var_symbol (line 146) | def is_var_symbol(s): function is_prop_symbol (line 154) | def is_prop_symbol(s): function variables (line 162) | def variables(s): function is_definite_clause (line 170) | def is_definite_clause(s): function parse_definite_clause (line 186) | def parse_definite_clause(s): function tt_entails (line 203) | def tt_entails(kb, alpha): function tt_check_all (line 217) | def tt_check_all(kb, alpha, symbols, model): function prop_symbols (line 232) | def prop_symbols(x): function constant_symbols (line 242) | def constant_symbols(x): function predicate_symbols (line 252) | def predicate_symbols(x): function tt_true (line 262) | def tt_true(s): function pl_true (line 271) | def pl_true(exp, model={}): function to_cnf (line 332) | def to_cnf(s): function eliminate_implications (line 348) | def eliminate_implications(s): function move_not_inwards (line 369) | def move_not_inwards(s): function distribute_and_over_or (line 393) | def distribute_and_over_or(s): function associate (line 421) | def associate(op, args): function dissociate (line 442) | def dissociate(op, args): function conjuncts (line 461) | def conjuncts(s): function disjuncts (line 471) | def disjuncts(s): function pl_resolution (line 484) | def pl_resolution(kb, alpha): function pl_resolve (line 509) | def pl_resolve(ci, cj): class PropDefiniteKB (line 522) | class PropDefiniteKB(PropKB): method tell (line 525) | def tell(self, sentence): method ask_generator (line 530) | def ask_generator(self, query): method retract (line 535) | def retract(self, sentence): method clauses_with_premise (line 538) | def clauses_with_premise(self, p): function pl_fc_entails (line 544) | def pl_fc_entails(kb, q): function no_branching_heuristic (line 604) | def no_branching_heuristic(symbols, clauses): function min_clauses (line 608) | def min_clauses(clauses): function moms (line 613) | def moms(symbols, clauses): function momsf (line 622) | def momsf(symbols, clauses, k=0): function posit (line 635) | def posit(symbols, clauses): function zm (line 646) | def zm(symbols, clauses): function dlis (line 655) | def dlis(symbols, clauses): function dlcs (line 666) | def dlcs(symbols, clauses): function jw (line 679) | def jw(symbols, clauses): function jw2 (line 692) | def jw2(symbols, clauses): function dpll_satisfiable (line 710) | def dpll_satisfiable(s, branching_heuristic=no_branching_heuristic): function dpll (line 722) | def dpll(clauses, symbols, model, branching_heuristic=no_branching_heuri... function find_pure_symbol (line 744) | def find_pure_symbol(symbols, clauses): function find_unit_clause (line 762) | def find_unit_clause(clauses, model): function unit_clause_assign (line 775) | def unit_clause_assign(clause, model): function inspect_literal (line 798) | def inspect_literal(literal): function no_restart (line 817) | def no_restart(conflicts, restarts, queue_lbd, sum_lbd): function luby (line 821) | def luby(conflicts, restarts, queue_lbd, sum_lbd, unit=512): function glucose (line 835) | def glucose(conflicts, restarts, queue_lbd, sum_lbd, x=100, k=0.7): function cdcl_satisfiable (line 842) | def cdcl_satisfiable(s, vsids_decay=0.95, restart_strategy=no_restart): function assign_decision_literal (line 882) | def assign_decision_literal(symbols, model, scores, G, dl): function unit_propagation (line 890) | def unit_propagation(clauses, symbols, model, G, dl): function conflict_analysis (line 950) | def conflict_analysis(G, dl): function pl_binary_resolution (line 967) | def pl_binary_resolution(ci, cj): function backjump (line 976) | def backjump(symbols, model, G, dl=0): class TwoWLClauseDatabase (line 984) | class TwoWLClauseDatabase: method __init__ (line 986) | def __init__(self, clauses): method get_clauses (line 992) | def get_clauses(self): method set_first_watched (line 995) | def set_first_watched(self, clause, new_watching): method set_second_watched (line 999) | def set_second_watched(self, clause, new_watching): method get_first_watched (line 1003) | def get_first_watched(self, clause): method get_second_watched (line 1010) | def get_second_watched(self, clause): method get_pos_watched (line 1017) | def get_pos_watched(self, l): method get_neg_watched (line 1020) | def get_neg_watched(self, l): method add (line 1023) | def add(self, clause, model): method remove (line 1031) | def remove(self, clause): method update_first_watched (line 1039) | def update_first_watched(self, clause, model): method update_second_watched (line 1050) | def update_second_watched(self, clause, model): method __find_new_watching_literal (line 1061) | def __find_new_watching_literal(self, clause, other_watched, model): method __assign_watching_literals (line 1070) | def __assign_watching_literals(self, clause, model=None): function WalkSAT (line 1083) | def WalkSAT(clauses, p=0.5, max_flips=10000): function MapColoringSAT (line 1120) | def MapColoringSAT(colors, neighbors): function facing_east (line 1170) | def facing_east(time): function facing_west (line 1174) | def facing_west(time): function facing_north (line 1178) | def facing_north(time): function facing_south (line 1182) | def facing_south(time): function wumpus (line 1186) | def wumpus(x, y): function pit (line 1190) | def pit(x, y): function breeze (line 1194) | def breeze(x, y): function stench (line 1198) | def stench(x, y): function wumpus_alive (line 1202) | def wumpus_alive(time): function have_arrow (line 1206) | def have_arrow(time): function percept_stench (line 1210) | def percept_stench(time): function percept_breeze (line 1214) | def percept_breeze(time): function percept_glitter (line 1218) | def percept_glitter(time): function percept_bump (line 1222) | def percept_bump(time): function percept_scream (line 1226) | def percept_scream(time): function move_forward (line 1230) | def move_forward(time): function shoot (line 1234) | def shoot(time): function turn_left (line 1238) | def turn_left(time): function turn_right (line 1242) | def turn_right(time): function ok_to_move (line 1246) | def ok_to_move(x, y, time): function location (line 1250) | def location(x, y, time=None): function implies (line 1259) | def implies(lhs, rhs): function equiv (line 1263) | def equiv(lhs, rhs): function new_disjunction (line 1269) | def new_disjunction(sentences): class WumpusKB (line 1279) | class WumpusKB(PropKB): method __init__ (line 1284) | def __init__(self, dimrow): method make_action_sentence (line 1347) | def make_action_sentence(self, action, time): method make_percept_sentence (line 1356) | def make_percept_sentence(self, percept, time): method add_temporal_sentences (line 1391) | def add_temporal_sentences(self, time): method ask_if_true (line 1453) | def ask_if_true(self, query): class WumpusPosition (line 1460) | class WumpusPosition: method __init__ (line 1461) | def __init__(self, x, y, orientation): method get_location (line 1466) | def get_location(self): method set_location (line 1469) | def set_location(self, x, y): method get_orientation (line 1473) | def get_orientation(self): method set_orientation (line 1476) | def set_orientation(self, orientation): method __eq__ (line 1479) | def __eq__(self, other): class HybridWumpusAgent (line 1489) | class HybridWumpusAgent(Agent): method __init__ (line 1495) | def __init__(self, dimentions): method execute (line 1503) | def execute(self, percept): method plan_route (line 1587) | def plan_route(self, current, goals, allowed): method plan_shot (line 1591) | def plan_shot(self, current, goals, allowed): function SAT_plan (line 1622) | def SAT_plan(init, transition, goal, t_max, SAT_solver=cdcl_satisfiable): function unify (line 1711) | def unify(x, y, s={}): function is_variable (line 1740) | def is_variable(x): function unify_var (line 1745) | def unify_var(var, x, s): function occur_check (line 1758) | def occur_check(var, x, s): function subst (line 1774) | def subst(s, x): function cascade_substitution (line 1791) | def cascade_substitution(s): function unify_mm (line 1810) | def unify_mm(x, y, s={}): function term_reduction (line 1861) | def term_reduction(x, y, s): function vars_elimination (line 1873) | def vars_elimination(x, s): function standardize_variables (line 1884) | def standardize_variables(sentence, dic=None): function parse_clauses_from_dimacs (line 1907) | def parse_clauses_from_dimacs(dimacs_cnf): class FolKB (line 1920) | class FolKB(KB): method __init__ (line 1932) | def __init__(self, clauses=None): method tell (line 1939) | def tell(self, sentence): method ask_generator (line 1945) | def ask_generator(self, query): method retract (line 1948) | def retract(self, sentence): method fetch_rules_for_goal (line 1951) | def fetch_rules_for_goal(self, goal): function fol_fc_ask (line 1955) | def fol_fc_ask(kb, alpha): function fol_bc_ask (line 1994) | def fol_bc_ask(kb, query): function fol_bc_or (line 2003) | def fol_bc_or(kb, goal, theta): function fol_bc_and (line 2010) | def fol_bc_and(kb, goals, theta): function diff (line 2063) | def diff(y, x): function simp (line 2096) | def simp(x): function d (line 2159) | def d(y, x): FILE: logic4e.py class KB (line 47) | class KB: method __init__ (line 59) | def __init__(self, sentence=None): method tell (line 62) | def tell(self, sentence): method ask (line 66) | def ask(self, query): method ask_generator (line 70) | def ask_generator(self, query): method retract (line 74) | def retract(self, sentence): class PropKB (line 79) | class PropKB(KB): method __init__ (line 82) | def __init__(self, sentence=None): method tell (line 87) | def tell(self, sentence): method ask_generator (line 91) | def ask_generator(self, query): method ask_if_true (line 96) | def ask_if_true(self, query): method retract (line 102) | def retract(self, sentence): function KB_AgentProgram (line 109) | def KB_AgentProgram(KB): function facing_east (line 139) | def facing_east(time): function facing_west (line 143) | def facing_west(time): function facing_north (line 147) | def facing_north(time): function facing_south (line 151) | def facing_south(time): function wumpus (line 155) | def wumpus(x, y): function pit (line 159) | def pit(x, y): function breeze (line 163) | def breeze(x, y): function stench (line 167) | def stench(x, y): function wumpus_alive (line 171) | def wumpus_alive(time): function have_arrow (line 175) | def have_arrow(time): function percept_stench (line 179) | def percept_stench(time): function percept_breeze (line 183) | def percept_breeze(time): function percept_glitter (line 187) | def percept_glitter(time): function percept_bump (line 191) | def percept_bump(time): function percept_scream (line 195) | def percept_scream(time): function move_forward (line 199) | def move_forward(time): function shoot (line 203) | def shoot(time): function turn_left (line 207) | def turn_left(time): function turn_right (line 211) | def turn_right(time): function ok_to_move (line 215) | def ok_to_move(x, y, time): function location (line 219) | def location(x, y, time=None): function implies (line 229) | def implies(lhs, rhs): function equiv (line 233) | def equiv(lhs, rhs): function new_disjunction (line 240) | def new_disjunction(sentences): function is_symbol (line 251) | def is_symbol(s): function is_var_symbol (line 259) | def is_var_symbol(s): function is_prop_symbol (line 267) | def is_prop_symbol(s): function variables (line 275) | def variables(s): function is_definite_clause (line 283) | def is_definite_clause(s): function parse_definite_clause (line 301) | def parse_definite_clause(s): function tt_entails (line 319) | def tt_entails(kb, alpha): function tt_check_all (line 332) | def tt_check_all(kb, alpha, symbols, model): function prop_symbols (line 347) | def prop_symbols(x): function constant_symbols (line 357) | def constant_symbols(x): function predicate_symbols (line 367) | def predicate_symbols(x): function tt_true (line 379) | def tt_true(s): function pl_true (line 388) | def pl_true(exp, model={}): function to_cnf (line 449) | def to_cnf(s): function eliminate_implications (line 463) | def eliminate_implications(s): function move_not_inwards (line 484) | def move_not_inwards(s): function distribute_and_over_or (line 508) | def distribute_and_over_or(s): function associate (line 536) | def associate(op, args): function dissociate (line 557) | def dissociate(op, args): function conjuncts (line 576) | def conjuncts(s): function disjuncts (line 586) | def disjuncts(s): function pl_resolution (line 599) | def pl_resolution(KB, alpha): function pl_resolve (line 623) | def pl_resolve(ci, cj): class PropDefiniteKB (line 639) | class PropDefiniteKB(PropKB): method tell (line 642) | def tell(self, sentence): method ask_generator (line 647) | def ask_generator(self, query): method retract (line 652) | def retract(self, sentence): method clauses_with_premise (line 655) | def clauses_with_premise(self, p): function pl_fc_entails (line 662) | def pl_fc_entails(KB, q): function dpll_satisfiable (line 712) | def dpll_satisfiable(s): function dpll (line 726) | def dpll(clauses, symbols, model): function find_pure_symbol (line 750) | def find_pure_symbol(symbols, clauses): function find_unit_clause (line 769) | def find_unit_clause(clauses, model): function unit_clause_assign (line 783) | def unit_clause_assign(clause, model): function inspect_literal (line 806) | def inspect_literal(literal): function WalkSAT (line 825) | def WalkSAT(clauses, p=0.5, max_flips=10000): class WumpusKB (line 864) | class WumpusKB(PropKB): method __init__ (line 869) | def __init__(self, dimrow): method make_action_sentence (line 932) | def make_action_sentence(self, action, time): method make_percept_sentence (line 941) | def make_percept_sentence(self, percept, time): method add_temporal_sentences (line 976) | def add_temporal_sentences(self, time): method ask_if_true (line 1048) | def ask_if_true(self, query): class WumpusPosition (line 1055) | class WumpusPosition: method __init__ (line 1056) | def __init__(self, x, y, orientation): method get_location (line 1061) | def get_location(self): method set_location (line 1064) | def set_location(self, x, y): method get_orientation (line 1068) | def get_orientation(self): method set_orientation (line 1071) | def set_orientation(self, orientation): method __eq__ (line 1074) | def __eq__(self, other): class HybridWumpusAgent (line 1086) | class HybridWumpusAgent(Agent): method __init__ (line 1089) | def __init__(self, dimentions): method execute (line 1097) | def execute(self, percept): method plan_route (line 1181) | def plan_route(self, current, goals, allowed): method plan_shot (line 1185) | def plan_shot(self, current, goals, allowed): function SAT_plan (line 1217) | def SAT_plan(init, transition, goal, t_max, SAT_solver=dpll_satisfiable): function unify (line 1307) | def unify(x, y, s={}): function is_variable (line 1334) | def is_variable(x): function unify_var (line 1339) | def unify_var(var, x, s): function occur_check (line 1350) | def occur_check(var, x, s): function extend (line 1366) | def extend(s, var, val): class FolKB (line 1379) | class FolKB(KB): method __init__ (line 1391) | def __init__(self, initial_clauses=None): method tell (line 1397) | def tell(self, sentence): method ask_generator (line 1403) | def ask_generator(self, query): method retract (line 1406) | def retract(self, sentence): method fetch_rules_for_goal (line 1409) | def fetch_rules_for_goal(self, goal): function fol_fc_ask (line 1418) | def fol_fc_ask(KB, alpha): function subst (line 1453) | def subst(s, x): function standardize_variables (line 1470) | def standardize_variables(sentence, dic=None): function fol_bc_ask (line 1495) | def fol_bc_ask(KB, query): function fol_bc_or (line 1501) | def fol_bc_or(KB, goal, theta): function fol_bc_and (line 1508) | def fol_bc_and(KB, goals, theta): function diff (line 1564) | def diff(y, x): function simp (line 1597) | def simp(x): function d (line 1660) | def d(y, x): FILE: making_simple_decision4e.py class DecisionNetwork (line 10) | class DecisionNetwork(BayesNet): method __init__ (line 15) | def __init__(self, action, infer): method best_action (line 22) | def best_action(self): method get_utility (line 26) | def get_utility(self, action, state): method get_expected_utility (line 30) | def get_expected_utility(self, action, evidence): class InformationGatheringAgent (line 40) | class InformationGatheringAgent(Agent): method __init__ (line 45) | def __init__(self, decnet, infer, initial_evidence=None): method integrate_percept (line 55) | def integrate_percept(self, percept): method execute (line 59) | def execute(self, percept): method request (line 71) | def request(self, variable): method cost (line 75) | def cost(self, var): method vpi_cost_ratio (line 79) | def vpi_cost_ratio(self, variables): method vpi (line 86) | def vpi(self, variable): class MCLmap (line 106) | class MCLmap: method __init__ (line 110) | def __init__(self, m): method sample (line 117) | def sample(self): method ray_cast (line 125) | def ray_cast(self, sensor_num, kin_state): function monte_carlo_localization (line 144) | def monte_carlo_localization(a, z, N, P_motion_sample, P_sensor, m, S=No... FILE: mdp.py class MDP (line 19) | class MDP: method __init__ (line 28) | def __init__(self, init, actlist, terminals, transitions=None, reward=... method R (line 56) | def R(self, state): method T (line 61) | def T(self, state, action): method actions (line 70) | def actions(self, state): method get_states_from_transitions (line 80) | def get_states_from_transitions(self, transitions): method check_consistency (line 91) | def check_consistency(self): class MDP2 (line 114) | class MDP2(MDP): method __init__ (line 119) | def __init__(self, init, actlist, terminals, transitions, reward=None,... method T (line 122) | def T(self, state, action): class GridMDP (line 129) | class GridMDP(MDP): method __init__ (line 135) | def __init__(self, grid, terminals, init=(0, 0), gamma=.9): method calculate_T (line 158) | def calculate_T(self, state, action): method T (line 166) | def T(self, state, action): method go (line 169) | def go(self, state, direction): method to_grid (line 175) | def to_grid(self, mapping): method to_arrows (line 182) | def to_arrows(self, policy): function value_iteration (line 203) | def value_iteration(mdp, epsilon=0.001): function best_policy (line 219) | def best_policy(mdp, U): function expected_utility (line 229) | def expected_utility(a, s, U, mdp): function policy_iteration (line 238) | def policy_iteration(mdp): function policy_evaluation (line 255) | def policy_evaluation(pi, U, mdp, k=20): class POMDP (line 266) | class POMDP(MDP): method __init__ (line 274) | def __init__(self, actions, transitions=None, evidences=None, rewards=... method remove_dominated_plans (line 296) | def remove_dominated_plans(self, input_values): method remove_dominated_plans_fast (line 327) | def remove_dominated_plans_fast(self, input_values): method generate_mapping (line 354) | def generate_mapping(self, best, input_values): method max_difference (line 365) | def max_difference(self, U1, U2): class Matrix (line 378) | class Matrix: method add (line 382) | def add(A, B): method scalar_multiply (line 394) | def scalar_multiply(a, B): method multiply (line 403) | def multiply(A, B): method matmul (line 416) | def matmul(A, B): method transpose (line 422) | def transpose(A): function pomdp_value_iteration (line 428) | def pomdp_value_iteration(pomdp, epsilon=0.1): FILE: mdp4e.py class MDP (line 19) | class MDP: method __init__ (line 28) | def __init__(self, init, actlist, terminals, transitions=None, reward=... method R (line 56) | def R(self, state): method T (line 61) | def T(self, state, action): method actions (line 70) | def actions(self, state): method get_states_from_transitions (line 80) | def get_states_from_transitions(self, transitions): method check_consistency (line 91) | def check_consistency(self): class MDP2 (line 114) | class MDP2(MDP): method __init__ (line 119) | def __init__(self, init, actlist, terminals, transitions, reward=None,... method T (line 122) | def T(self, state, action): class GridMDP (line 129) | class GridMDP(MDP): method __init__ (line 135) | def __init__(self, grid, terminals, init=(0, 0), gamma=.9): method calculate_T (line 158) | def calculate_T(self, state, action): method T (line 166) | def T(self, state, action): method go (line 169) | def go(self, state, direction): method to_grid (line 175) | def to_grid(self, mapping): method to_arrows (line 182) | def to_arrows(self, policy): function q_value (line 204) | def q_value(mdp, s, a, U): function value_iteration (line 220) | def value_iteration(mdp, epsilon=0.001): function best_policy (line 241) | def best_policy(mdp, U): function expected_utility (line 251) | def expected_utility(a, s, U, mdp): function policy_iteration (line 257) | def policy_iteration(mdp): function policy_evaluation (line 275) | def policy_evaluation(pi, U, mdp, k=20): class POMDP (line 290) | class POMDP(MDP): method __init__ (line 298) | def __init__(self, actions, transitions=None, evidences=None, rewards=... method remove_dominated_plans (line 320) | def remove_dominated_plans(self, input_values): method remove_dominated_plans_fast (line 351) | def remove_dominated_plans_fast(self, input_values): method generate_mapping (line 378) | def generate_mapping(self, best, input_values): method max_difference (line 389) | def max_difference(self, U1, U2): class Matrix (line 402) | class Matrix: method add (line 406) | def add(A, B): method scalar_multiply (line 418) | def scalar_multiply(a, B): method multiply (line 427) | def multiply(A, B): method matmul (line 440) | def matmul(A, B): method transpose (line 446) | def transpose(A): function pomdp_value_iteration (line 452) | def pomdp_value_iteration(pomdp, epsilon=0.1): FILE: nlp.py function Rules (line 13) | def Rules(**rules): function Lexicon (line 23) | def Lexicon(**rules): class Grammar (line 33) | class Grammar: method __init__ (line 35) | def __init__(self, name, rules, lexicon): method rewrites_for (line 45) | def rewrites_for(self, cat): method isa (line 49) | def isa(self, word, cat): method cnf_rules (line 53) | def cnf_rules(self): method generate_random (line 63) | def generate_random(self, S='S'): method __repr__ (line 79) | def __repr__(self): function ProbRules (line 83) | def ProbRules(**rules): function ProbLexicon (line 100) | def ProbLexicon(**rules): class ProbGrammar (line 118) | class ProbGrammar: method __init__ (line 120) | def __init__(self, name, rules, lexicon): method rewrites_for (line 132) | def rewrites_for(self, cat): method isa (line 136) | def isa(self, word, cat): method cnf_rules (line 140) | def cnf_rules(self): method generate_random (line 150) | def generate_random(self, S='S'): method __repr__ (line 172) | def __repr__(self): class Chart (line 283) | class Chart: method __init__ (line 290) | def __init__(self, grammar, trace=False): method parses (line 297) | def parses(self, words, S='S'): method parse (line 309) | def parse(self, words, S='S'): method add_edge (line 318) | def add_edge(self, edge): method scanner (line 330) | def scanner(self, j, word): method predictor (line 336) | def predictor(self, edge): method extender (line 344) | def extender(self, edge): function CYK_parse (line 355) | def CYK_parse(words, grammar): function loadPageHTML (line 395) | def loadPageHTML(addressList): function initPages (line 407) | def initPages(addressList): function stripRawHTML (line 415) | def stripRawHTML(raw_html): function determineInlinks (line 422) | def determineInlinks(page): function findOutlinks (line 434) | def findOutlinks(page, handleURLs=None): function onlyWikipediaURLS (line 442) | def onlyWikipediaURLS(urls): function expand_pages (line 452) | def expand_pages(pages): function relevant_pages (line 468) | def relevant_pages(query): function normalize (line 482) | def normalize(pages): class ConvergenceDetector (line 493) | class ConvergenceDetector(object): method __init__ (line 498) | def __init__(self): method __call__ (line 502) | def __call__(self): method detect (line 505) | def detect(self): function getInLinks (line 525) | def getInLinks(page): function getOutLinks (line 531) | def getOutLinks(page): class Page (line 540) | class Page(object): method __init__ (line 541) | def __init__(self, address, inLinks=None, outLinks=None, hub=0, author... function HITS (line 554) | def HITS(query): FILE: nlp4e.py function Rules (line 15) | def Rules(**rules): function Lexicon (line 25) | def Lexicon(**rules): class Grammar (line 35) | class Grammar: method __init__ (line 37) | def __init__(self, name, rules, lexicon): method rewrites_for (line 47) | def rewrites_for(self, cat): method isa (line 51) | def isa(self, word, cat): method cnf_rules (line 55) | def cnf_rules(self): method generate_random (line 65) | def generate_random(self, S='S'): method __repr__ (line 81) | def __repr__(self): function ProbRules (line 85) | def ProbRules(**rules): function ProbLexicon (line 102) | def ProbLexicon(**rules): class ProbGrammar (line 120) | class ProbGrammar: method __init__ (line 122) | def __init__(self, name, rules, lexicon): method rewrites_for (line 134) | def rewrites_for(self, cat): method isa (line 138) | def isa(self, word, cat): method cnf_rules (line 142) | def cnf_rules(self): method generate_random (line 152) | def generate_random(self, S='S'): method __repr__ (line 173) | def __repr__(self): class Chart (line 284) | class Chart: method __init__ (line 291) | def __init__(self, grammar, trace=False): method parses (line 298) | def parses(self, words, S='S'): method parse (line 310) | def parse(self, words, S='S'): method add_edge (line 319) | def add_edge(self, edge): method scanner (line 331) | def scanner(self, j, word): method predictor (line 337) | def predictor(self, edge): method extender (line 345) | def extender(self, edge): class Tree (line 357) | class Tree: method __init__ (line 358) | def __init__(self, root, *args): function CYK_parse (line 363) | def CYK_parse(words, grammar): function subspan (line 386) | def subspan(N): class TextParsingProblem (line 398) | class TextParsingProblem(Problem): method __init__ (line 399) | def __init__(self, initial, grammar, goal='S'): method actions (line 413) | def actions(self, state): method result (line 434) | def result(self, state, action): method h (line 437) | def h(self, state): function astar_search_parsing (line 442) | def astar_search_parsing(words, gramma): function beam_search_parsing (line 465) | def beam_search_parsing(words, gramma, b=3): FILE: notebook.py function pseudocode (line 24) | def pseudocode(algorithm): function psource (line 38) | def psource(*functions): function show_iris (line 56) | def show_iris(i=0, j=1, k=2): function load_MNIST (line 100) | def load_MNIST(path="aima-data/MNIST/Digits", fashion=False): function show_MNIST (line 155) | def show_MNIST(labels, images, samples=8, fashion=False): function show_ave_MNIST (line 177) | def show_ave_MNIST(labels, images, fashion=False): function make_plot_grid_step_function (line 206) | def make_plot_grid_step_function(columns, rows, U_over_time): function make_visualize (line 237) | def make_visualize(slider): class Canvas (line 263) | class Canvas: method __init__ (line 269) | def __init__(self, varname, width=800, height=600, cid=None): method mouse_click (line 278) | def mouse_click(self, x, y): method mouse_move (line 282) | def mouse_move(self, x, y): method execute (line 285) | def execute(self, exec_str): method fill (line 293) | def fill(self, r, g, b): method stroke (line 297) | def stroke(self, r, g, b): method strokeWidth (line 301) | def strokeWidth(self, w): method rect (line 305) | def rect(self, x, y, w, h): method rect_n (line 309) | def rect_n(self, xn, yn, wn, hn): method line (line 317) | def line(self, x1, y1, x2, y2): method line_n (line 321) | def line_n(self, x1n, y1n, x2n, y2n): method arc (line 329) | def arc(self, x, y, r, start, stop): method arc_n (line 333) | def arc_n(self, xn, yn, rn, start, stop): method clear (line 342) | def clear(self): method font (line 346) | def font(self, font): method text (line 350) | def text(self, txt, x, y, fill=True): method text_n (line 357) | def text_n(self, txt, xn, yn, fill=True): method alert (line 363) | def alert(self, message): method update (line 367) | def update(self): function display_html (line 374) | def display_html(html_string): class Canvas_TicTacToe (line 381) | class Canvas_TicTacToe(Canvas): method __init__ (line 384) | def __init__(self, varname, player_1='human', player_2='random', method mouse_click (line 398) | def mouse_click(self, x, y): method draw_board (line 421) | def draw_board(self): method draw_x (line 469) | def draw_x(self, position): method draw_o (line 476) | def draw_o(self, position): class Canvas_min_max (line 482) | class Canvas_min_max(Canvas): method __init__ (line 485) | def __init__(self, varname, util_list, width=800, height=600, cid=None): method min_max (line 507) | def min_max(self, node): method stack_manager_gen (line 545) | def stack_manager_gen(self): method mouse_click (line 559) | def mouse_click(self, x, y): method draw_graph (line 566) | def draw_graph(self): class Canvas_alpha_beta (line 607) | class Canvas_alpha_beta(Canvas): method __init__ (line 610) | def __init__(self, varname, util_list, width=800, height=600, cid=None): method alpha_beta_search (line 634) | def alpha_beta_search(self, node): method stack_manager_gen (line 699) | def stack_manager_gen(self): method mouse_click (line 715) | def mouse_click(self, x, y): method draw_graph (line 722) | def draw_graph(self): class Canvas_fol_bc_ask (line 777) | class Canvas_fol_bc_ask(Canvas): method __init__ (line 780) | def __init__(self, varname, kb, query, width=800, height=600, cid=None): method fol_bc_ask (line 802) | def fol_bc_ask(self): method make_table (line 825) | def make_table(self, graph): method mouse_click (line 856) | def mouse_click(self, x, y): method draw_table (line 866) | def draw_table(self): function show_map (line 908) | def show_map(graph_data, node_colors=None): function final_path_colors (line 946) | def final_path_colors(initial_node_colors, problem, solution): function display_visual (line 958) | def display_visual(graph_data, user_input, algorithm=None, problem=None): function plot_NQueens (line 1059) | def plot_NQueens(solution): function heatmap (line 1086) | def heatmap(grid, cmap='binary', interpolation='nearest'): function gaussian_kernel (line 1096) | def gaussian_kernel(l=5, sig=1.0): function plot_pomdp_utility (line 1104) | def plot_pomdp_utility(utility): FILE: notebook4e.py function pseudocode (line 25) | def pseudocode(algorithm): function psource (line 39) | def psource(*functions): function plot_model_boundary (line 53) | def plot_model_boundary(dataset, attr1, attr2, model=None): function show_iris (line 92) | def show_iris(i=0, j=1, k=2): function load_MNIST (line 136) | def load_MNIST(path="aima-data/MNIST/Digits", fashion=False): function show_MNIST (line 191) | def show_MNIST(labels, images, samples=8, fashion=False): function show_ave_MNIST (line 213) | def show_ave_MNIST(labels, images, fashion=False): function make_plot_grid_step_function (line 242) | def make_plot_grid_step_function(columns, rows, U_over_time): function make_visualize (line 273) | def make_visualize(slider): class Canvas (line 299) | class Canvas: method __init__ (line 305) | def __init__(self, varname, width=800, height=600, cid=None): method mouse_click (line 314) | def mouse_click(self, x, y): method mouse_move (line 318) | def mouse_move(self, x, y): method execute (line 321) | def execute(self, exec_str): method fill (line 329) | def fill(self, r, g, b): method stroke (line 333) | def stroke(self, r, g, b): method strokeWidth (line 337) | def strokeWidth(self, w): method rect (line 341) | def rect(self, x, y, w, h): method rect_n (line 345) | def rect_n(self, xn, yn, wn, hn): method line (line 353) | def line(self, x1, y1, x2, y2): method line_n (line 357) | def line_n(self, x1n, y1n, x2n, y2n): method arc (line 365) | def arc(self, x, y, r, start, stop): method arc_n (line 369) | def arc_n(self, xn, yn, rn, start, stop): method clear (line 378) | def clear(self): method font (line 382) | def font(self, font): method text (line 386) | def text(self, txt, x, y, fill=True): method text_n (line 393) | def text_n(self, txt, xn, yn, fill=True): method alert (line 399) | def alert(self, message): method update (line 403) | def update(self): function display_html (line 410) | def display_html(html_string): class Canvas_TicTacToe (line 417) | class Canvas_TicTacToe(Canvas): method __init__ (line 420) | def __init__(self, varname, player_1='human', player_2='random', method mouse_click (line 434) | def mouse_click(self, x, y): method draw_board (line 457) | def draw_board(self): method draw_x (line 505) | def draw_x(self, position): method draw_o (line 512) | def draw_o(self, position): class Canvas_min_max (line 518) | class Canvas_min_max(Canvas): method __init__ (line 521) | def __init__(self, varname, util_list, width=800, height=600, cid=None): method min_max (line 543) | def min_max(self, node): method stack_manager_gen (line 581) | def stack_manager_gen(self): method mouse_click (line 595) | def mouse_click(self, x, y): method draw_graph (line 602) | def draw_graph(self): class Canvas_alpha_beta (line 643) | class Canvas_alpha_beta(Canvas): method __init__ (line 646) | def __init__(self, varname, util_list, width=800, height=600, cid=None): method alpha_beta_search (line 670) | def alpha_beta_search(self, node): method stack_manager_gen (line 735) | def stack_manager_gen(self): method mouse_click (line 751) | def mouse_click(self, x, y): method draw_graph (line 758) | def draw_graph(self): class Canvas_fol_bc_ask (line 813) | class Canvas_fol_bc_ask(Canvas): method __init__ (line 816) | def __init__(self, varname, kb, query, width=800, height=600, cid=None): method fol_bc_ask (line 838) | def fol_bc_ask(self): method make_table (line 861) | def make_table(self, graph): method mouse_click (line 892) | def mouse_click(self, x, y): method draw_table (line 902) | def draw_table(self): function show_map (line 944) | def show_map(graph_data, node_colors=None): function final_path_colors (line 982) | def final_path_colors(initial_node_colors, problem, solution): function display_visual (line 994) | def display_visual(graph_data, user_input, algorithm=None, problem=None): function plot_NQueens (line 1095) | def plot_NQueens(solution): function heatmap (line 1122) | def heatmap(grid, cmap='binary', interpolation='nearest'): function gaussian_kernel (line 1132) | def gaussian_kernel(l=5, sig=1.0): function plot_pomdp_utility (line 1140) | def plot_pomdp_utility(utility): FILE: perception4e.py function array_normalization (line 20) | def array_normalization(array, range_min, range_max): function gradient_edge_detector (line 29) | def gradient_edge_detector(image): function gaussian_derivative_edge_detector (line 46) | def gaussian_derivative_edge_detector(image): function laplacian_edge_detector (line 61) | def laplacian_edge_detector(image): function show_edges (line 73) | def show_edges(edges): function sum_squared_difference (line 84) | def sum_squared_difference(pic1, pic2): function gen_gray_scale_picture (line 109) | def gen_gray_scale_picture(size, level=3): function probability_contour_detection (line 132) | def probability_contour_detection(image, discs, threshold=0): function group_contour_detection (line 158) | def group_contour_detection(image, cluster_num=2): function image_to_graph (line 180) | def image_to_graph(image): function generate_edge_weight (line 192) | def generate_edge_weight(image, v1, v2): class Graph (line 202) | class Graph: method __init__ (line 205) | def __init__(self, image): method bfs (line 221) | def bfs(self, s, t, parent): method min_cut (line 238) | def min_cut(self, source, sink): function gen_discs (line 265) | def gen_discs(init_scale, scales=1): function load_MINST (line 300) | def load_MINST(train_size, val_size, test_size): function simple_convnet (line 319) | def simple_convnet(size=3, num_classes=10): function train_model (line 346) | def train_model(model): function selective_search (line 360) | def selective_search(image): function pool_rois (line 391) | def pool_rois(feature_map, rois, pooled_height, pooled_width): function pool_roi (line 408) | def pool_roi(feature_map, roi, pooled_height, pooled_width): FILE: planning.py class PlanningProblem (line 17) | class PlanningProblem: method __init__ (line 24) | def __init__(self, initial, goals, actions, domain=None): method convert (line 30) | def convert(self, clauses): method expand_fluents (line 50) | def expand_fluents(self, name=None): method expand_actions (line 83) | def expand_actions(self, name=None): method is_strips (line 142) | def is_strips(self): method goal_test (line 149) | def goal_test(self): method act (line 153) | def act(self, action): class Action (line 168) | class Action: method __init__ (line 181) | def __init__(self, action, precond, effect, domain=None): method __call__ (line 190) | def __call__(self, kb, args): method __repr__ (line 193) | def __repr__(self): method convert (line 196) | def convert(self, clauses): method relaxed (line 216) | def relaxed(self): method substitute (line 223) | def substitute(self, e, args): method check_precond (line 233) | def check_precond(self, kb, args): method act (line 243) | def act(self, kb, args): function goal_test (line 267) | def goal_test(goals, state): function air_cargo (line 277) | def air_cargo(): function spare_tire (line 319) | def spare_tire(): function three_block_tower (line 358) | def three_block_tower(): function simple_blocks_world (line 392) | def simple_blocks_world(): function have_cake_and_eat_cake_too (line 423) | def have_cake_and_eat_cake_too(): function shopping_problem (line 455) | def shopping_problem(): function socks_and_shoes (line 492) | def socks_and_shoes(): function double_tennis_problem (line 530) | def double_tennis_problem(): class ForwardPlan (line 563) | class ForwardPlan(search.Problem): method __init__ (line 569) | def __init__(self, planning_problem): method actions (line 574) | def actions(self, state): method result (line 577) | def result(self, state, action): method goal_test (line 580) | def goal_test(self, state): method h (line 583) | def h(self, state): class BackwardPlan (line 599) | class BackwardPlan(search.Problem): method __init__ (line 605) | def __init__(self, planning_problem): method actions (line 610) | def actions(self, subgoal): method result (line 629) | def result(self, subgoal, action): method goal_test (line 633) | def goal_test(self, subgoal): method h (line 636) | def h(self, subgoal): function CSPlan (line 652) | def CSPlan(planning_problem, solution_length, CSP_solver=ac_search_solve... function SATPlan (line 726) | def SATPlan(planning_problem, solution_length, SAT_solver=cdcl_satisfiab... class Level (line 752) | class Level: method __init__ (line 759) | def __init__(self, kb): method __call__ (line 776) | def __call__(self, actions, objects): method separate (line 780) | def separate(self, e): method find_mutex (line 792) | def find_mutex(self): method build (line 833) | def build(self, actions, objects): method perform_actions (line 876) | def perform_actions(self): class Graph (line 883) | class Graph: method __init__ (line 889) | def __init__(self, planning_problem): method __call__ (line 895) | def __call__(self): method expand_graph (line 898) | def expand_graph(self): method non_mutex_goals (line 905) | def non_mutex_goals(self, goals, index): class GraphPlan (line 915) | class GraphPlan: method __init__ (line 922) | def __init__(self, planning_problem): method check_leveloff (line 927) | def check_leveloff(self): method extract_solution (line 935) | def extract_solution(self, goals, index): method goal_test (line 994) | def goal_test(self, kb): method execute (line 997) | def execute(self): class Linearize (line 1012) | class Linearize: method __init__ (line 1014) | def __init__(self, planning_problem): method filter (line 1017) | def filter(self, solution): method orderlevel (line 1029) | def orderlevel(self, level, planning_problem): method execute (line 1047) | def execute(self): function linearize (line 1062) | def linearize(solution): class PartialOrderPlanner (line 1074) | class PartialOrderPlanner: method __init__ (line 1097) | def __init__(self, planning_problem): method find_open_precondition (line 1113) | def find_open_precondition(self): method find_action_for_precondition (line 1148) | def find_action_for_precondition(self, oprec): method generate_expr (line 1168) | def generate_expr(self, clause, bindings): method generate_action_object (line 1183) | def generate_action_object(self, action, bindings): method cyclic (line 1203) | def cyclic(self, graph): method add_const (line 1226) | def add_const(self, constraint, constraints): method is_a_threat (line 1239) | def is_a_threat(self, precondition, effect): method protect (line 1247) | def protect(self, causal_link, action, constraints): method convert (line 1274) | def convert(self, constraints): method toposort (line 1286) | def toposort(self, graph): method display_plan (line 1311) | def display_plan(self): method execute (line 1325) | def execute(self, display=True): function spare_tire_graphPlan (line 1383) | def spare_tire_graphPlan(): function three_block_tower_graphPlan (line 1388) | def three_block_tower_graphPlan(): function air_cargo_graphPlan (line 1393) | def air_cargo_graphPlan(): function have_cake_and_eat_cake_too_graphPlan (line 1398) | def have_cake_and_eat_cake_too_graphPlan(): function shopping_graphPlan (line 1403) | def shopping_graphPlan(): function socks_and_shoes_graphPlan (line 1408) | def socks_and_shoes_graphPlan(): function simple_blocks_world_graphPlan (line 1413) | def simple_blocks_world_graphPlan(): class HLA (line 1418) | class HLA(Action): method __init__ (line 1425) | def __init__(self, action, precond=None, effect=None, duration=0, cons... method do_action (line 1442) | def do_action(self, job_order, available_resources, kb, args): method has_consumable_resource (line 1460) | def has_consumable_resource(self, available_resources): method has_usable_resource (line 1471) | def has_usable_resource(self, available_resources): method inorder (line 1482) | def inorder(self, job_order): class RealWorldPlanningProblem (line 1497) | class RealWorldPlanningProblem(PlanningProblem): method __init__ (line 1506) | def __init__(self, initial, goals, actions, jobs=None, resources=None): method act (line 1511) | def act(self, action): method refinements (line 1526) | def refinements(self, library): # refinements may be (multiple) HLA t... method hierarchical_search (line 1572) | def hierarchical_search(self, hierarchy): method result (line 1600) | def result(state, actions): method angelic_search (line 1607) | def angelic_search(self, hierarchy, initial_plan): method intersects_goal (line 1648) | def intersects_goal(self, reachable_set): method is_primitive (line 1656) | def is_primitive(plan, library): method reach_opt (line 1667) | def reach_opt(init, plan): method reach_pes (line 1675) | def reach_pes(init, plan): method find_reachable_set (line 1683) | def find_reachable_set(reachable_set, action_description): method find_hla (line 1703) | def find_hla(plan, hierarchy): method making_progress (line 1717) | def making_progress(plan, initial_plan): method decompose (line 1730) | def decompose(hierarchy, plan, s_f, reachable_set): method find_previous_state (line 1750) | def find_previous_state(s_f, reachable_set, i, action): function job_shop_problem (line 1764) | def job_shop_problem(): function go_to_sfo (line 1813) | def go_to_sfo(): class AngelicHLA (line 1858) | class AngelicHLA(HLA): method __init__ (line 1863) | def __init__(self, action, precond, effect, duration=0, consume=None, ... method convert (line 1866) | def convert(self, clauses): method angelic_action (line 1902) | def angelic_action(self): method compute_parameters (line 1971) | def compute_parameters(clause): class AngelicNode (line 2001) | class AngelicNode(Node): method __init__ (line 2008) | def __init__(self, state, parent=None, action_opt=None, action_pes=Non... FILE: probabilistic_learning.py class CountingProbDist (line 8) | class CountingProbDist: method __init__ (line 18) | def __init__(self, observations=None, default=0): method add (line 34) | def add(self, o): method smooth_for (line 41) | def smooth_for(self, o): method __getitem__ (line 51) | def __getitem__(self, item): method top (line 58) | def top(self, n): method sample (line 62) | def sample(self): function NaiveBayesLearner (line 69) | def NaiveBayesLearner(dataset, continuous=True, simple=False): function NaiveBayesSimple (line 78) | def NaiveBayesSimple(distribution): function NaiveBayesDiscrete (line 101) | def NaiveBayesDiscrete(dataset): function NaiveBayesContinuous (line 132) | def NaiveBayesContinuous(dataset): FILE: probability.py function DTAgentProgram (line 10) | def DTAgentProgram(belief_state): class ProbDist (line 28) | class ProbDist: method __init__ (line 38) | def __init__(self, var_name='?', freq=None): method __getitem__ (line 49) | def __getitem__(self, val): method __setitem__ (line 56) | def __setitem__(self, val, p): method normalize (line 62) | def normalize(self): method show_approx (line 72) | def show_approx(self, numfmt='{:.3g}'): method __repr__ (line 77) | def __repr__(self): class JointProbDist (line 81) | class JointProbDist(ProbDist): method __init__ (line 90) | def __init__(self, variables): method __getitem__ (line 95) | def __getitem__(self, values): method __setitem__ (line 100) | def __setitem__(self, values, p): method values (line 110) | def values(self, var): method __repr__ (line 114) | def __repr__(self): function event_values (line 118) | def event_values(event, variables): function enumerate_joint_ask (line 134) | def enumerate_joint_ask(X, e, P): function enumerate_joint (line 152) | def enumerate_joint(variables, e, P): class BayesNet (line 164) | class BayesNet: method __init__ (line 167) | def __init__(self, node_specs=None): method add (line 175) | def add(self, node_spec): method variable_node (line 186) | def variable_node(self, var): method variable_values (line 195) | def variable_values(self, var): method __repr__ (line 199) | def __repr__(self): class DecisionNetwork (line 203) | class DecisionNetwork(BayesNet): method __init__ (line 208) | def __init__(self, action, infer): method best_action (line 215) | def best_action(self): method get_utility (line 219) | def get_utility(self, action, state): method get_expected_utility (line 223) | def get_expected_utility(self, action, evidence): class InformationGatheringAgent (line 233) | class InformationGatheringAgent(Agent): method __init__ (line 240) | def __init__(self, decnet, infer, initial_evidence=None): method integrate_percept (line 249) | def integrate_percept(self, percept): method execute (line 253) | def execute(self, percept): method request (line 265) | def request(self, variable): method cost (line 269) | def cost(self, var): method vpi_cost_ratio (line 273) | def vpi_cost_ratio(self, variables): method vpi (line 280) | def vpi(self, variable): class BayesNode (line 295) | class BayesNode: method __init__ (line 299) | def __init__(self, X, parents, cpt): method p (line 345) | def p(self, value, event): method sample (line 357) | def sample(self, event): method __repr__ (line 364) | def __repr__(self): function enumeration_ask (line 383) | def enumeration_ask(X, e, bn): function enumerate_all (line 398) | def enumerate_all(variables, e, bn): function elimination_ask (line 417) | def elimination_ask(X, e, bn): function is_hidden (line 433) | def is_hidden(var, X, e): function make_factor (line 438) | def make_factor(var, e, bn): function pointwise_product (line 449) | def pointwise_product(factors, bn): function sum_out (line 453) | def sum_out(var, factors, bn): class Factor (line 462) | class Factor: method __init__ (line 465) | def __init__(self, variables, cpt): method pointwise_product (line 469) | def pointwise_product(self, other, bn): method sum_out (line 475) | def sum_out(self, var, bn): method normalize (line 482) | def normalize(self): method p (line 487) | def p(self, e): function all_events (line 492) | def all_events(variables, bn, e): function prior_sample (line 518) | def prior_sample(bn): function rejection_sampling (line 533) | def rejection_sampling(X, e, bn, N=10000): function consistent_with (line 553) | def consistent_with(event, evidence): function likelihood_weighting (line 561) | def likelihood_weighting(X, e, bn, N=10000): function weighted_sample (line 578) | def weighted_sample(bn, e): function gibbs_ask (line 598) | def gibbs_ask(X, e, bn, N=1000): function markov_blanket_sample (line 613) | def markov_blanket_sample(X, e, bn): class HiddenMarkovModel (line 631) | class HiddenMarkovModel: method __init__ (line 634) | def __init__(self, transition_model, sensor_model, prior=None): method sensor_dist (line 639) | def sensor_dist(self, ev): function forward (line 646) | def forward(HMM, fv, ev): function backward (line 654) | def backward(HMM, b, ev): function forward_backward (line 662) | def forward_backward(HMM, ev): function viterbi (line 688) | def viterbi(HMM, ev): function fixed_lag_smoothing (line 733) | def fixed_lag_smoothing(e_t, HMM, d, ev, t): function particle_filtering (line 765) | def particle_filtering(e, N, HMM): class MCLmap (line 806) | class MCLmap: method __init__ (line 810) | def __init__(self, m): method sample (line 817) | def sample(self): method ray_cast (line 825) | def ray_cast(self, sensor_num, kin_state): function monte_carlo_localization (line 844) | def monte_carlo_localization(a, z, N, P_motion_sample, P_sensor, m, S=No... FILE: probability4e.py function DTAgentProgram (line 18) | def DTAgentProgram(belief_state): class ProbDist (line 34) | class ProbDist: method __init__ (line 44) | def __init__(self, varname='?', freqs=None): method __getitem__ (line 55) | def __getitem__(self, val): method __setitem__ (line 62) | def __setitem__(self, val, p): method normalize (line 68) | def normalize(self): method show_approx (line 78) | def show_approx(self, numfmt='{:.3g}'): method __repr__ (line 84) | def __repr__(self): class JointProbDist (line 92) | class JointProbDist(ProbDist): method __init__ (line 101) | def __init__(self, variables): method __getitem__ (line 106) | def __getitem__(self, values): method __setitem__ (line 111) | def __setitem__(self, values, p): method values (line 121) | def values(self, var): method __repr__ (line 125) | def __repr__(self): function event_values (line 129) | def event_values(event, variables): function enumerate_joint_ask (line 142) | def enumerate_joint_ask(X, e, P): function enumerate_joint (line 158) | def enumerate_joint(variables, e, P): function is_independent (line 172) | def is_independent(variables, P): function gen_possible_events (line 194) | def gen_possible_events(vars, P): class BayesNet (line 216) | class BayesNet: method __init__ (line 219) | def __init__(self, node_specs=None): method add (line 232) | def add(self, node_spec): method variable_node (line 249) | def variable_node(self, var): method variable_values (line 260) | def variable_values(self, var): method __repr__ (line 264) | def __repr__(self): class BayesNode (line 268) | class BayesNode: method __init__ (line 274) | def __init__(self, X, parents, cpt): method p (line 321) | def p(self, value, event): method sample (line 335) | def sample(self, event): method __repr__ (line 344) | def __repr__(self): function gaussian_probability (line 368) | def gaussian_probability(param, event, value): function logistic_probability (line 393) | def logistic_probability(param, event, value): class ContinuousBayesNode (line 411) | class ContinuousBayesNode: method __init__ (line 414) | def __init__(self, name, d_parents, c_parents, parameters, type): method continuous_p (line 431) | def continuous_p(self, value, c_event, d_event): function enumeration_ask (line 468) | def enumeration_ask(X, e, bn): function enumerate_all (line 484) | def enumerate_all(variables, e, bn): function elimination_ask (line 507) | def elimination_ask(X, e, bn): function is_hidden (line 523) | def is_hidden(var, X, e): function make_factor (line 528) | def make_factor(var, e, bn): function pointwise_product (line 541) | def pointwise_product(factors, bn): function sum_out (line 545) | def sum_out(var, factors, bn): class Factor (line 554) | class Factor: method __init__ (line 557) | def __init__(self, variables, cpt): method pointwise_product (line 561) | def pointwise_product(self, other, bn): method sum_out (line 568) | def sum_out(self, var, bn): method normalize (line 576) | def normalize(self): method p (line 582) | def p(self, e): function all_events (line 587) | def all_events(variables, bn, e): function prior_sample (line 616) | def prior_sample(bn): function rejection_sampling (line 630) | def rejection_sampling(X, e, bn, N=10000): function consistent_with (line 650) | def consistent_with(event, evidence): function likelihood_weighting (line 659) | def likelihood_weighting(X, e, bn, N=10000): function weighted_sample (line 677) | def weighted_sample(bn, e): function gibbs_ask (line 699) | def gibbs_ask(X, e, bn, N=1000): function markov_blanket_sample (line 714) | def markov_blanket_sample(X, e, bn): class complied_burglary (line 736) | class complied_burglary: method Burglary (line 739) | def Burglary(self, sample): method Earthquake (line 751) | def Earthquake(self, sample): method MaryCalls (line 763) | def MaryCalls(self, sample): method JongCalls (line 769) | def JongCalls(self, sample): method Alarm (line 775) | def Alarm(self, sample): FILE: reinforcement_learning.py class PassiveDUEAgent (line 9) | class PassiveDUEAgent: method __init__ (line 30) | def __init__(self, pi, mdp): method __call__ (line 40) | def __call__(self, percept): method estimate_U (line 52) | def estimate_U(self): method update_state (line 74) | def update_state(self, percept): class PassiveADPAgent (line 80) | class PassiveADPAgent: class ModelMDP (line 104) | class ModelMDP(MDP): method __init__ (line 108) | def __init__(self, init, actlist, terminals, gamma, states): method T (line 114) | def T(self, s, a): method __init__ (line 119) | def __init__(self, pi, mdp): method __call__ (line 130) | def __call__(self, percept): method update_state (line 157) | def update_state(self, percept): class PassiveTDAgent (line 163) | class PassiveTDAgent: method __init__ (line 189) | def __init__(self, pi, mdp, alpha=None): method __call__ (line 205) | def __call__(self, percept): method update_state (line 220) | def update_state(self, percept): class QLearningAgent (line 226) | class QLearningAgent: method __init__ (line 251) | def __init__(self, mdp, Ne, Rplus, alpha=None): method f (line 269) | def f(self, u, n): method actions_in_state (line 278) | def actions_in_state(self, state): method __call__ (line 286) | def __call__(self, percept): method update_state (line 305) | def update_state(self, percept): function run_single_trial (line 311) | def run_single_trial(agent_program, mdp): FILE: reinforcement_learning4e.py class PassiveDUEAgent (line 14) | class PassiveDUEAgent: method __init__ (line 35) | def __init__(self, pi, mdp): method __call__ (line 45) | def __call__(self, percept): method estimate_U (line 57) | def estimate_U(self): method update_state (line 79) | def update_state(self, percept): class PassiveADPAgent (line 88) | class PassiveADPAgent: class ModelMDP (line 112) | class ModelMDP(MDP): method __init__ (line 116) | def __init__(self, init, actlist, terminals, gamma, states): method T (line 122) | def T(self, s, a): method __init__ (line 127) | def __init__(self, pi, mdp): method __call__ (line 138) | def __call__(self, percept): method update_state (line 165) | def update_state(self, percept): class PassiveTDAgent (line 174) | class PassiveTDAgent: method __init__ (line 200) | def __init__(self, pi, mdp, alpha=None): method __call__ (line 216) | def __call__(self, percept): method update_state (line 231) | def update_state(self, percept): class QLearningAgent (line 242) | class QLearningAgent: method __init__ (line 267) | def __init__(self, mdp, Ne, Rplus, alpha=None): method f (line 285) | def f(self, u, n): method actions_in_state (line 294) | def actions_in_state(self, state): method __call__ (line 302) | def __call__(self, percept): method update_state (line 321) | def update_state(self, percept): function run_single_trial (line 327) | def run_single_trial(agent_program, mdp): FILE: search.py class Problem (line 15) | class Problem: method __init__ (line 21) | def __init__(self, initial, goal=None): method actions (line 28) | def actions(self, state): method result (line 35) | def result(self, state, action): method goal_test (line 41) | def goal_test(self, state): method path_cost (line 51) | def path_cost(self, c, state1, action, state2): method value (line 59) | def value(self, state): class Node (line 68) | class Node: method __init__ (line 78) | def __init__(self, state, parent=None, action=None, path_cost=0): method __repr__ (line 88) | def __repr__(self): method __lt__ (line 91) | def __lt__(self, node): method expand (line 94) | def expand(self, problem): method child_node (line 99) | def child_node(self, problem, action): method solution (line 105) | def solution(self): method path (line 109) | def path(self): method __eq__ (line 122) | def __eq__(self, other): method __hash__ (line 125) | def __hash__(self): class SimpleProblemSolvingAgentProgram (line 136) | class SimpleProblemSolvingAgentProgram: method __init__ (line 142) | def __init__(self, initial_state=None): method __call__ (line 149) | def __call__(self, percept): method update_state (line 161) | def update_state(self, state, percept): method formulate_goal (line 164) | def formulate_goal(self, state): method formulate_problem (line 167) | def formulate_problem(self, state, goal): method search (line 170) | def search(self, problem): function breadth_first_tree_search (line 178) | def breadth_first_tree_search(problem): function depth_first_tree_search (line 197) | def depth_first_tree_search(problem): function depth_first_graph_search (line 216) | def depth_first_graph_search(problem): function breadth_first_graph_search (line 238) | def breadth_first_graph_search(problem): function best_first_graph_search (line 260) | def best_first_graph_search(problem, f, display=False): function uniform_cost_search (line 290) | def uniform_cost_search(problem, display=False): function depth_limited_search (line 295) | def depth_limited_search(problem, limit=50): function iterative_deepening_search (line 317) | def iterative_deepening_search(problem): function bidirectional_search (line 329) | def bidirectional_search(problem): function astar_search (line 415) | def astar_search(problem, h=None, display=False): class EightPuzzle (line 426) | class EightPuzzle(Problem): method __init__ (line 431) | def __init__(self, initial, goal=(1, 2, 3, 4, 5, 6, 7, 8, 0)): method find_blank_square (line 435) | def find_blank_square(self, state): method actions (line 440) | def actions(self, state): method result (line 459) | def result(self, state, action): method goal_test (line 473) | def goal_test(self, state): method check_solvability (line 478) | def check_solvability(self, state): method h (line 489) | def h(self, node): class PlanRoute (line 499) | class PlanRoute(Problem): method __init__ (line 502) | def __init__(self, initial, goal, allowed, dimrow): method actions (line 509) | def actions(self, state): method result (line 534) | def result(self, state, action): method goal_test (line 584) | def goal_test(self, state): method h (line 589) | def h(self, node): function recursive_best_first_search (line 603) | def recursive_best_first_search(problem, h=None): function hill_climbing (line 635) | def hill_climbing(problem): function exp_schedule (line 653) | def exp_schedule(k=20, lam=0.005, limit=100): function simulated_annealing (line 658) | def simulated_annealing(problem, schedule=exp_schedule()): function simulated_annealing_full (line 675) | def simulated_annealing_full(problem, schedule=exp_schedule()): function and_or_graph_search (line 694) | def and_or_graph_search(problem): class PeakFindingProblem (line 736) | class PeakFindingProblem(Problem): method __init__ (line 739) | def __init__(self, initial, grid, defined_actions=directions4): method actions (line 749) | def actions(self, state): method result (line 759) | def result(self, state, action): method value (line 763) | def value(self, state): class OnlineDFSAgent (line 771) | class OnlineDFSAgent: method __init__ (line 780) | def __init__(self, problem): method __call__ (line 788) | def __call__(self, percept): method update_state (line 814) | def update_state(self, percept): class OnlineSearchProblem (line 823) | class OnlineSearchProblem(Problem): method __init__ (line 829) | def __init__(self, initial, goal, graph): method actions (line 833) | def actions(self, state): method output (line 836) | def output(self, state, action): method h (line 839) | def h(self, state): method c (line 843) | def c(self, s, a, s1): method update_state (line 847) | def update_state(self, percept): method goal_test (line 850) | def goal_test(self, state): class LRTAStarAgent (line 856) | class LRTAStarAgent: method __init__ (line 864) | def __init__(self, problem): method __call__ (line 871) | def __call__(self, s1): # as of now s1 is a state rather than a percept method LRTA_cost (line 892) | def LRTA_cost(self, s, a, s1, H): function genetic_search (line 911) | def genetic_search(problem, ngen=1000, pmut=0.1, n=20): function genetic_algorithm (line 925) | def genetic_algorithm(population, fitness_fn, gene_pool=[0, 1], f_thres=... function fitness_threshold (line 938) | def fitness_threshold(fitness_fn, f_thres, population): function init_population (line 949) | def init_population(pop_number, gene_pool, state_length): function select (line 963) | def select(r, population, fitness_fn): function recombine (line 969) | def recombine(x, y): function recombine_uniform (line 975) | def recombine_uniform(x, y): function mutate (line 986) | def mutate(x, gene_pool, pmut): class Graph (line 1006) | class Graph: method __init__ (line 1020) | def __init__(self, graph_dict=None, directed=True): method make_undirected (line 1026) | def make_undirected(self): method connect (line 1032) | def connect(self, A, B, distance=1): method connect1 (line 1039) | def connect1(self, A, B, distance): method get (line 1043) | def get(self, a, b=None): method nodes (line 1053) | def nodes(self): function UndirectedGraph (line 1061) | def UndirectedGraph(graph_dict=None): function RandomGraph (line 1066) | def RandomGraph(nodes=list(range(10)), min_links=2, width=400, height=300, class GraphProblem (line 1179) | class GraphProblem(Problem): method __init__ (line 1182) | def __init__(self, initial, goal, graph): method actions (line 1186) | def actions(self, A): method result (line 1190) | def result(self, state, action): method path_cost (line 1194) | def path_cost(self, cost_so_far, A, action, B): method find_min_edge (line 1197) | def find_min_edge(self): method h (line 1206) | def h(self, node): class GraphProblemStochastic (line 1218) | class GraphProblemStochastic(GraphProblem): method result (line 1227) | def result(self, state, action): method path_cost (line 1230) | def path_cost(self): class NQueensProblem (line 1237) | class NQueensProblem(Problem): method __init__ (line 1247) | def __init__(self, N): method actions (line 1251) | def actions(self, state): method result (line 1260) | def result(self, state, row): method conflicted (line 1267) | def conflicted(self, state, row, col): method conflict (line 1272) | def conflict(self, row1, col1, row2, col2): method goal_test (line 1279) | def goal_test(self, state): method h (line 1286) | def h(self, node): function random_boggle (line 1310) | def random_boggle(n=4): function print_boggle (line 1325) | def print_boggle(board): function boggle_neighbors (line 1340) | def boggle_neighbors(n2, cache={}): function exact_sqrt (line 1373) | def exact_sqrt(n2): class Wordlist (line 1383) | class Wordlist: method __init__ (line 1388) | def __init__(self, file, min_len=3): method lookup (line 1398) | def lookup(self, prefix, lo=0, hi=None): method __contains__ (line 1412) | def __contains__(self, word): method __len__ (line 1415) | def __len__(self): class BoggleFinder (line 1422) | class BoggleFinder: method __init__ (line 1427) | def __init__(self, board=None): method set_board (line 1434) | def set_board(self, board=None): method find (line 1446) | def find(self, lo, hi, i, visited, prefix): method words (line 1465) | def words(self): method score (line 1471) | def score(self): method __len__ (line 1475) | def __len__(self): function boggle_hill_climbing (line 1483) | def boggle_hill_climbing(board=None, ntimes=100, verbose=True): function mutate_boggle (line 1504) | def mutate_boggle(board): class InstrumentedProblem (line 1517) | class InstrumentedProblem(Problem): method __init__ (line 1520) | def __init__(self, problem): method actions (line 1525) | def actions(self, state): method result (line 1529) | def result(self, state, action): method goal_test (line 1533) | def goal_test(self, state): method path_cost (line 1540) | def path_cost(self, c, state1, action, state2): method value (line 1543) | def value(self, state): method __getattr__ (line 1546) | def __getattr__(self, attr): method __repr__ (line 1549) | def __repr__(self): function compare_searchers (line 1554) | def compare_searchers(problems, header, function compare_graph_searchers (line 1570) | def compare_graph_searchers(): FILE: tests/test_agents.py function test_move_forward (line 18) | def test_move_forward(): function test_add (line 39) | def test_add(): function test_RandomAgentProgram (line 65) | def test_RandomAgentProgram(): function test_RandomVacuumAgent (line 82) | def test_RandomVacuumAgent(): function test_TableDrivenAgent (line 95) | def test_TableDrivenAgent(): function test_ReflexVacuumAgent (line 131) | def test_ReflexVacuumAgent(): function test_SimpleReflexAgentProgram (line 144) | def test_SimpleReflexAgentProgram(): function test_ModelBasedReflexAgentProgram (line 177) | def test_ModelBasedReflexAgentProgram(): function test_ModelBasedVacuumAgent (line 210) | def test_ModelBasedVacuumAgent(): function test_TableDrivenVacuumAgent (line 223) | def test_TableDrivenVacuumAgent(): function test_compare_agents (line 236) | def test_compare_agents(): function test_TableDrivenAgentProgram (line 253) | def test_TableDrivenAgentProgram(): function test_Agent (line 266) | def test_Agent(): function test_VacuumEnvironment (line 275) | def test_VacuumEnvironment(): function test_WumpusEnvironment (line 302) | def test_WumpusEnvironment(): function test_WumpusEnvironmentActions (line 354) | def test_WumpusEnvironmentActions(): FILE: tests/test_agents4e.py function test_move_forward (line 18) | def test_move_forward(): function test_add (line 39) | def test_add(): function test_RandomAgentProgram (line 65) | def test_RandomAgentProgram(): function test_RandomVacuumAgent (line 82) | def test_RandomVacuumAgent(): function test_TableDrivenAgent (line 95) | def test_TableDrivenAgent(): function test_ReflexVacuumAgent (line 130) | def test_ReflexVacuumAgent(): function test_SimpleReflexAgentProgram (line 143) | def test_SimpleReflexAgentProgram(): function test_ModelBasedReflexAgentProgram (line 176) | def test_ModelBasedReflexAgentProgram(): function test_ModelBasedVacuumAgent (line 209) | def test_ModelBasedVacuumAgent(): function test_TableDrivenVacuumAgent (line 222) | def test_TableDrivenVacuumAgent(): function test_compare_agents (line 235) | def test_compare_agents(): function test_TableDrivenAgentProgram (line 252) | def test_TableDrivenAgentProgram(): function test_Agent (line 265) | def test_Agent(): function test_VacuumEnvironment (line 274) | def test_VacuumEnvironment(): function test_WumpusEnvironment (line 301) | def test_WumpusEnvironment(): function test_WumpusEnvironmentActions (line 353) | def test_WumpusEnvironmentActions(): FILE: tests/test_csp.py function test_csp_assign (line 9) | def test_csp_assign(): function test_csp_unassign (line 19) | def test_csp_unassign(): function test_csp_nconflicts (line 27) | def test_csp_nconflicts(): function test_csp_actions (line 38) | def test_csp_actions(): function test_csp_result (line 58) | def test_csp_result(): function test_csp_goal_test (line 67) | def test_csp_goal_test(): function test_csp_support_pruning (line 76) | def test_csp_support_pruning(): function test_csp_suppose (line 82) | def test_csp_suppose(): function test_csp_prune (line 93) | def test_csp_prune(): function test_csp_choices (line 112) | def test_csp_choices(): function test_csp_infer_assignment (line 124) | def test_csp_infer_assignment(): function test_csp_restore (line 137) | def test_csp_restore(): function test_csp_conflicted_vars (line 147) | def test_csp_conflicted_vars(): function test_revise (line 168) | def test_revise(): function test_AC3 (line 191) | def test_AC3(): function test_AC3b (line 218) | def test_AC3b(): function test_AC4 (line 245) | def test_AC4(): function test_first_unassigned_variable (line 272) | def test_first_unassigned_variable(): function test_num_legal_values (line 282) | def test_num_legal_values(): function test_mrv (line 297) | def test_mrv(): function test_unordered_domain_values (line 319) | def test_unordered_domain_values(): function test_lcv (line 325) | def test_lcv(): function test_forward_checking (line 343) | def test_forward_checking(): function test_backtracking_search (line 382) | def test_backtracking_search(): function test_min_conflicts (line 392) | def test_min_conflicts(): function test_nqueens_csp (line 405) | def test_nqueens_csp(): function test_universal_dict (line 457) | def test_universal_dict(): function test_parse_neighbours (line 462) | def test_parse_neighbours(): function test_topological_sort (line 466) | def test_topological_sort(): function test_tree_csp_solver (line 479) | def test_tree_csp_solver(): function test_ac_solver (line 486) | def test_ac_solver(): function test_ac_search_solver (line 502) | def test_ac_search_solver(): function test_different_values_constraint (line 519) | def test_different_values_constraint(): function test_flatten (line 524) | def test_flatten(): function test_sudoku (line 529) | def test_sudoku(): function test_make_arc_consistent (line 536) | def test_make_arc_consistent(): function test_assign_value (line 565) | def test_assign_value(): function test_no_inference (line 589) | def test_no_inference(): function test_mac (line 601) | def test_mac(): function test_queen_constraint (line 629) | def test_queen_constraint(): function test_zebra (line 635) | def test_zebra(): FILE: tests/test_deep_learning4e.py function test_neural_net (line 20) | def test_neural_net(): function test_perceptron (line 38) | def test_perceptron(): function test_rnn (line 56) | def test_rnn(): function test_autoencoder (line 68) | def test_autoencoder(): FILE: tests/test_games.py function gen_state (line 12) | def gen_state(to_move='X', x_positions=[], o_positions=[], h=3, v=3): function test_minmax_decision (line 28) | def test_minmax_decision(): function test_alpha_beta_search (line 35) | def test_alpha_beta_search(): function test_random_tests (line 58) | def test_random_tests(): FILE: tests/test_games4e.py function gen_state (line 13) | def gen_state(to_move='X', x_positions=[], o_positions=[], h=3, v=3): function test_minmax_decision (line 29) | def test_minmax_decision(): function test_alpha_beta_search (line 36) | def test_alpha_beta_search(): function test_monte_carlo_tree_search (line 59) | def test_monte_carlo_tree_search(): function test_random_tests (line 85) | def test_random_tests(): FILE: tests/test_knowledge.py function r_example (line 35) | def r_example(Alt, Bar, Fri, Hun, Pat, Price, Rain, Res, Type, Est, GOAL): function test_current_best_learning (line 55) | def test_current_best_learning(): function test_version_space_learning (line 78) | def test_version_space_learning(): function test_minimal_consistent_det (line 94) | def test_minimal_consistent_det(): function test_tell (line 162) | def test_tell(): function test_extend_example (line 174) | def test_extend_example(): function test_new_literals (line 185) | def test_new_literals(): function test_new_clause (line 190) | def test_new_clause(): function test_choose_literal (line 198) | def test_choose_literal(): function test_gain (line 212) | def test_gain(): function test_update_examples (line 222) | def test_update_examples(): function test_foil (line 236) | def test_foil(): FILE: tests/test_learning.py function test_exclude (line 8) | def test_exclude(): function test_parse_csv (line 13) | def test_parse_csv(): function test_weighted_mode (line 18) | def test_weighted_mode(): function test_weighted_replicate (line 22) | def test_weighted_replicate(): function test_means_and_deviation (line 26) | def test_means_and_deviation(): function test_plurality_learner (line 37) | def test_plurality_learner(): function test_k_nearest_neighbors (line 43) | def test_k_nearest_neighbors(): function test_decision_tree_learner (line 51) | def test_decision_tree_learner(): function test_svc (line 59) | def test_svc(): function test_information_content (line 78) | def test_information_content(): function test_random_forest (line 87) | def test_random_forest(): function test_neural_network_learner (line 99) | def test_neural_network_learner(): function test_perceptron (line 117) | def test_perceptron(): function test_random_weights (line 131) | def test_random_weights(): function test_ada_boost (line 141) | def test_ada_boost(): FILE: tests/test_learning4e.py function test_exclude (line 9) | def test_exclude(): function test_parse_csv (line 14) | def test_parse_csv(): function test_weighted_mode (line 19) | def test_weighted_mode(): function test_weighted_replicate (line 23) | def test_weighted_replicate(): function test_means_and_deviation (line 27) | def test_means_and_deviation(): function test_plurality_learner (line 38) | def test_plurality_learner(): function test_k_nearest_neighbors (line 44) | def test_k_nearest_neighbors(): function test_decision_tree_learner (line 52) | def test_decision_tree_learner(): function test_svc (line 60) | def test_svc(): function test_information_content (line 79) | def test_information_content(): function test_random_forest (line 88) | def test_random_forest(): function test_random_weights (line 100) | def test_random_weights(): function test_ada_boost (line 110) | def test_ada_boost(): FILE: tests/test_logic.py function test_is_symbol (line 19) | def test_is_symbol(): function test_is_var_symbol (line 28) | def test_is_var_symbol(): function test_is_prop_symbol (line 35) | def test_is_prop_symbol(): function test_variables (line 42) | def test_variables(): function test_expr (line 47) | def test_expr(): function test_extend (line 53) | def test_extend(): function test_subst (line 57) | def test_subst(): function test_PropKB (line 61) | def test_PropKB(): function test_wumpus_kb (line 73) | def test_wumpus_kb(): function test_is_definite_clause (line 93) | def test_is_definite_clause(): function test_parse_definite_clause (line 102) | def test_parse_definite_clause(): function test_pl_true (line 109) | def test_pl_true(): function test_tt_true (line 120) | def test_tt_true(): function test_dpll_satisfiable (line 139) | def test_dpll_satisfiable(): function test_cdcl_satisfiable (line 150) | def test_cdcl_satisfiable(): function test_find_pure_symbol (line 161) | def test_find_pure_symbol(): function test_unit_clause_assign (line 167) | def test_unit_clause_assign(): function test_find_unit_clause (line 173) | def test_find_unit_clause(): function test_unify (line 177) | def test_unify(): function test_unify_mm (line 192) | def test_unify_mm(): function test_pl_fc_entails (line 207) | def test_pl_fc_entails(): function test_tt_entails (line 216) | def test_tt_entails(): function test_prop_symbols (line 225) | def test_prop_symbols(): function test_constant_symbols (line 230) | def test_constant_symbols(): function test_predicate_symbols (line 235) | def test_predicate_symbols(): function test_eliminate_implications (line 250) | def test_eliminate_implications(): function test_dissociate (line 256) | def test_dissociate(): function test_associate (line 262) | def test_associate(): function test_move_not_inwards (line 267) | def test_move_not_inwards(): function test_distribute_and_over_or (line 273) | def test_distribute_and_over_or(): function test_to_cnf (line 287) | def test_to_cnf(): function test_pl_resolution (line 301) | def test_pl_resolution(): function test_standardize_variables (line 311) | def test_standardize_variables(): function test_fol_bc_ask (line 317) | def test_fol_bc_ask(): function test_fol_fc_ask (line 330) | def test_fol_fc_ask(): function test_d (line 344) | def test_d(): function test_WalkSAT (line 348) | def test_WalkSAT(): function test_SAT_plan (line 373) | def test_SAT_plan(): FILE: tests/test_logic4e.py function test_is_symbol (line 17) | def test_is_symbol(): function test_is_var_symbol (line 26) | def test_is_var_symbol(): function test_is_prop_symbol (line 33) | def test_is_prop_symbol(): function test_variables (line 40) | def test_variables(): function test_expr (line 45) | def test_expr(): function test_extend (line 51) | def test_extend(): function test_subst (line 55) | def test_subst(): function test_PropKB (line 59) | def test_PropKB(): function test_wumpus_kb (line 71) | def test_wumpus_kb(): function test_is_definite_clause (line 91) | def test_is_definite_clause(): function test_parse_definite_clause (line 100) | def test_parse_definite_clause(): function test_pl_true (line 107) | def test_pl_true(): function test_tt_true (line 118) | def test_tt_true(): function test_dpll (line 137) | def test_dpll(): function test_find_pure_symbol (line 148) | def test_find_pure_symbol(): function test_unit_clause_assign (line 154) | def test_unit_clause_assign(): function test_find_unit_clause (line 160) | def test_find_unit_clause(): function test_unify (line 164) | def test_unify(): function test_pl_fc_entails (line 172) | def test_pl_fc_entails(): function test_tt_entails (line 181) | def test_tt_entails(): function test_prop_symbols (line 190) | def test_prop_symbols(): function test_constant_symbols (line 195) | def test_constant_symbols(): function test_predicate_symbols (line 200) | def test_predicate_symbols(): function test_eliminate_implications (line 215) | def test_eliminate_implications(): function test_dissociate (line 221) | def test_dissociate(): function test_associate (line 227) | def test_associate(): function test_move_not_inwards (line 234) | def test_move_not_inwards(): function test_distribute_and_over_or (line 240) | def test_distribute_and_over_or(): function test_to_cnf (line 254) | def test_to_cnf(): function test_pl_resolution (line 268) | def test_pl_resolution(): function test_standardize_variables (line 278) | def test_standardize_variables(): function test_fol_bc_ask (line 285) | def test_fol_bc_ask(): function test_fol_fc_ask (line 300) | def test_fol_fc_ask(): function test_d (line 316) | def test_d(): function test_WalkSAT (line 320) | def test_WalkSAT(): function test_SAT_plan (line 343) | def test_SAT_plan(): FILE: tests/test_mdp.py function test_value_iteration (line 25) | def test_value_iteration(): function test_policy_iteration (line 61) | def test_policy_iteration(): function test_best_policy (line 81) | def test_best_policy(): function test_transition_model (line 105) | def test_transition_model(): function test_pomdp_value_iteration (line 127) | def test_pomdp_value_iteration(): function test_pomdp_value_iteration2 (line 147) | def test_pomdp_value_iteration2(): FILE: tests/test_mdp4e.py function test_value_iteration (line 25) | def test_value_iteration(): function test_policy_iteration (line 65) | def test_policy_iteration(): function test_best_policy (line 85) | def test_best_policy(): function test_transition_model (line 113) | def test_transition_model(): function test_pomdp_value_iteration (line 135) | def test_pomdp_value_iteration(): function test_pomdp_value_iteration2 (line 155) | def test_pomdp_value_iteration2(): FILE: tests/test_nlp.py function test_rules (line 20) | def test_rules(): function test_lexicon (line 25) | def test_lexicon(): function test_grammar (line 31) | def test_grammar(): function test_generation (line 44) | def test_generation(): function test_prob_rules (line 64) | def test_prob_rules(): function test_prob_lexicon (line 71) | def test_prob_lexicon(): function test_prob_grammar (line 79) | def test_prob_grammar(): function test_prob_generation (line 93) | def test_prob_generation(): function test_chart_parsing (line 108) | def test_chart_parsing(): function test_CYK_parse (line 114) | def test_CYK_parse(): function test_stripRawHTML (line 177) | def test_stripRawHTML(html_mock): function test_determineInlinks (line 186) | def test_determineInlinks(): function test_findOutlinks_wiki (line 192) | def test_findOutlinks_wiki(): function test_expand_pages (line 204) | def test_expand_pages(): function test_relevant_pages (line 215) | def test_relevant_pages(): function test_normalize (line 225) | def test_normalize(): function test_detectConvergence (line 236) | def test_detectConvergence(): function test_getInlinks (line 254) | def test_getInlinks(): function test_getOutlinks (line 259) | def test_getOutlinks(): function test_HITS (line 264) | def test_HITS(): FILE: tests/test_nlp4e.py function test_rules (line 15) | def test_rules(): function test_lexicon (line 20) | def test_lexicon(): function test_grammar (line 26) | def test_grammar(): function test_generation (line 39) | def test_generation(): function test_prob_rules (line 59) | def test_prob_rules(): function test_prob_lexicon (line 66) | def test_prob_lexicon(): function test_prob_grammar (line 74) | def test_prob_grammar(): function test_prob_generation (line 88) | def test_prob_generation(): function test_chart_parsing (line 102) | def test_chart_parsing(): function test_CYK_parse (line 108) | def test_CYK_parse(): function test_subspan (line 120) | def test_subspan(): function test_text_parsing (line 128) | def test_text_parsing(): FILE: tests/test_perception4e.py function test_array_normalization (line 13) | def test_array_normalization(): function test_sum_squared_difference (line 18) | def test_sum_squared_difference(): function test_gen_gray_scale_picture (line 28) | def test_gen_gray_scale_picture(): function test_generate_edge_weight (line 36) | def test_generate_edge_weight(): function test_graph_bfs (line 41) | def test_graph_bfs(): function test_graph_min_cut (line 49) | def test_graph_min_cut(): function test_gen_discs (line 58) | def test_gen_discs(): function test_simple_convnet (line 64) | def test_simple_convnet(): function test_ROIPoolingLayer (line 72) | def test_ROIPoolingLayer(): FILE: tests/test_planning.py function test_action (line 13) | def test_action(): function test_air_cargo_1 (line 29) | def test_air_cargo_1(): function test_air_cargo_2 (line 45) | def test_air_cargo_2(): function test_air_cargo_3 (line 61) | def test_air_cargo_3(): function test_air_cargo_4 (line 77) | def test_air_cargo_4(): function test_spare_tire_1 (line 93) | def test_spare_tire_1(): function test_spare_tire_2 (line 106) | def test_spare_tire_2(): function test_three_block_tower (line 119) | def test_three_block_tower(): function test_simple_blocks_world (line 132) | def test_simple_blocks_world(): function test_have_cake_and_eat_cake_too (line 145) | def test_have_cake_and_eat_cake_too(): function test_shopping_problem_1 (line 157) | def test_shopping_problem_1(): function test_shopping_problem_2 (line 172) | def test_shopping_problem_2(): function test_graph_call (line 187) | def test_graph_call(): function test_graphPlan (line 197) | def test_graphPlan(): function test_forwardPlan (line 239) | def test_forwardPlan(): function test_backwardPlan (line 281) | def test_backwardPlan(): function test_CSPlan (line 332) | def test_CSPlan(): function test_SATPlan (line 377) | def test_SATPlan(): function test_linearize_class (line 398) | def test_linearize_class(): function test_expand_actions (line 442) | def test_expand_actions(): function test_expand_feats_values (line 452) | def test_expand_feats_values(): function test_find_open_precondition (line 462) | def test_find_open_precondition(): function test_cyclic (line 484) | def test_cyclic(): function test_partial_order_planner (line 500) | def test_partial_order_planner(): function test_double_tennis (line 513) | def test_double_tennis(): function test_job_shop_problem (line 527) | def test_job_shop_problem(): function test_refinements (line 588) | def test_refinements(): function test_hierarchical_search (line 607) | def test_hierarchical_search(): function test_convert_angelic_HLA (line 633) | def test_convert_angelic_HLA(): function test_is_primitive (line 652) | def test_is_primitive(): function test_angelic_action (line 661) | def test_angelic_action(): function test_optimistic_reachable_set (line 685) | def test_optimistic_reachable_set(): function test_pessimistic_reachable_set (line 700) | def test_pessimistic_reachable_set(): function test_find_reachable_set (line 715) | def test_find_reachable_set(): function test_intersects_goal (line 726) | def test_intersects_goal(): function test_making_progress (line 736) | def test_making_progress(): function test_angelic_search (line 746) | def test_angelic_search(): FILE: tests/test_probabilistic_learning.py function test_naive_bayes (line 11) | def test_naive_bayes(): FILE: tests/test_probability.py function tests (line 9) | def tests(): function test_probdist_basic (line 32) | def test_probdist_basic(): function test_probdist_frequency (line 47) | def test_probdist_frequency(): function test_probdist_normalize (line 56) | def test_probdist_normalize(): function test_jointprob (line 69) | def test_jointprob(): function test_event_values (line 77) | def test_event_values(): function test_enumerate_joint (line 82) | def test_enumerate_joint(): function test_enumerate_joint_ask (line 106) | def test_enumerate_joint_ask(): function test_bayesnode_p (line 115) | def test_bayesnode_p(): function test_bayesnode_sample (line 122) | def test_bayesnode_sample(): function test_enumeration_ask (line 130) | def test_enumeration_ask(): function test_elimination_ask (line 148) | def test_elimination_ask(): function test_prior_sample (line 166) | def test_prior_sample(): function test_prior_sample2 (line 179) | def test_prior_sample2(): function test_rejection_sampling (line 192) | def test_rejection_sampling(): function test_rejection_sampling2 (line 211) | def test_rejection_sampling2(): function test_likelihood_weighting (line 230) | def test_likelihood_weighting(): function test_likelihood_weighting2 (line 252) | def test_likelihood_weighting2(): function test_forward_backward (line 271) | def test_forward_backward(): function test_viterbi (line 285) | def test_viterbi(): function test_fixed_lag_smoothing (line 299) | def test_fixed_lag_smoothing(): function test_particle_filtering (line 320) | def test_particle_filtering(): function test_monte_carlo_localization (line 332) | def test_monte_carlo_localization(): function test_gibbs_ask (line 394) | def test_gibbs_ask(): FILE: tests/test_probability4e.py function tests (line 8) | def tests(): function test_probdist_basic (line 34) | def test_probdist_basic(): function test_probdist_frequency (line 49) | def test_probdist_frequency(): function test_probdist_normalize (line 58) | def test_probdist_normalize(): function test_jointprob (line 74) | def test_jointprob(): function test_event_values (line 82) | def test_event_values(): function test_enumerate_joint (line 87) | def test_enumerate_joint(): function test_enumerate_joint_ask (line 111) | def test_enumerate_joint_ask(): function test_is_independent (line 120) | def test_is_independent(): function test_bayesnode_p (line 131) | def test_bayesnode_p(): function test_bayesnode_sample (line 138) | def test_bayesnode_sample(): function test_gaussian_probability (line 149) | def test_gaussian_probability(): function test_logistic_probability (line 155) | def test_logistic_probability(): function test_enumeration_ask (line 162) | def test_enumeration_ask(): function test_elimination_ask (line 180) | def test_elimination_ask(): function test_prior_sample (line 201) | def test_prior_sample(): function test_prior_sample2 (line 214) | def test_prior_sample2(): function test_rejection_sampling (line 227) | def test_rejection_sampling(): function test_rejection_sampling2 (line 246) | def test_rejection_sampling2(): function test_likelihood_weighting (line 265) | def test_likelihood_weighting(): function test_likelihood_weighting2 (line 287) | def test_likelihood_weighting2(): function test_gibbs_ask (line 306) | def test_gibbs_ask(): FILE: tests/test_reinforcement_learning.py function test_PassiveDUEAgent (line 20) | def test_PassiveDUEAgent(): function test_PassiveADPAgent (line 33) | def test_PassiveADPAgent(): function test_PassiveTDAgent (line 46) | def test_PassiveTDAgent(): function test_QLearning (line 58) | def test_QLearning(): FILE: tests/test_reinforcement_learning4e.py function test_PassiveDUEAgent (line 18) | def test_PassiveDUEAgent(): function test_PassiveADPAgent (line 31) | def test_PassiveADPAgent(): function test_PassiveTDAgent (line 44) | def test_PassiveTDAgent(): function test_QLearning (line 56) | def test_QLearning(): FILE: tests/test_search.py function test_find_min_edge (line 14) | def test_find_min_edge(): function test_breadth_first_tree_search (line 18) | def test_breadth_first_tree_search(): function test_breadth_first_graph_search (line 24) | def test_breadth_first_graph_search(): function test_best_first_graph_search (line 28) | def test_best_first_graph_search(): function test_uniform_cost_search (line 44) | def test_uniform_cost_search(): function test_depth_first_tree_search (line 50) | def test_depth_first_tree_search(): function test_depth_first_graph_search (line 54) | def test_depth_first_graph_search(): function test_iterative_deepening_search (line 59) | def test_iterative_deepening_search(): function test_depth_limited_search (line 64) | def test_depth_limited_search(): function test_bidirectional_search (line 72) | def test_bidirectional_search(): function test_astar_search (line 78) | def test_astar_search(): function test_find_blank_square (line 86) | def test_find_blank_square(): function test_actions (line 96) | def test_actions(): function test_result (line 106) | def test_result(): function test_goal_test (line 117) | def test_goal_test(): function test_check_solvability (line 132) | def test_check_solvability(): function test_conflict (line 145) | def test_conflict(): function test_recursive_best_first_search (line 156) | def test_recursive_best_first_search(): function test_hill_climbing (line 185) | def test_hill_climbing(): function test_simulated_annealing (line 199) | def test_simulated_annealing(): function test_BoggleFinder (line 211) | def test_BoggleFinder(): function test_and_or_graph_search (line 223) | def test_and_or_graph_search(): function test_online_dfs_agent (line 236) | def test_online_dfs_agent(): function test_LRTAStarAgent (line 244) | def test_LRTAStarAgent(): function test_genetic_algorithm (line 259) | def test_genetic_algorithm(): function GA_GraphColoringChars (line 300) | def GA_GraphColoringChars(edges, fitness): function GA_GraphColoringBools (line 307) | def GA_GraphColoringBools(edges, fitness): function GA_GraphColoringInts (line 314) | def GA_GraphColoringInts(edges, fitness): function test_simpleProblemSolvingAgent (line 320) | def test_simpleProblemSolvingAgent(): FILE: tests/test_text.py function test_text_models (line 12) | def test_text_models(): function test_char_models (line 61) | def test_char_models(): function test_samples (line 126) | def test_samples(): function test_viterbi_segmentation (line 143) | def test_viterbi_segmentation(): function test_shift_encoding (line 154) | def test_shift_encoding(): function test_shift_decoding (line 160) | def test_shift_decoding(): function test_permutation_decoder (line 168) | def test_permutation_decoder(): function test_rot13_encoding (line 180) | def test_rot13_encoding(): function test_rot13_decoding (line 186) | def test_rot13_decoding(): function test_counting_probability_distribution (line 194) | def test_counting_probability_distribution(): function test_ir_system (line 205) | def test_ir_system(): function test_words (line 272) | def test_words(): function test_canonicalize (line 276) | def test_canonicalize(): function test_translate (line 280) | def test_translate(): function test_bigrams (line 287) | def test_bigrams(): FILE: tests/test_utils.py function test_sequence (line 8) | def test_sequence(): function test_remove_all_list (line 18) | def test_remove_all_list(): function test_remove_all_string (line 25) | def test_remove_all_string(): function test_unique (line 31) | def test_unique(): function test_count (line 37) | def test_count(): function test_multimap (line 45) | def test_multimap(): function test_product (line 52) | def test_product(): function test_first (line 57) | def test_first(): function test_is_in (line 72) | def test_is_in(): function test_mode (line 78) | def test_mode(): function test_power_set (line 84) | def test_power_set(): function test_histogram (line 88) | def test_histogram(): function test_euclidean (line 95) | def test_euclidean(): function test_cross_entropy (line 106) | def test_cross_entropy(): function test_rms_error (line 117) | def test_rms_error(): function test_manhattan_distance (line 125) | def test_manhattan_distance(): function test_mean_boolean_error (line 133) | def test_mean_boolean_error(): function test_mean_error (line 141) | def test_mean_error(): function test_dot_product (line 149) | def test_dot_product(): function test_vector_add (line 154) | def test_vector_add(): function test_rounder (line 159) | def test_rounder(): function test_num_or_str (line 167) | def test_num_or_str(): function test_normalize (line 172) | def test_normalize(): function test_gaussian (line 176) | def test_gaussian(): function test_weighted_choice (line 182) | def test_weighted_choice(): function compare_list (line 188) | def compare_list(x, y): function test_distance (line 192) | def test_distance(): function test_distance_squared (line 196) | def test_distance_squared(): function test_turn_heading (line 200) | def test_turn_heading(): function test_turn_left (line 211) | def test_turn_left(): function test_turn_right (line 215) | def test_turn_right(): function test_step (line 219) | def test_step(): function test_Expr (line 225) | def test_Expr(): function test_expr (line 248) | def test_expr(): function test_min_priority_queue (line 260) | def test_min_priority_queue(): function test_max_priority_queue (line 276) | def test_max_priority_queue(): function test_priority_queue_with_objects (line 284) | def test_priority_queue_with_objects(): FILE: text.py class UnigramWordModel (line 22) | class UnigramWordModel(CountingProbDist): method __init__ (line 27) | def __init__(self, observations, default=0): method samples (line 32) | def samples(self, n): class NgramWordModel (line 37) | class NgramWordModel(CountingProbDist): method __init__ (line 42) | def __init__(self, n, observation_sequence=None, default=0): method add_cond_prob (line 53) | def add_cond_prob(self, ngram): method add_sequence (line 59) | def add_sequence(self, words): method samples (line 68) | def samples(self, nwords): class NgramCharModel (line 85) | class NgramCharModel(NgramWordModel): method add_sequence (line 86) | def add_sequence(self, words): class UnigramCharModel (line 92) | class UnigramCharModel(NgramCharModel): method __init__ (line 93) | def __init__(self, observation_sequence=None, default=0): method add_sequence (line 99) | def add_sequence(self, words): function viterbi_segment (line 108) | def viterbi_segment(text, P): class IRSystem (line 138) | class IRSystem: method __init__ (line 147) | def __init__(self, stopwords='the a of'): method index_collection (line 155) | def index_collection(self, filenames): method index_document (line 161) | def index_document(self, text, url): method query (line 172) | def query(self, query_text, n=10): method score (line 185) | def score(self, word, docid): method total_score (line 190) | def total_score(self, words, docid): method present (line 194) | def present(self, results): method present_results (line 200) | def present_results(self, query_text, n=10): class UnixConsultant (line 205) | class UnixConsultant(IRSystem): method __init__ (line 208) | def __init__(self): class Document (line 219) | class Document: method __init__ (line 222) | def __init__(self, title, url, nwords): function words (line 228) | def words(text, reg=re.compile('[a-z0-9]+')): function canonicalize (line 237) | def canonicalize(text): function shift_encode (line 258) | def shift_encode(plaintext, n): function rot13 (line 266) | def rot13(plaintext): function translate (line 276) | def translate(plaintext, function): function maketrans (line 284) | def maketrans(from_, to_): function encode (line 293) | def encode(plaintext, code): function bigrams (line 300) | def bigrams(text): class ShiftDecoder (line 313) | class ShiftDecoder: method __init__ (line 318) | def __init__(self, training_text): method score (line 322) | def score(self, plaintext): method decode (line 331) | def decode(self, ciphertext): function all_shifts (line 337) | def all_shifts(text): class PermutationDecoder (line 346) | class PermutationDecoder: method __init__ (line 360) | def __init__(self, training_text, ciphertext=None): method decode (line 365) | def decode(self, ciphertext): method score (line 377) | def score(self, code): class PermutationDecoderProblem (line 395) | class PermutationDecoderProblem(search.Problem): method __init__ (line 397) | def __init__(self, initial=None, goal=None, decoder=None): method actions (line 401) | def actions(self, state): method result (line 409) | def result(self, state, action): method goal_test (line 414) | def goal_test(self, state): FILE: utils.py function sequence (line 21) | def sequence(iterable): function remove_all (line 26) | def remove_all(item, seq): function unique (line 38) | def unique(seq): function count (line 43) | def count(seq): function multimap (line 48) | def multimap(items): function multimap_items (line 56) | def multimap_items(mmap): function product (line 63) | def product(numbers): function first (line 71) | def first(iterable, default=None): function is_in (line 76) | def is_in(elt, seq): function mode (line 81) | def mode(data): function power_set (line 87) | def power_set(iterable): function extend (line 93) | def extend(s, var, val): function flatten (line 98) | def flatten(seqs): function argmin_random_tie (line 108) | def argmin_random_tie(seq, key=identity): function argmax_random_tie (line 113) | def argmax_random_tie(seq, key=identity): function shuffled (line 118) | def shuffled(iterable): function histogram (line 129) | def histogram(values, mode=0, bin_function=None): function dot_product (line 146) | def dot_product(x, y): function element_wise_product (line 151) | def element_wise_product(x, y): function matrix_multiplication (line 157) | def matrix_multiplication(x, *y): function vector_add (line 167) | def vector_add(a, b): function scalar_vector_product (line 172) | def scalar_vector_product(x, y): function probability (line 177) | def probability(p): function weighted_sample_with_replacement (line 182) | def weighted_sample_with_replacement(n, seq, weights): function weighted_sampler (line 190) | def weighted_sampler(seq, weights): function weighted_choice (line 198) | def weighted_choice(choices): function rounder (line 211) | def rounder(numbers, d=4): function num_or_str (line 220) | def num_or_str(x): # TODO: rename as `atom` function euclidean_distance (line 231) | def euclidean_distance(x, y): function manhattan_distance (line 235) | def manhattan_distance(x, y): function hamming_distance (line 239) | def hamming_distance(x, y): function cross_entropy_loss (line 243) | def cross_entropy_loss(x, y): function mean_squared_error_loss (line 247) | def mean_squared_error_loss(x, y): function rms_error (line 251) | def rms_error(x, y): function ms_error (line 255) | def ms_error(x, y): function mean_error (line 259) | def mean_error(x, y): function mean_boolean_error (line 263) | def mean_boolean_error(x, y): function normalize (line 267) | def normalize(dist): function random_weights (line 279) | def random_weights(min_value, max_value, num_weights): function sigmoid (line 283) | def sigmoid(x): function sigmoid_derivative (line 288) | def sigmoid_derivative(value): function elu (line 292) | def elu(x, alpha=0.01): function elu_derivative (line 296) | def elu_derivative(value, alpha=0.01): function tanh (line 300) | def tanh(x): function tanh_derivative (line 304) | def tanh_derivative(value): function leaky_relu (line 308) | def leaky_relu(x, alpha=0.01): function leaky_relu_derivative (line 312) | def leaky_relu_derivative(value, alpha=0.01): function relu (line 316) | def relu(x): function relu_derivative (line 320) | def relu_derivative(value): function step (line 324) | def step(x): function gaussian (line 329) | def gaussian(mean, st_dev, x): function linear_kernel (line 334) | def linear_kernel(x, y=None): function polynomial_kernel (line 340) | def polynomial_kernel(x, y=None, degree=2.0): function rbf_kernel (line 346) | def rbf_kernel(x, y=None, gamma=None): function turn_heading (line 364) | def turn_heading(heading, inc, headings=orientations): function turn_right (line 368) | def turn_right(heading): function turn_left (line 372) | def turn_left(heading): function distance (line 376) | def distance(a, b): function distance_squared (line 383) | def distance_squared(a, b): class injection (line 393) | class injection: method __init__ (line 397) | def __init__(self, **kwds): method __enter__ (line 400) | def __enter__(self): method __exit__ (line 404) | def __exit__(self, type, value, traceback): function memoize (line 408) | def memoize(fn, slot=None, maxsize=32): function name (line 428) | def name(obj): function isnumber (line 435) | def isnumber(x): function issequence (line 440) | def issequence(x): function print_table (line 445) | def print_table(table, header=None, sep=' ', numfmt='{}'): function open_data (line 465) | def open_data(name, mode='r'): function failure_test (line 472) | def failure_test(algorithm, tests): class Expr (line 487) | class Expr: method __init__ (line 493) | def __init__(self, op, *args): method __neg__ (line 498) | def __neg__(self): method __pos__ (line 501) | def __pos__(self): method __invert__ (line 504) | def __invert__(self): method __add__ (line 507) | def __add__(self, rhs): method __sub__ (line 510) | def __sub__(self, rhs): method __mul__ (line 513) | def __mul__(self, rhs): method __pow__ (line 516) | def __pow__(self, rhs): method __mod__ (line 519) | def __mod__(self, rhs): method __and__ (line 522) | def __and__(self, rhs): method __xor__ (line 525) | def __xor__(self, rhs): method __rshift__ (line 528) | def __rshift__(self, rhs): method __lshift__ (line 531) | def __lshift__(self, rhs): method __truediv__ (line 534) | def __truediv__(self, rhs): method __floordiv__ (line 537) | def __floordiv__(self, rhs): method __matmul__ (line 540) | def __matmul__(self, rhs): method __or__ (line 543) | def __or__(self, rhs): method __radd__ (line 551) | def __radd__(self, lhs): method __rsub__ (line 554) | def __rsub__(self, lhs): method __rmul__ (line 557) | def __rmul__(self, lhs): method __rdiv__ (line 560) | def __rdiv__(self, lhs): method __rpow__ (line 563) | def __rpow__(self, lhs): method __rmod__ (line 566) | def __rmod__(self, lhs): method __rand__ (line 569) | def __rand__(self, lhs): method __rxor__ (line 572) | def __rxor__(self, lhs): method __ror__ (line 575) | def __ror__(self, lhs): method __rrshift__ (line 578) | def __rrshift__(self, lhs): method __rlshift__ (line 581) | def __rlshift__(self, lhs): method __rtruediv__ (line 584) | def __rtruediv__(self, lhs): method __rfloordiv__ (line 587) | def __rfloordiv__(self, lhs): method __rmatmul__ (line 590) | def __rmatmul__(self, lhs): method __call__ (line 593) | def __call__(self, *args): method __eq__ (line 601) | def __eq__(self, other): method __lt__ (line 605) | def __lt__(self, other): method __hash__ (line 608) | def __hash__(self): method __repr__ (line 611) | def __repr__(self): function Symbol (line 631) | def Symbol(name): function symbols (line 636) | def symbols(names): function subexpressions (line 641) | def subexpressions(x): function arity (line 649) | def arity(expression): class PartialExpr (line 660) | class PartialExpr: method __init__ (line 663) | def __init__(self, op, lhs): method __or__ (line 666) | def __or__(self, rhs): method __repr__ (line 669) | def __repr__(self): function expr (line 673) | def expr(x): function expr_handle_infix_ops (line 687) | def expr_handle_infix_ops(x): class defaultkeydict (line 697) | class defaultkeydict(collections.defaultdict): method __missing__ (line 703) | def __missing__(self, key): class hashabledict (line 708) | class hashabledict(dict): method __hash__ (line 712) | def __hash__(self): class PriorityQueue (line 722) | class PriorityQueue: method __init__ (line 729) | def __init__(self, order='min', f=lambda x: x): method append (line 738) | def append(self, item): method extend (line 742) | def extend(self, items): method pop (line 747) | def pop(self): method __len__ (line 755) | def __len__(self): method __contains__ (line 759) | def __contains__(self, key): method __getitem__ (line 763) | def __getitem__(self, key): method __delitem__ (line 771) | def __delitem__(self, key): class Bool (line 784) | class Bool(int): FILE: utils4e.py class PriorityQueue (line 23) | class PriorityQueue: method __init__ (line 29) | def __init__(self, order='min', f=lambda x: x): method append (line 39) | def append(self, item): method extend (line 43) | def extend(self, items): method pop (line 48) | def pop(self): method __len__ (line 56) | def __len__(self): method __contains__ (line 60) | def __contains__(self, key): method __getitem__ (line 64) | def __getitem__(self, key): method __delitem__ (line 72) | def __delitem__(self, key): function sequence (line 85) | def sequence(iterable): function remove_all (line 91) | def remove_all(item, seq): function unique (line 103) | def unique(seq): function count (line 108) | def count(seq): function multimap (line 113) | def multimap(items): function multimap_items (line 121) | def multimap_items(mmap): function product (line 128) | def product(numbers): function first (line 136) | def first(iterable, default=None): function is_in (line 141) | def is_in(elt, seq): function mode (line 146) | def mode(data): function power_set (line 152) | def power_set(iterable): function extend (line 158) | def extend(s, var, val): function flatten (line 163) | def flatten(seqs): function argmin_random_tie (line 174) | def argmin_random_tie(seq, key=identity): function argmax_random_tie (line 179) | def argmax_random_tie(seq, key=identity): function shuffled (line 184) | def shuffled(iterable): function histogram (line 195) | def histogram(values, mode=0, bin_function=None): function element_wise_product (line 212) | def element_wise_product(x, y): function vector_add (line 222) | def vector_add(a, b): function scalar_vector_product (line 236) | def scalar_vector_product(x, y): function map_vector (line 241) | def map_vector(f, x): function probability (line 246) | def probability(p): function weighted_sample_with_replacement (line 251) | def weighted_sample_with_replacement(n, seq, weights): function weighted_sampler (line 260) | def weighted_sampler(seq, weights): function weighted_choice (line 269) | def weighted_choice(choices): function rounder (line 282) | def rounder(numbers, d=4): function num_or_str (line 291) | def num_or_str(x): # TODO: rename as `atom` function euclidean_distance (line 303) | def euclidean_distance(x, y): function manhattan_distance (line 307) | def manhattan_distance(x, y): function hamming_distance (line 311) | def hamming_distance(x, y): function rms_error (line 315) | def rms_error(x, y): function ms_error (line 319) | def ms_error(x, y): function mean_error (line 323) | def mean_error(x, y): function mean_boolean_error (line 327) | def mean_boolean_error(x, y): function cross_entropy_loss (line 335) | def cross_entropy_loss(x, y): function mean_squared_error_loss (line 340) | def mean_squared_error_loss(x, y): function normalize (line 345) | def normalize(dist): function random_weights (line 357) | def random_weights(min_value, max_value, num_weights): function conv1D (line 361) | def conv1D(x, k): function gaussian_kernel (line 366) | def gaussian_kernel(size=3): function gaussian_kernel_1D (line 370) | def gaussian_kernel_1D(size=3, sigma=0.5): function gaussian_kernel_2D (line 374) | def gaussian_kernel_2D(size=3, sigma=0.5): function step (line 380) | def step(x): function gaussian (line 385) | def gaussian(mean, st_dev, x): function linear_kernel (line 390) | def linear_kernel(x, y=None): function polynomial_kernel (line 396) | def polynomial_kernel(x, y=None, degree=2.0): function rbf_kernel (line 402) | def rbf_kernel(x, y=None, gamma=None): function turn_heading (line 421) | def turn_heading(heading, inc, headings=orientations): function turn_right (line 425) | def turn_right(heading): function turn_left (line 429) | def turn_left(heading): function distance (line 433) | def distance(a, b): function distance_squared (line 440) | def distance_squared(a, b): class injection (line 451) | class injection: method __init__ (line 455) | def __init__(self, **kwds): method __enter__ (line 458) | def __enter__(self): method __exit__ (line 462) | def __exit__(self, type, value, traceback): function memoize (line 466) | def memoize(fn, slot=None, maxsize=32): function name (line 486) | def name(obj): function isnumber (line 493) | def isnumber(x): function issequence (line 498) | def issequence(x): function print_table (line 503) | def print_table(table, header=None, sep=' ', numfmt='{}'): function open_data (line 525) | def open_data(name, mode='r'): function failure_test (line 532) | def failure_test(algorithm, tests): class Expr (line 548) | class Expr: method __init__ (line 554) | def __init__(self, op, *args): method __neg__ (line 559) | def __neg__(self): method __pos__ (line 562) | def __pos__(self): method __invert__ (line 565) | def __invert__(self): method __add__ (line 568) | def __add__(self, rhs): method __sub__ (line 571) | def __sub__(self, rhs): method __mul__ (line 574) | def __mul__(self, rhs): method __pow__ (line 577) | def __pow__(self, rhs): method __mod__ (line 580) | def __mod__(self, rhs): method __and__ (line 583) | def __and__(self, rhs): method __xor__ (line 586) | def __xor__(self, rhs): method __rshift__ (line 589) | def __rshift__(self, rhs): method __lshift__ (line 592) | def __lshift__(self, rhs): method __truediv__ (line 595) | def __truediv__(self, rhs): method __floordiv__ (line 598) | def __floordiv__(self, rhs): method __matmul__ (line 601) | def __matmul__(self, rhs): method __or__ (line 604) | def __or__(self, rhs): method __radd__ (line 612) | def __radd__(self, lhs): method __rsub__ (line 615) | def __rsub__(self, lhs): method __rmul__ (line 618) | def __rmul__(self, lhs): method __rdiv__ (line 621) | def __rdiv__(self, lhs): method __rpow__ (line 624) | def __rpow__(self, lhs): method __rmod__ (line 627) | def __rmod__(self, lhs): method __rand__ (line 630) | def __rand__(self, lhs): method __rxor__ (line 633) | def __rxor__(self, lhs): method __ror__ (line 636) | def __ror__(self, lhs): method __rrshift__ (line 639) | def __rrshift__(self, lhs): method __rlshift__ (line 642) | def __rlshift__(self, lhs): method __rtruediv__ (line 645) | def __rtruediv__(self, lhs): method __rfloordiv__ (line 648) | def __rfloordiv__(self, lhs): method __rmatmul__ (line 651) | def __rmatmul__(self, lhs): method __call__ (line 654) | def __call__(self, *args): method __eq__ (line 662) | def __eq__(self, other): method __lt__ (line 666) | def __lt__(self, other): method __hash__ (line 669) | def __hash__(self): method __repr__ (line 672) | def __repr__(self): function Symbol (line 692) | def Symbol(name): function symbols (line 697) | def symbols(names): function subexpressions (line 702) | def subexpressions(x): function arity (line 710) | def arity(expression): class PartialExpr (line 721) | class PartialExpr: method __init__ (line 724) | def __init__(self, op, lhs): method __or__ (line 727) | def __or__(self, rhs): method __repr__ (line 730) | def __repr__(self): function expr (line 734) | def expr(x): function expr_handle_infix_ops (line 751) | def expr_handle_infix_ops(x): class defaultkeydict (line 761) | class defaultkeydict(collections.defaultdict): method __missing__ (line 767) | def __missing__(self, key): class hashabledict (line 772) | class hashabledict(dict): method __hash__ (line 776) | def __hash__(self): class MCT_Node (line 784) | class MCT_Node: method __init__ (line 787) | def __init__(self, parent=None, state=None, U=0, N=0): function ucb (line 793) | def ucb(n, C=1.4): class Bool (line 801) | class Bool(int):