This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
import ui | |
import random | |
import numpy as np | |
import speech | |
import time | |
def gradient_descent_line_fitter(x, y, learning_rate = 0.02, stop_criteria = 1e-5, max_iter = 10000): | |
scaling_factor = 100.0 | |
x = x/scaling_factor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
import ui | |
import random | |
import numpy as np | |
import speech | |
import time | |
def gradient_descent_line_fitter(x, y, learning_rate = 0.02, stop_criteria = 1e-5, max_iter = 10000): | |
scaling_factor = 100.0 | |
x = x/scaling_factor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
import ui | |
import random | |
import numpy as np | |
import speech | |
import time | |
# Create data | |
N = 1000 | |
a = 3.5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
import ui | |
class MyScene (Scene): | |
def setup(self): | |
self.background_color = 'midnightblue' | |
self.points = [] | |
self.point_size = 10 | |
def touch_began(self, touch): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
import speech | |
import random | |
from PIL import Image | |
import numpy | |
rabbit_size = 50 | |
v = ui.View(background_color=('#bcdeff')) | |
board = ui.View() | |
v.add_subview(board) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
import speech | |
import random | |
from PIL import Image | |
rabbit_size = 50 | |
v = ui.View(background_color=('#bcdeff')) | |
board = ui.View() | |
v.add_subview(board) | |
v.present('full_screen', hide_title_bar=False , orientations=['landscape']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
import random | |
from PIL import Image | |
rabbit_size = 100 | |
v = ui.View(background_color=('#bcdeff')) | |
board = ui.View() | |
v.add_subview(board) | |
v.present('full_screen', hide_title_bar=False , orientations=['landscape']) | |
board.frame = (v.width-v.height, rabbit_size/2, v.height-rabbit_size, v.height-rabbit_size) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ui | |
import random | |
from PIL import Image | |
v = ui.View(background_color=('#bcdeff')) | |
board = ui.View() | |
v.add_subview(board) | |
v.present('full_screen', hide_title_bar=False , orientations=['landscape']) | |
board.frame = (v.width-v.height, 0, v.height, v.height) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"bagpipe": {"on": 0.07142857142857142, "said": 0.07142857142857142, "Shall": 0.07142857142857142, "Did": 0.07142857142857142, "Ah": 0.07142857142857142, "didn": 0.35714285714285715, "I": 0.07142857142857142, "won": 0.07142857142857142, "lying": 0.07142857142857142, "if": 0.07142857142857142}, "pardon": {"the": 1.0}, "Gnu": {"murnood": 1.0}, "Night": {"s": 0.6666666666666666, "\n": 0.3333333333333333}, "yellow": {"caterpillar": 1.0}, "four": {"nickels": 0.2, "\n": 0.4, "is": 0.2, "more": 0.2}, "hath": {"spoken": 0.3333333333333333, "sent": 0.3333333333333333, "lent": 0.3333333333333333}, "Wretch": {"I": 1.0}, "sleep": {"late": 0.2, "\n": 0.6, "in": 0.2}, "SARDINES": {"\n": 1.0}, "Zoomed": {"up": 1.0}, "evermore": {"\n": 1.0}, "hate": {"\n": 1.0}, "Until": {"I": 0.3333333333333333, "a": 0.3333333333333333, "he": 0.3333333333333333}, "drinkin": {"that": 1.0}, "whose": {"foot": 0.3333333333333333, "velvet": 0.3333333333333333, "fiery": 0.3333333333333333}, "swam": {"away": 1.0}, "Claus": {"\n": 1.0}, "sweetest": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, random | |
import numpy as np | |
import json | |
poem_files = ['pg17192.txt', 'Where the Sidewalk Ends by Shel Silverstein_djvu.txt'] | |
poem_lines = [] | |
firstword_count_dict = {} | |
firstword_prob_dict = {} | |
for poem_file in poem_files: | |
f = open(poem_file, 'r') |
NewerOlder