Ejemplo n.º 1
0
def make_creature(canvas):
    # face:
    helpers.make_circle(canvas, (250, 150), 100, fill='teal')

    # left eye:
    helpers.make_oval(canvas, (225, 130), 10, 18, fill='black')

    # right eye:
    helpers.make_oval(canvas, (275, 130), 10, 18, fill='black')
Ejemplo n.º 2
0
def make_creature(canvas):
    ## TODO: replace all of this code with your creature!
    ## This is just a hard-coded example

    # face:
    helpers.make_circle(canvas, (250, 150), 100, fill='teal')

    # left eye:
    helpers.make_oval(canvas, (225, 130), 10, 18, fill='black')

    # right eye:
    helpers.make_oval(canvas, (275, 130), 10, 18, fill='black')
Ejemplo n.º 3
0
from tkinter import Canvas, Tk
from helpers import make_circle

gui = Tk()
gui.title('Circle')
canvas = Canvas(gui, width=500, height=500, background='white')
canvas.pack()
########################## YOUR CODE BELOW THIS LINE ##############################




# Make the second spirograph pictured
make_circle(canvas, (100, 50), 25)



########################## YOUR CODE ABOVE THIS LINE ############################## 
canvas.mainloop()
Ejemplo n.º 4
0
import matplotlib.pyplot as plt
from neupy import algorithms, utils, init

from helpers import plot_2d_grid, make_circle, make_elipse, make_square

plt.style.use('ggplot')
utils.reproducible()

if __name__ == '__main__':
    GRID_WIDTH = 4
    GRID_HEIGHT = 4

    datasets = [
        make_square(),
        make_circle(),
        make_elipse(corr=0.7),
    ]
    configurations = [{
        'weight_init': init.Uniform(0, 1),
        'title': 'Random uniform initialization',
    }, {
        'weight_init': 'sample_from_data',
        'title': 'Sampled from the data',
    }, {
        'weight_init': 'init_pca',
        'title': 'Initialize with PCA',
    }]

    plt.figure(figsize=(15, 15))
    plt.title("Compare weight initialization methods for SOFM")
Ejemplo n.º 5
0
from tkinter import Canvas, Tk
from helpers import make_circle

gui = Tk()
gui.title('Circle')
canvas = Canvas(gui, width=500, height=500, background='white')
canvas.pack()
########################## YOUR CODE BELOW THIS LINE ##############################

# Todo: make 4 cones using a series of while loops

make_circle(canvas, (100, 50), 25, color=None)

########################## YOUR CODE ABOVE THIS LINE ##############################
canvas.mainloop()
Ejemplo n.º 6
0
from tkinter import Canvas, Tk
from helpers import make_circle

gui = Tk()
gui.title('Circle')
canvas = Canvas(gui, width=500, height=500, background='#000022')
canvas.pack()
########################## YOUR CODE BELOW THIS LINE ##############################



# Challenge 1: 
#   How could I rewrite the following code using a while loop?

make_circle(canvas, (100, 50), 25)
make_circle(canvas, (100, 100), 25)
make_circle(canvas, (100, 150), 25)
make_circle(canvas, (100, 200), 25)
make_circle(canvas, (100, 250), 25)
make_circle(canvas, (100, 300), 25)



########################## YOUR CODE ABOVE THIS LINE ############################## 
canvas.mainloop()
Ejemplo n.º 7
0
if __name__ == '__main__':
    GRID_WIDTH = 10
    GRID_HEIGHT = 10

    configurations = [{
        'grid_type': 'hexagon',
        'use_hexagon_grid': True,
        'title': 'Using hexagon grid',
    }, {
        'grid_type': 'rect',
        'use_hexagon_grid': False,
        'title': 'Using regcangular grid',
    }]

    data = make_circle()

    red, blue = ('#E24A33', '#348ABD')
    n_columns = len(configurations)

    plt.figure(figsize=(12, 5))

    for index, conf in enumerate(configurations, start=1):
        sofm = algorithms.SOFM(
            n_inputs=2,
            features_grid=(GRID_HEIGHT, GRID_WIDTH),

            verbose=True,
            shuffle_data=True,
            grid_type=conf['grid_type'],