Skip to content
Snippets Groups Projects
Commit 1e8ab3ae authored by s183897's avatar s183897 :ice_skate:
Browse files

Cleaned up repository, incremented version number and added README-file

parent fae3d365
No related branches found
No related tags found
No related merge requests found
Showing
with 52 additions and 316 deletions
1000000 1000000 1000000
186 165 241
164 134 80
118 238 128
150 43 196
218 162 118
148 150 78
17 183 23
34 160 22
56 133 110
142 134 156
58 189 73
192 18 138
146 58 150
220 140 167
241 125 70
191 142 199
167 239 203
227 134 26
196 171 51
231 113 167
112 143 13
60 141 183
27 219 201
199 190 46
189 100 249
132 66 255
218 148 26
219 54 188
247 51 107
178 97 132
231 5 252
241 162 71
122 109 186
48 249 44
79 169 143
87 105 217
68 219 236
250 165 238
85 154 227
171 232 118
212 41 158
182 135 249
52 191 250
224 94 91
233 243 127
17 237 68
200 124 39
30 189 228
198 119 136
162 75 225
160 120 122
151 208 37
10 141 216
185 213 42
158 225 241
92 206 21
127 240 130
146 187 184
192 207 234
46 51 240
71 232 40
34 166 66
229 186 75
161 10 183
144 100 138
191 42 182
78 191 136
37 165 91
236 62 248
227 73 191
58 130 237
210 175 161
199 174 45
1 174 155
185 142 55
182 250 225
252 92 214
124 202 60
151 39 187
199 174 45
1 174 155
185 142 55
182 250 225
252 92 214
124 202 60
123 154 114
\ No newline at end of file
1000000 1000000 1000000
186 165 241
123 113 22
164 134 80
118 238 128
150 43 196
218 162 118
148 150 78
17 183 23
34 160 22
41 106 32
56 133 110
142 134 156
58 189 73
45 96 119
192 18 138
146 58 150
220 140 167
241 125 70
191 142 199
167 239 203
227 134 26
196 171 51
231 113 167
112 143 13
60 141 183
27 219 201
87 26 21
199 190 46
189 100 249
132 66 255
218 148 26
219 54 188
247 51 107
178 97 132
231 5 252
95 107 12
241 162 71
122 109 186
48 249 44
79 169 143
190 5 55
2 8 88
87 105 217
156 65 133
68 219 236
250 165 238
114 35 162
85 154 227
171 232 118
212 41 158
49 20 59
182 135 249
52 191 250
224 94 91
233 243 127
17 237 68
200 124 39
30 189 228
198 119 136
34 65 126
162 75 225
160 120 122
151 208 37
74 85 67
10 141 216
185 213 42
158 225 241
92 206 21
127 240 130
146 187 184
19 29 159
136 83 2
192 207 234
46 51 240
71 232 40
34 166 66
64 150 111
229 186 75
161 10 183
144 100 138
81 152 102
34 70 121
191 42 182
78 191 136
37 165 91
236 62 248
227 73 191
58 130 237
210 175 161
23 32 29
108 127 68
199 174 45
1 174 155
185 142 55
113 17 210
182 250 225
252 92 214
124 202 60
123 154 114
151 39 187
1000000 1000000 1000000
123 113 22
41 106 32
45 96 119
87 26 21
95 107 12
190 5 55
2 8 88
156 65 133
114 35 162
49 20 59
34 65 126
74 85 67
19 29 159
136 83 2
64 150 111
81 152 102
34 70 121
23 32 29
108 127 68
113 17 210
123 154 114
108 127 68
113 17 210
151 39 187
\ No newline at end of file
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 17 12:03:45 2019
@author: madsl
"""
from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
x = np.array([[0.916694553016232, 0.879860173448982, 0.799823725246787], [0.251044893589751, 0.873483597741251, 0.799020036424031], [0.462848690300581, 0.570089266302553, 0.963221106731452], [0.336997448954343, 0.657334680563338, 0.0171789134476452], [0.121086166021466, 0.130820525948952, 0.277826792025607], [0.64818993287732, 0.345999487135878, 0.760489988694125], [0.327718637630705, 0.941325191867006, 0.543913596656697], [0.621508539244741, 0.267934790137423, 0.552943486206798], [0.33562988105478, 0.238357195987091, 0.92325115784734], [0.904787263273107, 0.47550237736589, 0.321083923098015], [0.887495693968907, 0.521172743131916, 0.666699111497533], [0.809760732275199, 0.939246719545988, 0.619447059854184], [0.96334309515959, 0.715781701957867, 0.7167483209566], [0.292157918101503, 0.537154690195954, 0.294120879952536], [0.243359080627646, 0.621222624133338, 0.991719830724062], [0.282109470818913, 0.798695126176517, 0.2795964231394], [0.5099087154142, 0.085685256183095, 0.0813250582634212], [0.34839099324059, 0.659008323432175, 0.717688325188482], [0.578316524545624, 0.783928232007116, 0.102188830100146], [0.901955098332335, 0.691511793902777, 0.441573684419181], [0.508575025963998, 0.0172277393866976, 0.978457495142924], [0.729439273613732, 0.763488989931359, 0.637269107209062], [0.146213011579791, 0.544061425421207, 0.64239874029629], [0.721389284270231, 0.171547132053126, 0.49790269347574], [0.603125573862254, 0.597774348854729, 0.436249236751353], [0.371914772276304, 0.58161838994962, 0.710105866266908], [0.113970116379024, 0.117607382692026, 0.330556847947531], [0.419838871597587, 0.228498726165025, 0.802551483799235], [0.875401252278416, 0.253849786187848, 0.482724764048467], [0.970374641007221, 0.628231193564876, 0.0447240727947193]])
y = np.array([0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0])
fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_facecolor((1.0, 0.47, 0.42))
for n in range(len(x)):
if y[n] == 0:
ax.scatter(x[n,0], x[n,1], x[n,2], c="black")
elif y[n] == 1:
ax.scatter(x[n,0], x[n,1], x[n,2], c="white")
ax.set_xlabel('R', fontsize = 15)
ax.set_ylabel('B', fontsize = 15)
ax.set_zlabel('G', fontsize = 15)
pyplot.show()
\ No newline at end of file
This diff is collapsed.
|Text-Background Color Combination Chooser by C O D E B O I S |
-------------------------------------------------------------
Main files:
main (nearest neighbor).py
main (nearest centroid).py
--------------------------
- Creation of training data. Press on down arrow will save training data as .txt-files to be imported any time of choosing using up arrow.
- Continual learning - not suited for tests.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+
main (nc - prediction only).py
main (nn - prediction only).py
------------------------------
- Ideal for testning purposes, no continual learning.
- Import training data (Up-arrow)
- Save prediction data to .txt-file (down arrow)
- Correct predictions and ratio count won't display before down press.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
main (neural network - prediction only).py
main (logreg - prediction only).py
------------------------------------------
- For testning purposes, no continual learning.
- As of yet, no import function, training data baked into code.
- Save prediction data to .txt-file (down arrow)
- Correct predictions and ratio count won't display before down press.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
A press on tab-button will display 3D-plot of data - works in all above files.
- the training data is located in the "Training Data"-folder.
No preview for this file type
File moved
File moved
File moved
This diff is collapsed.
......@@ -36,7 +36,7 @@ downPic = pygame.image.load('down.png')
pygame.display.set_icon(iconPic)
# title of app
pygame.display.set_caption('Nearest Centroid Text Color Chooser 3 - Prediction')
pygame.display.set_caption('Nearest Centroid Text Color Chooser 3.1 - Prediction')
# set fonts
smallfont = pygame.font.SysFont('comicsansms', 25)
......@@ -164,6 +164,7 @@ while True:
text("Data Failed to Be Imported", (255,255,255), mediumfont, 10, 10)
pygame.display.update()
# if tab pressed plot data
if event.key == pygame.K_TAB:
fig = pyplot.figure()
ax = Axes3D(fig)
......
......@@ -36,7 +36,7 @@ iconPic = pygame.image.load('icon.png')
pygame.display.set_icon(iconPic)
# title of app
pygame.display.set_caption('Nearest Centroid Text Color Chooser 1.5')
pygame.display.set_caption('Nearest Centroid Text Color Chooser 1.6')
# set fonts
smallfont = pygame.font.SysFont('comicsansms', 25)
......@@ -154,6 +154,7 @@ while True:
text("Data Failed to Be Imported", (255,255,255), mediumfont, 10, 10)
pygame.display.update()
# if tab pressed, plot data
if event.key == pygame.K_TAB:
fig = pyplot.figure()
ax = Axes3D(fig)
......
start cmd /k python "main (nearest neighbor).py"
\ No newline at end of file
# -*- coding: utf-8 -*-
# Nearest Neighbor Text Color Chooser: Main
# for testing, please use prediction only version
import pygame
import os
import time
......@@ -36,7 +37,7 @@ iconPic = pygame.image.load('icon.png')
pygame.display.set_icon(iconPic)
# title of app
pygame.display.set_caption('Nearest Neighbor Text Color Chooser 1.5')
pygame.display.set_caption('Nearest Neighbor Text Color Chooser 1.6')
# set fonts
smallfont = pygame.font.SysFont('comicsansms', 25)
......
......@@ -36,7 +36,7 @@ downPic = pygame.image.load('down.png')
pygame.display.set_icon(iconPic)
# title of app
pygame.display.set_caption('Neural Network-powered Text Color Chooser v. 2 - Prediction - Training Data Sample Size: 384')
pygame.display.set_caption('Neural Network-powered Text Color Chooser v. 2.1 - Prediction - Training Data Sample Size: 384')
# set fonts
smallfont = pygame.font.SysFont('comicsansms', 25)
......@@ -105,7 +105,6 @@ while True:
clf.fit(X, Y)
# please deactivate prediction display to prevent placebo effect during experiment
if len(points) > 1:
if clf.predict(z.reshape(1,-1)) == 1:
display.blit(predPic, (width / 3 - 80 / 2, 200))
......@@ -153,6 +152,7 @@ while True:
text("Data Successfully Saved to File", (255,255,255), smallfont, 10, 10)
pygame.display.update()
# if tab pressed, plot data
if event.key == pygame.K_TAB:
x = np.asarray(X)
y = np.asarray(Y)
......
......@@ -36,7 +36,7 @@ downPic = pygame.image.load('down.png')
pygame.display.set_icon(iconPic)
# title of app
pygame.display.set_caption('Nearest Neighbor Text Color Chooser 2.5 - Prediction')
pygame.display.set_caption('Nearest Neighbor Text Color Chooser 2.6 - Prediction')
# set fonts
smallfont = pygame.font.SysFont('comicsansms', 25)
......@@ -165,6 +165,7 @@ while True:
text("Data Failed to Be Imported", (255,255,255), mediumfont, 10, 10)
pygame.display.update()
# if tab pressed, plot data
if event.key == pygame.K_TAB:
fig = pyplot.figure()
ax = Axes3D(fig)
......
import numpy as np
from sklearn.neighbors import NearestNeighbors
from sklearn.cluster import KMeans
from matplotlib import pyplot as plt
def nn(X,y):
neigh = NearestNeighbors(n_neighbors=1)
neigh.fit(X)
point = X[neigh.kneighbors(y)[1]]
point = np.squeeze(np.asarray(point))
return point
print(nn(np.array([
[1,6,2],
[6,1,3],
[8,-2,3],
[7,3,11]]), np.array([[8,-1,2]])))
#K-MEANS
def km(X):
kmeans = KMeans(n_clusters=1)
kmeans.fit(X)
c = kmeans.cluster_centers_
return c
print(km(np.array([
[1,6,2],
[6,1,3],
[8,-2,3],
[7,3,11]])))
a = np.array([
[1,6,2],
[6,1,3],
[8,-2,3],
[7,3,11]])
print(a[1:])
a = np.array([[1, 4],
[2, 5],
[3, 6]])
print(a.transpose(1,0))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment