This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MSSubClass: Identifies the type of dwelling involved in the sale. | |
20 1-STORY 1946 & NEWER ALL STYLES | |
30 1-STORY 1945 & OLDER | |
40 1-STORY W/FINISHED ATTIC ALL AGES | |
45 1-1/2 STORY - UNFINISHED ALL AGES | |
50 1-1/2 STORY FINISHED ALL AGES | |
60 2-STORY 1946 & NEWER | |
70 2-STORY 1945 & OLDER | |
75 2-1/2 STORY ALL AGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture(0) | |
# Define the codec and create VideoWriter object | |
fourcc = cv2.VideoWriter_fourcc(*'XVID') | |
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) | |
while(cap.isOpened()): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture('vtest.avi') | |
while(cap.isOpened()): | |
ret, frame = cap.read() | |
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import cv2 | |
cap = cv2.VideoCapture(0) | |
while(True): | |
# Capture frame-by-frame | |
ret, frame = cap.read() | |
# Our operations on the frame come here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from math import sin as sn | |
import matplotlib.pyplot as plt | |
import time | |
# Number of test points | |
N_point = 1000 | |
# Define a custom function with some if-else loops | |
def myfunc(x,y): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import clear_output | |
from time import sleep | |
def print_frames(frames): | |
for i, frame in enumerate(frames): | |
clear_output(wait=True) | |
print(frame['frame'].getvalue()) | |
print(f"Timestep: {i + 1}") | |
print(f"State: {frame['state']}") | |
print(f"Action: {frame['action']}") | |
print(f"Reward: {frame['reward']}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env.s = 328 # Set environment to illustration's state | |
epochs = 0 | |
penalties, reward = 0, 0 | |
frames = [] #for animation | |
done = False | |
while not done: | |
action = env.action_space.sample() | |
state, reward, done, info = env.step(action) | |
if reward == -10: | |
penalties += 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Evaluate agent's performance after Q-learning""" | |
total_epochs, total_penalties = 0, 0 | |
episodes = 100 | |
for _ in range(episodes): | |
state = env.reset() | |
epochs, penalties, reward = 0, 0, 0 | |
done = False | |
while not done: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%time | |
"""Training the agent""" | |
import random | |
from IPython.display import clear_output | |
# Hyperparameters | |
alpha = 0.1 | |
gamma = 0.6 | |
epsilon = 0.1 | |
# For plotting metrics | |
all_epochs = [] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder