Remove graphics

Stop loading files by default
This commit is contained in:
georgelacey 2017-03-08 16:52:50 +00:00
parent 9cc2c3a4e8
commit 8f2f1b0925
3 changed files with 3 additions and 1024 deletions

View File

@ -1,15 +0,0 @@
from graphics import *
class Graph(object):
def __init__(self, p_width, p_height, p_name):
self.win = GraphWin("perceptron", p_width, p_height)
self.win.setCoords(0, 0, 640, 480)
self.x_offset = p_width / 2
self.y_offset = p_height / 2
self.win.setCoords(0, 0, 640, 480)
Line(Point(0, p_height / 2), Point(p_width, p_height / 2)).draw(self.win)
Line(Point(p_width / 2, 0), Point(p_width / 2, p_height)).draw(self.win)
def drawLine(self, p_point1, p_point2):
Line(p_point1, p_point2).draw(self.win).move(self.x_offset, self.y_offset)

11
Main.py
View File

@ -1,17 +1,14 @@
from Perceptron import Perceptron
from random import Random
from Dataset import Dataset
from Graph import *
graph = Graph(640, 480, "Perceptron")
graph.drawLine(Point(-1000, -1000 + 20), Point(1000, 1000 + 20))
rand = Random()
data = Dataset(open("input.txt").read().split('\n'), open("target.txt").read().split('\n'))
#data = Dataset(open("input.txt").read().split('\n'),
# open("target.txt").read().split('\n'))
learn_rate = 0.01
p = Perceptron()
i = data.inputs
#i = data.inputs
def line_perceptron():
@ -40,10 +37,8 @@ def line_perceptron():
y = int(input("y: "))
p.input(x, y)
if p.activation() == 1:
graph.win.plot(x, y, "green")
print("TRUE")
else:
graph.win.plot(x, y, "red")
print("FALSE")

File diff suppressed because it is too large Load Diff