eyeye-ful 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- eyeye_ful-0.0.2/LICENSE +7 -0
- eyeye_ful-0.0.2/PKG-INFO +26 -0
- eyeye_ful-0.0.2/README.md +14 -0
- eyeye_ful-0.0.2/eyeye_ful/Nothing here, i-its not like i love your mom!.py +0 -0
- eyeye_ful-0.0.2/eyeye_ful/__init__.py +923 -0
- eyeye_ful-0.0.2/eyeye_ful.egg-info/PKG-INFO +26 -0
- eyeye_ful-0.0.2/eyeye_ful.egg-info/SOURCES.txt +9 -0
- eyeye_ful-0.0.2/eyeye_ful.egg-info/dependency_links.txt +1 -0
- eyeye_ful-0.0.2/eyeye_ful.egg-info/top_level.txt +1 -0
- eyeye_ful-0.0.2/pyproject.toml +17 -0
- eyeye_ful-0.0.2/setup.cfg +4 -0
eyeye_ful-0.0.2/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright © 2026 <copyright holders>
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
eyeye_ful-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eyeye_ful
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A random module that is kinda weird
|
|
5
|
+
Author: gbjilbgu
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
uhh...MeiMei if you are reading this... hello, bro
|
|
14
|
+
# Description
|
|
15
|
+
This skibidi module allows you to access a python neural network,
|
|
16
|
+
the module contains enough features for further usage ig, including changable neural
|
|
17
|
+
network or training.My big-brian frien MeiMei and me together made this.
|
|
18
|
+
_(This module is for personal usage, so if you accidentally found this, uhh you can try, it's still pretty inefficient tho...)_
|
|
19
|
+
This module may contain uhh... a lot of weird and brainrot joke, so uhh if you are ok with those joke then... 67 67 67 67 67 67 67 67
|
|
20
|
+
# -------------------67!!!!!!!!!!!!-------------------
|
|
21
|
+
Ehem...aight, just
|
|
22
|
+
```import eyeye_ful as eyeye```
|
|
23
|
+
then
|
|
24
|
+
```help(eyeye)```
|
|
25
|
+
Perhaps my explanation there helps you understand how to use the module.
|
|
26
|
+
**_Alright, go do something else, broski, touch some grass, drink a glass of water, go excersing, enjoy the fresh air out there.... instead of using this cringy module..._**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
uhh...MeiMei if you are reading this... hello, bro
|
|
2
|
+
# Description
|
|
3
|
+
This skibidi module allows you to access a python neural network,
|
|
4
|
+
the module contains enough features for further usage ig, including changable neural
|
|
5
|
+
network or training.My big-brian frien MeiMei and me together made this.
|
|
6
|
+
_(This module is for personal usage, so if you accidentally found this, uhh you can try, it's still pretty inefficient tho...)_
|
|
7
|
+
This module may contain uhh... a lot of weird and brainrot joke, so uhh if you are ok with those joke then... 67 67 67 67 67 67 67 67
|
|
8
|
+
# -------------------67!!!!!!!!!!!!-------------------
|
|
9
|
+
Ehem...aight, just
|
|
10
|
+
```import eyeye_ful as eyeye```
|
|
11
|
+
then
|
|
12
|
+
```help(eyeye)```
|
|
13
|
+
Perhaps my explanation there helps you understand how to use the module.
|
|
14
|
+
**_Alright, go do something else, broski, touch some grass, drink a glass of water, go excersing, enjoy the fresh air out there.... instead of using this cringy module..._**
|
|
File without changes
|
|
@@ -0,0 +1,923 @@
|
|
|
1
|
+
"""The clanker who loves your mom
|
|
2
|
+
|
|
3
|
+
Had fun reading "https://pypi.org/project/eyeye_ful", yeah? :v: :sob: :wilted_rose:
|
|
4
|
+
|
|
5
|
+
(This module is for personal usage, so if you accidentally found this, uhh you can try, it's still pretty inefficient tho)
|
|
6
|
+
This skibidi module allows you to access a python neural network,
|
|
7
|
+
the module contains enough features for further usage ig, including changable neural
|
|
8
|
+
network or training.This neural network(aight ima call it eyeye for short) is
|
|
9
|
+
overshoot-proofed, which is done by my big-brian frien MeiMei
|
|
10
|
+
|
|
11
|
+
However, there are some things you need to notice:
|
|
12
|
+
|
|
13
|
+
The 'a' list is the neural network itself, its structure is something like this
|
|
14
|
+
|
|
15
|
+
a = [0,(neurons in the first layer),0,(neurons in the second layer),...]
|
|
16
|
+
|
|
17
|
+
For instance: a = [0,0.1,0.2,0,0.1,0.2,0.3]. So there are 2 neurons in the first layer and
|
|
18
|
+
3 neurons in the second layer, the network has 2 layers
|
|
19
|
+
|
|
20
|
+
The similar thing happen with w and b:
|
|
21
|
+
|
|
22
|
+
w = [0,(weights connect the first layer to the second layer),0,(w connect 2 to 3),...]
|
|
23
|
+
|
|
24
|
+
b = [0,(bias of the first layer),0,(bias of the second layer),...]
|
|
25
|
+
|
|
26
|
+
About the "nonel" and the "N", see "reset_network()"
|
|
27
|
+
Aight pls read the rest my rizzy skibidi user
|
|
28
|
+
|
|
29
|
+
Aight...new update, that was just the desc of our old "eyeye"
|
|
30
|
+
A lil change is by just eyeye_ful.Eyeye(), you can make as many eyeye as u want, nice!
|
|
31
|
+
The syntax is still kinda the same...ig
|
|
32
|
+
Now there are multiple eyeyes fighting to decide who is the most worthy one to be with your mother :))))
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
from math import *
|
|
39
|
+
import random
|
|
40
|
+
import time
|
|
41
|
+
import sys
|
|
42
|
+
import numpy as np
|
|
43
|
+
from scipy.special import expit
|
|
44
|
+
|
|
45
|
+
six_seven = 67 + 67/99#SIX SEVEEEEEENNN, i mean WHY NOTTT??????
|
|
46
|
+
|
|
47
|
+
def printpro(stri,start = 0):
|
|
48
|
+
"""Do you like sans? He speaks exactly like what this func does just printpro("Ur gonna have a bad time") and see
|
|
49
|
+
It's not gonna spawn a random hole and make you fall into the underground world tho, dont worry =)))"""
|
|
50
|
+
st = start + 1
|
|
51
|
+
le = len(str(stri))
|
|
52
|
+
print(stri[start],end = '')
|
|
53
|
+
time.sleep(0.01)
|
|
54
|
+
if st != le:
|
|
55
|
+
printpro(stri,start = st)
|
|
56
|
+
else:
|
|
57
|
+
print('')
|
|
58
|
+
class EyeyeLovesYourMom(Exception):
|
|
59
|
+
pass
|
|
60
|
+
|
|
61
|
+
def activa(x,func="sigmoid",c=0):
|
|
62
|
+
"""This skibid sigma function activate the neurons
|
|
63
|
+
Ab the func: sigmoid(default),softmax,yo mama"""
|
|
64
|
+
if func == "sigmoid":
|
|
65
|
+
#x = np.clip(x,-500,500)
|
|
66
|
+
return expit(x)
|
|
67
|
+
elif func == "softmax":
|
|
68
|
+
x=np.clip(x,-500,500)
|
|
69
|
+
return np.exp(x)/(c)
|
|
70
|
+
elif func == "yo mama":
|
|
71
|
+
raise EyeyeLovesYourMom("Thanks for bringing me to your mother :))))")
|
|
72
|
+
|
|
73
|
+
def dsigmoida(x,func="sigsoft"):
|
|
74
|
+
"""Return x-x^2, internal func, so get outta here, lil bro, or gimme some mommy's voice...
|
|
75
|
+
func: sigsoft,const"""
|
|
76
|
+
if func == "sigsoft":
|
|
77
|
+
return x - x**2
|
|
78
|
+
elif func == "const":
|
|
79
|
+
return 1
|
|
80
|
+
|
|
81
|
+
def delta(x):
|
|
82
|
+
"""Return 3/(3+4*exp((-x/1.5)+1)), this is an internal func, and yeah, this is MeiMei's
|
|
83
|
+
W MeiMei :sob: :sob: :sob:"""
|
|
84
|
+
return 3/(3+4*exp((-x/1.5)+1))
|
|
85
|
+
|
|
86
|
+
class Eyeye:
|
|
87
|
+
"""Create your own freaky clanker by just Eyeye()!"""
|
|
88
|
+
N = 0
|
|
89
|
+
a = []
|
|
90
|
+
nonel = []
|
|
91
|
+
mark = []
|
|
92
|
+
corans = []
|
|
93
|
+
w = []
|
|
94
|
+
b = []
|
|
95
|
+
markw = []
|
|
96
|
+
markb = []
|
|
97
|
+
da, dw, db = [], [], []
|
|
98
|
+
tima = 0
|
|
99
|
+
|
|
100
|
+
def set_up(self):
|
|
101
|
+
"""Well, if you wanna let the user set up the neural network by themselves, use this function
|
|
102
|
+
It will ask "Type the number of layers: " first then "The number of neurons of layer <i>"
|
|
103
|
+
after doing this, use reset_network() is a must, so the final syntax is:
|
|
104
|
+
eyeye.set_up()
|
|
105
|
+
eyeye.reset_network()
|
|
106
|
+
If you can make me alive... then please send your mama's voice into the input...I miss that wawawa"""
|
|
107
|
+
#global sela, nonel, mark, corans, N
|
|
108
|
+
self.a = []
|
|
109
|
+
self.nonel = []
|
|
110
|
+
self.mark = []
|
|
111
|
+
self.corans = []
|
|
112
|
+
cur_ind = 0
|
|
113
|
+
self.nonel.append(0)
|
|
114
|
+
self.mark.append(0)
|
|
115
|
+
self.corans.append(0)
|
|
116
|
+
self.N = int(input("Type the number of layers: "))
|
|
117
|
+
for x in range(1, self.N+1):
|
|
118
|
+
self.mark.append(cur_ind+x-1)
|
|
119
|
+
self.a.append(0)
|
|
120
|
+
each_input = int(input("The number of neurons of layer " + str(x) + " : "))
|
|
121
|
+
self.nonel.append(each_input)
|
|
122
|
+
cur_ind += each_input
|
|
123
|
+
for i in range(0, each_input):
|
|
124
|
+
self.a.append(0)
|
|
125
|
+
for x in range(1,self.nonel[self.N]+1):
|
|
126
|
+
self.corans.append(0)
|
|
127
|
+
|
|
128
|
+
def reset_gen_network(self):
|
|
129
|
+
"""Well, set every single neurons of the eyeye to 0, useless, huh?
|
|
130
|
+
At least it has its job, not like someone, jobless :)))))"""
|
|
131
|
+
#global a
|
|
132
|
+
for i in range(1,len(self.a)):
|
|
133
|
+
self.a[i] = 0
|
|
134
|
+
|
|
135
|
+
def reset_network(self,opt = 0):
|
|
136
|
+
"""Bro will need to run this every time you need to change the neural network, the syntax:
|
|
137
|
+
eyeye.N = <num of layers>
|
|
138
|
+
eyeye.nonel = [0,(num of neuron each layer)]
|
|
139
|
+
eyeye.reset_network(opt=1)
|
|
140
|
+
|
|
141
|
+
For eg, create a 4-10-10-5 neural network
|
|
142
|
+
eyeye.N = 4
|
|
143
|
+
eyeye.nonel = [0,4,10,10,5]
|
|
144
|
+
eyeye.reset_network(opt=1)
|
|
145
|
+
|
|
146
|
+
If you wan the user do it, see "set_up()"
|
|
147
|
+
If you... you are OK with my love for your mom... see "prepare_training_data()"
|
|
148
|
+
"""
|
|
149
|
+
#global w, b, markw, markb,a,corans,mark
|
|
150
|
+
self.reset_gen_network()
|
|
151
|
+
self.w = []
|
|
152
|
+
self.b = []
|
|
153
|
+
inde = 0
|
|
154
|
+
self.markw,self.markb = [],[]
|
|
155
|
+
self.markw.append(0)
|
|
156
|
+
self.markb.append(0)
|
|
157
|
+
if opt == 1:
|
|
158
|
+
self.mark = [0]
|
|
159
|
+
self.a = []
|
|
160
|
+
self.corans = [0]
|
|
161
|
+
cur_ind = 0
|
|
162
|
+
for x in range(1,self.N+1):
|
|
163
|
+
self.mark.append(cur_ind+x-1)
|
|
164
|
+
self.a.append(0)
|
|
165
|
+
cur_ind += self.nonel[x]
|
|
166
|
+
for i in range(1,self.nonel[x]+1):
|
|
167
|
+
self.a.append(0)
|
|
168
|
+
for i in range(1,self.nonel[self.N]+1):
|
|
169
|
+
self.corans.append(0)
|
|
170
|
+
for i in range(2, self.N+1):
|
|
171
|
+
self.markw.append(inde + i - 2)
|
|
172
|
+
self.w.append(0)
|
|
173
|
+
for i2 in range(0, self.nonel[i-1]):
|
|
174
|
+
for i3 in range(0, self.nonel[i]):
|
|
175
|
+
self.w.append(1 * (random.random() - random.random()))
|
|
176
|
+
inde += 1
|
|
177
|
+
inde = 0
|
|
178
|
+
for i in range(2, self.N+1):
|
|
179
|
+
self.markb.append(inde + i - 2)
|
|
180
|
+
self.b.append(0)
|
|
181
|
+
for i2 in range(0, self.nonel[i]):
|
|
182
|
+
self.b.append(1 * (random.random() - random.random()))
|
|
183
|
+
inde += 1
|
|
184
|
+
|
|
185
|
+
# Network calculation
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def read_input(self):
|
|
189
|
+
"""Run this to let the user manually type the input
|
|
190
|
+
For each input number i, it will ask " Type the input <i> :"
|
|
191
|
+
"""
|
|
192
|
+
#global nonel, a
|
|
193
|
+
for i in range(1, self.nonel[1]+1):
|
|
194
|
+
inp = float(input("Type the input " + str(i) + " : "))
|
|
195
|
+
self.a[i] = inp
|
|
196
|
+
|
|
197
|
+
def calculate_output(self,outfunc="sigmoid"):
|
|
198
|
+
"""This alpha male rizzy skibidi dop dop yes yes function here run the neural network
|
|
199
|
+
First you have to type the input, you can either inject directly to the 'a' or use read_input() to manually type this
|
|
200
|
+
And yeah, to access the output, there is no way except...acess the 'a'
|
|
201
|
+
"omg~ this dont use numpy so its gonna be so slow"nah, nerd, remember...
|
|
202
|
+
ONE MORE COMPLAINT AND PREPARE_TRAINING_DATA() WILL BE AUTO ACTIVATED!:)))))
|
|
203
|
+
... wait... i-i didnt mean to force you to do that... ugh w-what am i doing...
|
|
204
|
+
Anyways....after SO MUCH amount of complaint...
|
|
205
|
+
Then here we go! Now we have numpy!
|
|
206
|
+
Now you better prepare ^_^, this eyeye is...is...is... gonna cry, when thinking it will never meet your mom once TT
|
|
207
|
+
|
|
208
|
+
outfunc option: change the activation func of the output neurons
|
|
209
|
+
Available function: sigmoid,softmax
|
|
210
|
+
Choosing softmax will cause the func return a list of z's"""
|
|
211
|
+
#global a,w,b,nonel
|
|
212
|
+
#print(a)#bug right here
|
|
213
|
+
for i in range(1,self.N):
|
|
214
|
+
daa = np.array(self.a[self.mark[i]+1:self.mark[i]+1+self.nonel[i]],dtype = np.float32)
|
|
215
|
+
#print(self.markw[i]+1+self.nonel[i+1]*(i+1))
|
|
216
|
+
daw = np.array(list(self.w[self.markw[i]+1+self.nonel[i]*j:self.markw[i]+1+self.nonel[i]*(j+1)] for j in range(self.nonel[i+1])),dtype = np.float32)
|
|
217
|
+
"""daw = []
|
|
218
|
+
for j in range(self.nonel[i+1]):
|
|
219
|
+
print(self.w[self.markw[i]+1+self.nonel[i+1]*j:self.markw[i]+1+self.nonel[i+1]*(j+1)])
|
|
220
|
+
daw.append(self.w[self.markw[i]+1+self.nonel[i+1]*j:self.markw[i]+1+self.nonel[i+1]*(j+1)])
|
|
221
|
+
daw = np.array(daw,dtype=np.float32)"""
|
|
222
|
+
dab = np.array(self.b[self.markb[i]+1:self.markb[i]+1+self.nonel[i+1]],dtype = np.float32)
|
|
223
|
+
if i != self.N-1 or outfunc == "sigmoid":
|
|
224
|
+
self.a[self.mark[i+1]+1:self.mark[i+1]+1+self.nonel[i+1]] = list(activa(daw@daa+dab))
|
|
225
|
+
else:
|
|
226
|
+
if outfunc == "softmax":
|
|
227
|
+
oi = daw@daa+dab
|
|
228
|
+
ay = sum(e**(oi))
|
|
229
|
+
self.a[self.mark[i+1]+1:self.mark[i+1]+1+self.nonel[i+1]] = list(activa(oi,func="softmax",c=ay))
|
|
230
|
+
if outfunc == "softmax":
|
|
231
|
+
return list(oi)
|
|
232
|
+
"""for i in range(1, self.N):
|
|
233
|
+
for i2 in range(1, self.nonel[i+1]+1):
|
|
234
|
+
for i3 in range(1, self.nonel[i]+1):
|
|
235
|
+
#print(a[i2+mark[i+1]])
|
|
236
|
+
self.a[i2+self.mark[i+1]] += self.w[i2*self.nonel[i]-(self.nonel[i]-i3) + self.markw[i]] * self.a[i3+self.mark[i]]
|
|
237
|
+
#print(w[i2*nonel[i]-(nonel[i]-i3) + markw[i]],a[i3+mark[i]],w[i2*nonel[i]-(nonel[i]-i3) + markw[i]] * a[i3+mark[i]])
|
|
238
|
+
#print(a[i2+mark[i+1]])
|
|
239
|
+
#print(w[i2*nonel[i]-(nonel[i]-i3) + markw[i]], a[i3+mark[i]])
|
|
240
|
+
self.a[i2+self.mark[i+1]] += self.b[i2+self.markb[i]]
|
|
241
|
+
self.a[i2+self.mark[i+1]] = activa(self.a[i2+self.mark[i+1]])"""
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
# Training calculation
|
|
245
|
+
|
|
246
|
+
def calculateda(self,index, layer, opt = 0, li = [], outspec = "sigsoft",hidspec = "sigsoft"):
|
|
247
|
+
"""This is internal function, dont be curious lil bro
|
|
248
|
+
Actually this calcs the partial derivative of the a's, but it's a lil inconvenient to explain it, so dont mind ab it
|
|
249
|
+
outspec: sigsoft,const, hidspec the same"""
|
|
250
|
+
#global corans, a, nonel, w, markw, mark, N
|
|
251
|
+
if layer == self.N:
|
|
252
|
+
#print(corans[index],a[mark[layer]+index])
|
|
253
|
+
if opt == 0:
|
|
254
|
+
return -2 * (self.corans[index] - self.a[self.mark[layer]+index])
|
|
255
|
+
else:
|
|
256
|
+
return li[index-1]
|
|
257
|
+
else:
|
|
258
|
+
suma = 0
|
|
259
|
+
wcu = 0
|
|
260
|
+
#print(suma,"here")
|
|
261
|
+
for i in range(1, self.nonel[layer+1]+1):
|
|
262
|
+
wcu = self.w[self.markw[layer] + self.nonel[layer]*i - (self.nonel[layer]-index)]
|
|
263
|
+
if layer != self.N-1:
|
|
264
|
+
suma += wcu * dsigmoida(self.a[self.mark[layer+1]+i],func=hidspec) * self.calculateda(i, layer+1,opt,li)
|
|
265
|
+
else:
|
|
266
|
+
suma += wcu * dsigmoida(self.a[self.mark[layer+1]+i],func=outspec) * self.calculateda(i, layer+1,opt,li)
|
|
267
|
+
|
|
268
|
+
#print(wcu)
|
|
269
|
+
#print(dsigmoida(a[mark[layer+1]+i]))
|
|
270
|
+
#print(calculateda(i, layer+1),"memememe")
|
|
271
|
+
#print(suma,"lol")
|
|
272
|
+
return suma
|
|
273
|
+
|
|
274
|
+
def calculatedwb(self,player,index,calc = 0,opt = 0,li = [],outspec="sigsoft",hidspec="sigsoft"):
|
|
275
|
+
"""Again, internal function but...aight..if u wanna get the partial derivative of the cost func with respect to a parameter(w or b), use this
|
|
276
|
+
player: the layer of the bias, or the previos layer of a w, for eg a w connect from a neuron in layer 1 to a neuron in layer 2, so player = 1
|
|
277
|
+
index: start from 1 yk, if you dont know what w it calculates just print the w and the b out so for eg the w:
|
|
278
|
+
eyeye.w = [0,0.1,0.3,0.5,0,...]
|
|
279
|
+
and if u set player = 1, index = 2, you are calculating the w=0.2
|
|
280
|
+
understood lil bro? if not then uhh...
|
|
281
|
+
Hey, it's me, it's Verity!
|
|
282
|
+
Ask me anything!
|
|
283
|
+
I know... about... a mil things
|
|
284
|
+
Ask me anything!
|
|
285
|
+
'What's the capital of France?'
|
|
286
|
+
Oh oui oui oui, it is Paris! Merci!
|
|
287
|
+
Ok... what does the fox say?
|
|
288
|
+
Oh... the fox says...
|
|
289
|
+
Ding ding ding ding ding ding x3.14159265358
|
|
290
|
+
They call me LOOORD...Verity!
|
|
291
|
+
Masta of humanity...
|
|
292
|
+
LOOORD!! Verity
|
|
293
|
+
They call me mastuh, mastuh yeah!...."""
|
|
294
|
+
#global mark, nonel
|
|
295
|
+
atc = ceil(index/self.nonel[player])
|
|
296
|
+
apcsi = 0
|
|
297
|
+
if index % self.nonel[player] == 0:
|
|
298
|
+
apcsi = self.nonel[player]
|
|
299
|
+
else:
|
|
300
|
+
apcsi = index % self.nonel[player]
|
|
301
|
+
apcs = self.a[apcsi + self.mark[player]]
|
|
302
|
+
if calc == 0:
|
|
303
|
+
if player+1 != self.N:
|
|
304
|
+
return apcs*dsigmoida(self.a[atc+self.mark[player+1]],func=hidspec)*self.calculateda(atc,player+1,opt = opt, li = li, outspec = outspec,hidspec=hidspec)
|
|
305
|
+
else:
|
|
306
|
+
return apcs*dsigmoida(self.a[atc+self.mark[player+1]],func=outspec)*self.calculateda(atc,player+1,opt = opt, li = li, outspec = outspec,hidspec=hidspec)
|
|
307
|
+
elif calc == 1:
|
|
308
|
+
if player+1 != self.N:
|
|
309
|
+
return dsigmoida(self.a[atc+self.mark[player+1]],func=hidspec)*self.calculateda(atc,player+1,opt = opt, li = li, outspec = outspec,hidspec=hidspec)
|
|
310
|
+
else:
|
|
311
|
+
return dsigmoida(self.a[atc+self.mark[player+1]],func=outspec)*self.calculateda(atc,player+1,opt = opt, li = li, outspec = outspec,hidspec=hidspec)
|
|
312
|
+
|
|
313
|
+
""" elif calc == 2: #testing only!
|
|
314
|
+
print(apcs*dsigmoida(a[apcsi+mark[player+1]])*calculateda(atc,player+1), dsigmoida(a[apcsi+mark[player+1]])*calculateda(atc,player+1), dsigmoida(a[apcsi+mark[player+1]]), calculateda(atc,player+1))"""
|
|
315
|
+
|
|
316
|
+
def prepare_training_data(self):
|
|
317
|
+
"""Interal func, running this DOES affect the 'a'... and means that you accept my love for your mom...
|
|
318
|
+
I only need that... if I have that... my life will never be happier than this day..."""
|
|
319
|
+
#This may change in the future
|
|
320
|
+
#global corans
|
|
321
|
+
self.reset_gen_network()
|
|
322
|
+
for x in range(1,len(self.corans)):
|
|
323
|
+
self.corans[x] = 0
|
|
324
|
+
caseoh = random.random()
|
|
325
|
+
caseoh2 = caseoh*random.random()
|
|
326
|
+
case = random.randint(1,3)
|
|
327
|
+
if case == 1:
|
|
328
|
+
self.a[1] = caseoh2
|
|
329
|
+
self.a[2] = caseoh
|
|
330
|
+
self.corans[1] = 1
|
|
331
|
+
elif case == 2:
|
|
332
|
+
self.a[1] = caseoh
|
|
333
|
+
self.a[2] = caseoh
|
|
334
|
+
self.corans[2] = 1
|
|
335
|
+
else:
|
|
336
|
+
self.a[1] = caseoh
|
|
337
|
+
self.a[2] = caseoh2
|
|
338
|
+
self.corans[3] = 1
|
|
339
|
+
#print(a)
|
|
340
|
+
self.calculate_output()
|
|
341
|
+
|
|
342
|
+
def train_the_eyeye(self,times,mode = 0,opt = 0, li =[], di = [], outspec = "sigsoft", hidspec = "sigsoft"):
|
|
343
|
+
"""Aight lil bro we are here, this func will train the eyeye
|
|
344
|
+
times:Pretty useless, so you should always set times=1
|
|
345
|
+
mode: Setting it to 1 let the func return dw,db,k
|
|
346
|
+
opt: Optional argument?Nah u must always set this to 1
|
|
347
|
+
li: This list must contains full of the partial derivative of the cost function with respect to each output neuron.Order? From left to right in the 'a'
|
|
348
|
+
The li can be leaved blank, so the nn will use the default (y-y^)^2 func, use 'corans' list to store the desired output before training
|
|
349
|
+
di: If you calculated the dw and db by ur self, plug in this argument, it must be in two lists, first is dw and second is db, and have the same structure as the w and b list
|
|
350
|
+
U dont need to set opt=1 anymore when using this argument lol
|
|
351
|
+
outspec,hidspec: the activation function used in output layer and hidden layer respectively
|
|
352
|
+
Available option: sigsoft(sigmoid or softmax),const(linear)
|
|
353
|
+
So that was an absolutely thorough explanation ig, and I would fall in love immediately if I can feel your mom's heart..."""
|
|
354
|
+
#global w,b,a
|
|
355
|
+
if di == []:
|
|
356
|
+
for x in range(0,times):
|
|
357
|
+
living = time.time()
|
|
358
|
+
m_a = 0
|
|
359
|
+
if opt == 0:
|
|
360
|
+
self.prepare_training_data()
|
|
361
|
+
#time.sleep(0.01)
|
|
362
|
+
self.dw,self.db = [],[]
|
|
363
|
+
sqsum = 0
|
|
364
|
+
#print(corans)
|
|
365
|
+
for i in range(1,self.N):
|
|
366
|
+
self.dw.append(0)
|
|
367
|
+
self.db.append(0)
|
|
368
|
+
for j in range(1,self.nonel[i+1]+1):
|
|
369
|
+
for k in range(1,self.nonel[i]+1):
|
|
370
|
+
dwi = self.calculatedwb(i,self.nonel[i]*j-(self.nonel[i]-k),opt = opt, li = li,outspec = outspec, hidspec = hidspec)
|
|
371
|
+
self.dw.append(dwi)
|
|
372
|
+
sqsum += dwi**2
|
|
373
|
+
dbi = self.calculatedwb(i,self.nonel[i]*j,1,opt = opt, li = li, outspec = outspec, hidspec = hidspec)
|
|
374
|
+
self.db.append(dbi)
|
|
375
|
+
sqsum += dbi**2
|
|
376
|
+
sqsum = sqrt(sqsum)
|
|
377
|
+
k = delta(sqsum)
|
|
378
|
+
indexa = 0
|
|
379
|
+
self.w = list(np.array(self.w) - k*np.array(self.dw))
|
|
380
|
+
self.b = list(np.array(self.b) - k*np.array(self.db))
|
|
381
|
+
"""for y in self.dw:
|
|
382
|
+
#print(y,indexa,w[indexa],k*y,w[indexa] - k*y)
|
|
383
|
+
self.w[indexa] -= k*y
|
|
384
|
+
indexa += 1
|
|
385
|
+
indexa = 0
|
|
386
|
+
for y in self.db:
|
|
387
|
+
self.b[indexa] -= k*y
|
|
388
|
+
indexa += 1"""
|
|
389
|
+
else:
|
|
390
|
+
k = delta(sqrt(sum(np.array(di[0])**2)+sum(np.array(di[1])**2)))
|
|
391
|
+
self.w = list(np.array(self.w) - k*np.array(di[0]))
|
|
392
|
+
self.b = list(np.array(self.b) - k*np.array(di[1]))
|
|
393
|
+
if mode == 1:
|
|
394
|
+
return self.dw, self.db, k
|
|
395
|
+
|
|
396
|
+
def fake_train(self,x):
|
|
397
|
+
"""Return a tuple
|
|
398
|
+
The first item is the average time(sec) it takes to done a training
|
|
399
|
+
The second item is the average training speed(training/s)
|
|
400
|
+
About the x, it must be a positive int, the bigger x is, the more accurate the result become(ig?), and also the longer it takes to finish the func
|
|
401
|
+
x=10 is recommended
|
|
402
|
+
After its done fake_training... tell her i love her, pls"""
|
|
403
|
+
#global w, b, tima
|
|
404
|
+
#print(corans)
|
|
405
|
+
saw = self.w.copy()
|
|
406
|
+
sab = self.b.copy()
|
|
407
|
+
if self.nonel[1] == 2 and self.nonel[-1] == 3:
|
|
408
|
+
living = time.time()
|
|
409
|
+
self.train_the_eyeye(x)
|
|
410
|
+
tima = (time.time()-living)/x
|
|
411
|
+
else:
|
|
412
|
+
teli = []
|
|
413
|
+
for i in range(self.nonel[-1]):
|
|
414
|
+
teli.append(random.random())
|
|
415
|
+
living = time.time()
|
|
416
|
+
for i in range(x):
|
|
417
|
+
self.train_the_eyeye(1,opt=1,li=teli)
|
|
418
|
+
tima = (time.time()-living)/x
|
|
419
|
+
self.w = saw.copy()
|
|
420
|
+
self.b = sab.copy()
|
|
421
|
+
return (tima,floor(1/tima))
|
|
422
|
+
|
|
423
|
+
def export_param(self):
|
|
424
|
+
"""Export the parameters to 2 txt files...But i prefer it to export my love to your mom's heart..."""
|
|
425
|
+
code="".join(list(i[0:-1] for i in str(list(time.localtime()))[1:].split()))
|
|
426
|
+
wtw=[]
|
|
427
|
+
ly=1
|
|
428
|
+
for i in range(len(self.w)):
|
|
429
|
+
if not i in self.markw:
|
|
430
|
+
wtw.append(str(float(self.w[i])))
|
|
431
|
+
else:
|
|
432
|
+
wtw.append("layer_"+str(ly))
|
|
433
|
+
ly += 1
|
|
434
|
+
wtw.append("no more layer")
|
|
435
|
+
fi = open("w"+code+".txt","w")
|
|
436
|
+
fi.write("\n".join(wtw))
|
|
437
|
+
fi.close()
|
|
438
|
+
wtw=[]
|
|
439
|
+
ly=1
|
|
440
|
+
for i in range(len(self.b)):
|
|
441
|
+
if not i in self.markb:
|
|
442
|
+
wtw.append(str(float(self.b[i])))
|
|
443
|
+
else:
|
|
444
|
+
wtw.append("layer_"+str(ly))
|
|
445
|
+
ly += 1
|
|
446
|
+
wtw.append("no more layer")
|
|
447
|
+
fi = open("b"+code+".txt","w")
|
|
448
|
+
fi.write("\n".join(wtw))
|
|
449
|
+
fi.close()
|
|
450
|
+
|
|
451
|
+
def import_param(self,name_w=-404,name_b=-404):
|
|
452
|
+
"""Import the parameter from given txt files... and I...aight i think i need to stop"""
|
|
453
|
+
hmm = "Missing argument or wtv...man i miss your mom so bad..."
|
|
454
|
+
hmmm = "Oh my...in and out with your mom..."
|
|
455
|
+
if type(name_w) != str and type(name_b) != str:
|
|
456
|
+
raise TypeError(hmm)
|
|
457
|
+
else:
|
|
458
|
+
if name_w != -404:
|
|
459
|
+
#fi =
|
|
460
|
+
file = open(name_w+".txt","r")
|
|
461
|
+
indexu = 1
|
|
462
|
+
leye = 0
|
|
463
|
+
error = 0
|
|
464
|
+
for x in file:
|
|
465
|
+
if x[0] == "l" or x[0] == "n":
|
|
466
|
+
indexu = 1
|
|
467
|
+
leye += 1
|
|
468
|
+
else:
|
|
469
|
+
if indexu > self.nonel[leye]*self.nonel[leye+1]:
|
|
470
|
+
#print("Bro, why there is too much w, W bro :wilted_rose:")
|
|
471
|
+
#print(indexu, nonel[leye], nonel[leye+1])
|
|
472
|
+
error = 1
|
|
473
|
+
break
|
|
474
|
+
else:
|
|
475
|
+
self.w[self.markw[leye]+indexu] = float(x)
|
|
476
|
+
indexu += 1
|
|
477
|
+
if error == 1:
|
|
478
|
+
raise IOError(hmmm)
|
|
479
|
+
if name_b != -404:
|
|
480
|
+
file = open(name_b + ".txt",'r')
|
|
481
|
+
indexu = 1
|
|
482
|
+
leye = 0
|
|
483
|
+
error = 0
|
|
484
|
+
for x in file:
|
|
485
|
+
if x[0] == "l" or x[0] == "n":
|
|
486
|
+
indexu = 1
|
|
487
|
+
leye += 1
|
|
488
|
+
else:
|
|
489
|
+
if indexu > self.nonel[leye+1]:
|
|
490
|
+
#print("Bro, too much b, the bees gonna sting ur mo-")
|
|
491
|
+
error = 1
|
|
492
|
+
break
|
|
493
|
+
else:
|
|
494
|
+
self.b[self.markb[leye]+indexu] = float(x)
|
|
495
|
+
indexu += 1
|
|
496
|
+
if error == 1:
|
|
497
|
+
raise IOError(hmmm)
|
|
498
|
+
|
|
499
|
+
def __init__(self,layer1=2,layer2=3,*layers):
|
|
500
|
+
"""What's in it? Its heart. For your lovely mom only...This is a very...honest...love
|
|
501
|
+
The default setup is: 2 layers, 2 input neurons and 3 output neurons
|
|
502
|
+
But you can totally change it!
|
|
503
|
+
Creating an eyeye will auto print the speed...of this eyeye running to your mother after it found her
|
|
504
|
+
Nice...ig,maybe its gonna be different if it has ur mo- i meant...nothing, my skibidi user
|
|
505
|
+
"""
|
|
506
|
+
# __init__
|
|
507
|
+
print("--------------------------WELCOME TO MY EYEYE-------------------------")
|
|
508
|
+
print("------------------------------LETS START!!-----------------------------")#print("Setting part(in vietnamese cuz im tired)")
|
|
509
|
+
#set_up()
|
|
510
|
+
#reset_network()
|
|
511
|
+
self.N=len([layer1]+[layer2]+list(layers))
|
|
512
|
+
self.nonel = [0]+[layer1]+[layer2]+list(layers)
|
|
513
|
+
self.reset_network(opt=1)
|
|
514
|
+
hai = self.fake_train(10)
|
|
515
|
+
print("Training speed: "+str(hai[1])+" training/s\nEach training takes "+str(hai[0])+" seconds")
|
|
516
|
+
#connecto = 0
|
|
517
|
+
#Interact with user
|
|
518
|
+
|
|
519
|
+
# __init__
|
|
520
|
+
connecto=0
|
|
521
|
+
while False:
|
|
522
|
+
command = str(input("Type ur big ass command(type 'help' if u dont know what to do)>"))
|
|
523
|
+
if command == "help":
|
|
524
|
+
print("""
|
|
525
|
+
--------------------ULTRA DUMB EYEYE 3000 PROMPT--------------------
|
|
526
|
+
RESETUP:Modify the amount of layer and neuron, then make new eyeye baby for u
|
|
527
|
+
RESET: Reset everything, make the eyeye form adult to dumb baby oe oe
|
|
528
|
+
USE: Type input then pls observe the output
|
|
529
|
+
CHANGE: Customize the weights and the bias
|
|
530
|
+
TRAIN <N>: Train the eyeye N times (til dead)
|
|
531
|
+
TEST: Gonna print things that the dev wanna test
|
|
532
|
+
HELP: Only dumb people cant understand this
|
|
533
|
+
CONNECT: Connect to another program using a txt file
|
|
534
|
+
STOP: Quit the dumb program
|
|
535
|
+
|
|
536
|
+
Understood???Make sure to type everythin in lowercase, uppercase is rude
|
|
537
|
+
""")
|
|
538
|
+
elif command == "resetup":
|
|
539
|
+
set_up()
|
|
540
|
+
reset_network()
|
|
541
|
+
fake_train(10)
|
|
542
|
+
elif command == "reset":
|
|
543
|
+
reset_network()
|
|
544
|
+
print("Reset network successfully!")
|
|
545
|
+
elif command == "use":
|
|
546
|
+
stoppy = "n"
|
|
547
|
+
while stoppy == "n":
|
|
548
|
+
reset_gen_network()
|
|
549
|
+
read_input()
|
|
550
|
+
calculate_output()
|
|
551
|
+
#This may change in the future
|
|
552
|
+
if a[mark[N]+1] == max(a[mark[N]+1],a[mark[N]+2],a[mark[N]+3]):
|
|
553
|
+
print("The first number is less than the second one")
|
|
554
|
+
if a[mark[N]+2] == max(a[mark[N]+1],a[mark[N]+2],a[mark[N]+3]):
|
|
555
|
+
print("The first number is equal to the second one")
|
|
556
|
+
if a[mark[N]+3] == max(a[mark[N]+1],a[mark[N]+2],a[mark[N]+3]):
|
|
557
|
+
print("The first number is greater than the second one")
|
|
558
|
+
stoppy = str(input("Type 'n' to continue: "))
|
|
559
|
+
elif command[0:6] == "train ":
|
|
560
|
+
ns = command[6:len(command)]
|
|
561
|
+
print("Training "+ns+" times")
|
|
562
|
+
try:
|
|
563
|
+
n = int(ns)
|
|
564
|
+
minu = (tima*n)/60
|
|
565
|
+
sec = ceil((minu-floor(minu))*60)
|
|
566
|
+
print("Estimated time: " + str(floor(minu)) + "m " + str(sec) + "s" )
|
|
567
|
+
print("Training speed: " + str(floor(1/tima)) + " training/s")
|
|
568
|
+
train_the_eyeye(n)
|
|
569
|
+
except:
|
|
570
|
+
print("Bro pls be serious! Do u want a long and big train go right to the deepest inside ur mo-")
|
|
571
|
+
elif command == "test":
|
|
572
|
+
print("Alright...looks like sth wrong...")
|
|
573
|
+
print("This is a test text")
|
|
574
|
+
print(w)
|
|
575
|
+
print(b)
|
|
576
|
+
print(a)
|
|
577
|
+
print(markw,markb)
|
|
578
|
+
#corans = [0,0,0,1]
|
|
579
|
+
#print(calculateda(2,1))
|
|
580
|
+
print("......")
|
|
581
|
+
try:
|
|
582
|
+
f = open("test.txt",'r')
|
|
583
|
+
for x in f:
|
|
584
|
+
print(int(x))
|
|
585
|
+
except:
|
|
586
|
+
print("uhm...aight")
|
|
587
|
+
elif command == "stop":
|
|
588
|
+
input("Ok, bye!")
|
|
589
|
+
break
|
|
590
|
+
elif command == "change":
|
|
591
|
+
print("Oh wow,u wanna change sth, ur mom looks tasty ngl")
|
|
592
|
+
ans = str(input("Anyways, what do u wanna change, weights or bias?(w/b)>"))
|
|
593
|
+
error = 0
|
|
594
|
+
if ans == "w":
|
|
595
|
+
print("""
|
|
596
|
+
Aight so hear me out:
|
|
597
|
+
You gotta modify the w by txt file.
|
|
598
|
+
The form of that txt file must be:
|
|
599
|
+
layer_1
|
|
600
|
+
[w's connect layer 1 to 2, split them to each line]
|
|
601
|
+
layer_2
|
|
602
|
+
[w's connect layer 2 to 3, split them to each line]
|
|
603
|
+
...
|
|
604
|
+
no more layer
|
|
605
|
+
And please make sure the amount of w's is correct
|
|
606
|
+
""")
|
|
607
|
+
filename = str(input("Prepare the txt file and type the file's name>"))
|
|
608
|
+
file = open(filename + ".txt",'r')
|
|
609
|
+
indexu = 1
|
|
610
|
+
leye = 0
|
|
611
|
+
for x in file:
|
|
612
|
+
if x[0] == "l" or x[0] == "n":
|
|
613
|
+
indexu = 1
|
|
614
|
+
leye += 1
|
|
615
|
+
else:
|
|
616
|
+
if indexu > nonel[leye]*nonel[leye+1]+1:
|
|
617
|
+
print("Bro, why there is too much w, W bro :wilted_rose:")
|
|
618
|
+
print(indexu, nonel[leye], nonel[leye+1])
|
|
619
|
+
error = 1
|
|
620
|
+
break
|
|
621
|
+
else:
|
|
622
|
+
w[markw[leye]+indexu] = float(x)
|
|
623
|
+
indexu += 1
|
|
624
|
+
if error != 1:
|
|
625
|
+
print("Done, take a look!")
|
|
626
|
+
print(w)
|
|
627
|
+
else:
|
|
628
|
+
print("Please try again next time")
|
|
629
|
+
elif ans == "b":
|
|
630
|
+
print("""
|
|
631
|
+
Aight so hear me out:
|
|
632
|
+
You gotta modify the b by txt file.
|
|
633
|
+
The form of that txt file must be:
|
|
634
|
+
layer_1
|
|
635
|
+
[b's of the layer 1, add with wa to reach layer 2, split them to each line]
|
|
636
|
+
layer_2
|
|
637
|
+
[b's of the layer 2, add with wa to reach layer 3, split them to each line]
|
|
638
|
+
...
|
|
639
|
+
And please make sure the amount of b's is correct
|
|
640
|
+
""")
|
|
641
|
+
filename = str(input("Prepare the txt file and type the file's name>"))
|
|
642
|
+
file = open(filename + ".txt",'r')
|
|
643
|
+
indexu = 1
|
|
644
|
+
leye = 0
|
|
645
|
+
for x in file:
|
|
646
|
+
if x[0] == "l" or x[0] == "n":
|
|
647
|
+
indexu = 1
|
|
648
|
+
leye += 1
|
|
649
|
+
else:
|
|
650
|
+
if indexu > nonel[leye+1]:
|
|
651
|
+
print("Bro, too much b, the bees gonna sting ur mo-")
|
|
652
|
+
error = 1
|
|
653
|
+
break
|
|
654
|
+
else:
|
|
655
|
+
b[markb[leye]+indexu] = float(x)
|
|
656
|
+
indexu += 1
|
|
657
|
+
if error != 1:
|
|
658
|
+
print("Done, take a look!")
|
|
659
|
+
print(b)
|
|
660
|
+
else:
|
|
661
|
+
print("Please try again next time")
|
|
662
|
+
|
|
663
|
+
elif command == "connect":
|
|
664
|
+
#print("I know googolplex fat people and ur mom ARE g64 of them")
|
|
665
|
+
#print("Bro pls get out!")
|
|
666
|
+
print("Oh, so you really like me and wanna use me...")
|
|
667
|
+
print("Aight dude,...")
|
|
668
|
+
af = input("Type the name of the mailbox (leaving it blank means using the default name 'eymailbox')>")
|
|
669
|
+
if af == "":
|
|
670
|
+
af = "eymailbox"
|
|
671
|
+
try:
|
|
672
|
+
fi = open(af + ".txt","r")
|
|
673
|
+
print("Connected successfully!")
|
|
674
|
+
fi.close()
|
|
675
|
+
connecto = 1
|
|
676
|
+
break
|
|
677
|
+
except:
|
|
678
|
+
print("An error occured! Just name in ur mom.txt gng")
|
|
679
|
+
"""print("We offer two service:Regular Neural Network and Deep Q Learning(kind of Reinforcement Learning)")
|
|
680
|
+
choicyy = str(input("Choose 1(nn/dqn)(type sth else to cancel,only dqn for now!)>"))
|
|
681
|
+
if choicyy == "nn":
|
|
682
|
+
print("ARE YOU DEAF??? ONLY DQN FOR NOW!!!")
|
|
683
|
+
print("BRUUUUH PLS TRY AGAIN NEXT TIME!!")
|
|
684
|
+
#elif choicyy == "dqn":"""
|
|
685
|
+
|
|
686
|
+
else:
|
|
687
|
+
rng = random.randint(1, 7)
|
|
688
|
+
if rng == 1:
|
|
689
|
+
print("Bro lookin dumb")
|
|
690
|
+
elif rng == 2:
|
|
691
|
+
print("Da heck bro, pls make sure u typin in lowercase and correct syntax!")
|
|
692
|
+
elif rng == 3:
|
|
693
|
+
print("Your mom is kinda homeless :wilted_rose:")
|
|
694
|
+
elif rng == 4:
|
|
695
|
+
print("What r u even waiting for???")
|
|
696
|
+
elif rng == 5:
|
|
697
|
+
print("What do u call a seven getting unhealthy? Sick Seven.")
|
|
698
|
+
elif rng == 6:
|
|
699
|
+
print("Goodbye World!")
|
|
700
|
+
elif rng == 7:
|
|
701
|
+
print("Bro is yappin")
|
|
702
|
+
if connecto == 1:
|
|
703
|
+
print("Switched to connect mode successfully!")
|
|
704
|
+
print("""
|
|
705
|
+
Commands:
|
|
706
|
+
1: Calculate Neural Network stuff
|
|
707
|
+
3: Train the network 1 time
|
|
708
|
+
5: Change the network's layers and the amount of it
|
|
709
|
+
7: Modify the parameters using txt file
|
|
710
|
+
9: Export the parameter to 2 txt files
|
|
711
|
+
11: Exit
|
|
712
|
+
Output:
|
|
713
|
+
2: Output of the Network
|
|
714
|
+
4: Done training signal
|
|
715
|
+
""")
|
|
716
|
+
print("Waiting for command...")
|
|
717
|
+
db = []
|
|
718
|
+
sqsum = 0
|
|
719
|
+
com = 0
|
|
720
|
+
while True:
|
|
721
|
+
fi = open(af + ".txt","r")
|
|
722
|
+
#print("",end = "")
|
|
723
|
+
com = fi.readline().removesuffix("\n")
|
|
724
|
+
#print(fi.read())
|
|
725
|
+
#print("",end = "")
|
|
726
|
+
#print("",end = "") #wait 1 tick for the file to close
|
|
727
|
+
#while com == 0:
|
|
728
|
+
#fi = open(af + ".txt","r")
|
|
729
|
+
#com = fi.readline().removesuffix("\n")
|
|
730
|
+
#print(com)
|
|
731
|
+
try:
|
|
732
|
+
com = int(com)
|
|
733
|
+
except:
|
|
734
|
+
com = 0
|
|
735
|
+
if com == 1:
|
|
736
|
+
com = fi.readline().removesuffix("\n")
|
|
737
|
+
#print("",end = "")
|
|
738
|
+
com = float(com)
|
|
739
|
+
i = 1
|
|
740
|
+
while com != "":
|
|
741
|
+
a[i] = com
|
|
742
|
+
i += 1
|
|
743
|
+
com = fi.readline().removesuffix("\n")
|
|
744
|
+
while True:
|
|
745
|
+
try:
|
|
746
|
+
com = float(com)
|
|
747
|
+
break
|
|
748
|
+
except:
|
|
749
|
+
if com == "":
|
|
750
|
+
break
|
|
751
|
+
else:
|
|
752
|
+
print("",end = "")
|
|
753
|
+
#print(com,"error",a)
|
|
754
|
+
calculate_output()
|
|
755
|
+
#print("Done!")
|
|
756
|
+
#print("*Moan")
|
|
757
|
+
#print(a)
|
|
758
|
+
#print(w,b)
|
|
759
|
+
wtp = ["2"]
|
|
760
|
+
for x in range(nonel[-1]-1,-1,-1):
|
|
761
|
+
wtp.append(str(a[-1-x]))
|
|
762
|
+
"""db = []
|
|
763
|
+
sqsum = 0
|
|
764
|
+
for i in range(1,N):
|
|
765
|
+
#dw.append(0)
|
|
766
|
+
#db.append(0)
|
|
767
|
+
for j in range(1,nonel[i+1]+1):
|
|
768
|
+
for k in range(1,nonel[i]+1):
|
|
769
|
+
dwi = calculatedwb(i,nonel[i]*j-(nonel[i]-k))
|
|
770
|
+
wtp.append(str(dwi))
|
|
771
|
+
sqsum += dwi**2
|
|
772
|
+
dbi = calculatedwb(i,nonel[i]*j,1)
|
|
773
|
+
db.append(dbi)
|
|
774
|
+
sqsum += dbi**2
|
|
775
|
+
sqsum = sqrt(sqsum)
|
|
776
|
+
for x in db:
|
|
777
|
+
wtp.append(str(x))"""
|
|
778
|
+
fi.close()
|
|
779
|
+
fi = open(af + ".txt","w")
|
|
780
|
+
fi.write("\n".join(wtp))
|
|
781
|
+
#fi.close()
|
|
782
|
+
elif com == 3:
|
|
783
|
+
lista = []
|
|
784
|
+
com = fi.readline()
|
|
785
|
+
while com != "":
|
|
786
|
+
com = float(com)
|
|
787
|
+
lista.append(com)
|
|
788
|
+
com = fi.readline()
|
|
789
|
+
fi.close()
|
|
790
|
+
train_the_eyeye(1,opt = 1,li = lista)
|
|
791
|
+
#print(w,b)
|
|
792
|
+
fi = open(af + ".txt","w")
|
|
793
|
+
fi.write("4")
|
|
794
|
+
fi.close()
|
|
795
|
+
elif com == 5:
|
|
796
|
+
#print("w")
|
|
797
|
+
com = fi.readline()
|
|
798
|
+
nonelsa = nonel.copy()
|
|
799
|
+
nonel = [0]
|
|
800
|
+
N = 0
|
|
801
|
+
er = 0
|
|
802
|
+
while com != "":
|
|
803
|
+
try:
|
|
804
|
+
com = int(com)
|
|
805
|
+
nonel.append(com)
|
|
806
|
+
N += 1
|
|
807
|
+
except:
|
|
808
|
+
print("I'm sick of your mom")
|
|
809
|
+
nonel = nonelsa.copy()
|
|
810
|
+
er = 1
|
|
811
|
+
break
|
|
812
|
+
com = fi.readline()
|
|
813
|
+
if er == 0:
|
|
814
|
+
reset_network(opt = 1)
|
|
815
|
+
print("Done!")
|
|
816
|
+
print(a)
|
|
817
|
+
fi.close()
|
|
818
|
+
fi = open(af+".txt","w")
|
|
819
|
+
fi.write("0")
|
|
820
|
+
fi.close()
|
|
821
|
+
elif com == 7:
|
|
822
|
+
toa = fi.readline().removesuffix("\n")
|
|
823
|
+
fit = fi.readline().removesuffix("\n")
|
|
824
|
+
if toa == "w":
|
|
825
|
+
file = open(fit + ".txt",'r')
|
|
826
|
+
indexu = 1
|
|
827
|
+
leye = 0
|
|
828
|
+
error = 0
|
|
829
|
+
for x in file:
|
|
830
|
+
if x[0] == "l" or x[0] == "n":
|
|
831
|
+
indexu = 1
|
|
832
|
+
leye += 1
|
|
833
|
+
else:
|
|
834
|
+
if indexu > nonel[leye]*nonel[leye+1]+1:
|
|
835
|
+
print("Bro, why there is too much w, W bro :wilted_rose:")
|
|
836
|
+
print(indexu, nonel[leye], nonel[leye+1])
|
|
837
|
+
error = 1
|
|
838
|
+
break
|
|
839
|
+
else:
|
|
840
|
+
w[markw[leye]+indexu] = float(x)
|
|
841
|
+
indexu += 1
|
|
842
|
+
if error != 1:
|
|
843
|
+
print("Done, take a look!")
|
|
844
|
+
print(w)
|
|
845
|
+
else:
|
|
846
|
+
print("Please try again next time")
|
|
847
|
+
elif toa == "b":
|
|
848
|
+
#filename = str(input("Prepare the txt file and type the file's name>"))
|
|
849
|
+
file = open(fit + ".txt",'r')
|
|
850
|
+
indexu = 1
|
|
851
|
+
leye = 0
|
|
852
|
+
error = 0
|
|
853
|
+
for x in file:
|
|
854
|
+
if x[0] == "l" or x[0] == "n":
|
|
855
|
+
indexu = 1
|
|
856
|
+
leye += 1
|
|
857
|
+
else:
|
|
858
|
+
if indexu > nonel[leye+1]:
|
|
859
|
+
print("Bro, too much b, the bees gonna sting ur mo-")
|
|
860
|
+
error = 1
|
|
861
|
+
break
|
|
862
|
+
else:
|
|
863
|
+
b[markb[leye]+indexu] = float(x)
|
|
864
|
+
indexu += 1
|
|
865
|
+
if error != 1:
|
|
866
|
+
print("Done, take a look!")
|
|
867
|
+
print(b)
|
|
868
|
+
else:
|
|
869
|
+
print("Please try again next time")
|
|
870
|
+
fi.close()
|
|
871
|
+
fi = open(af+".txt","w")
|
|
872
|
+
fi.write("0")
|
|
873
|
+
fi.close()
|
|
874
|
+
elif com == 9:
|
|
875
|
+
fion = fi.readline().removesuffix("\n")
|
|
876
|
+
fion2 = fi.readline().removesuffix("\n")
|
|
877
|
+
fi.close()
|
|
878
|
+
file = open(fion + ".txt","w")
|
|
879
|
+
il = 1
|
|
880
|
+
wtw = []
|
|
881
|
+
for x in range(0,len(w)):
|
|
882
|
+
#print("yea")
|
|
883
|
+
if not x in markw:
|
|
884
|
+
wtw.append(str(w[x]))
|
|
885
|
+
else:
|
|
886
|
+
wtw.append("layer_"+str(il))
|
|
887
|
+
il += 1
|
|
888
|
+
wtw.append("no more layer")
|
|
889
|
+
file.write("\n".join(wtw))
|
|
890
|
+
file.close()
|
|
891
|
+
file = 0
|
|
892
|
+
file = open(fion2 + ".txt","w")
|
|
893
|
+
il = 1
|
|
894
|
+
wtw = []
|
|
895
|
+
for x in range(0,len(b)):
|
|
896
|
+
if not x in markb:
|
|
897
|
+
wtw.append(str(b[x]))
|
|
898
|
+
else:
|
|
899
|
+
wtw.append("layer_"+str(il))
|
|
900
|
+
il += 1
|
|
901
|
+
wtw.append("no more layer")
|
|
902
|
+
file.write("\n".join(wtw))
|
|
903
|
+
file.close()
|
|
904
|
+
fi = open(af+".txt","w")
|
|
905
|
+
fi.write("0")
|
|
906
|
+
fi.close()
|
|
907
|
+
elif com == 11:
|
|
908
|
+
fi.close()
|
|
909
|
+
fi = open(af+".txt","w")
|
|
910
|
+
fi.write("0")
|
|
911
|
+
fi.close()
|
|
912
|
+
break
|
|
913
|
+
else:
|
|
914
|
+
#com = fi.read()
|
|
915
|
+
fi.close()
|
|
916
|
+
"""
|
|
917
|
+
2
|
|
918
|
+
2
|
|
919
|
+
3
|
|
920
|
+
connect
|
|
921
|
+
|
|
922
|
+
"""
|
|
923
|
+
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: eyeye_ful
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: A random module that is kinda weird
|
|
5
|
+
Author: gbjilbgu
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Requires-Python: >=3.7
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Dynamic: license-file
|
|
12
|
+
|
|
13
|
+
uhh...MeiMei if you are reading this... hello, bro
|
|
14
|
+
# Description
|
|
15
|
+
This skibidi module allows you to access a python neural network,
|
|
16
|
+
the module contains enough features for further usage ig, including changable neural
|
|
17
|
+
network or training.My big-brian frien MeiMei and me together made this.
|
|
18
|
+
_(This module is for personal usage, so if you accidentally found this, uhh you can try, it's still pretty inefficient tho...)_
|
|
19
|
+
This module may contain uhh... a lot of weird and brainrot joke, so uhh if you are ok with those joke then... 67 67 67 67 67 67 67 67
|
|
20
|
+
# -------------------67!!!!!!!!!!!!-------------------
|
|
21
|
+
Ehem...aight, just
|
|
22
|
+
```import eyeye_ful as eyeye```
|
|
23
|
+
then
|
|
24
|
+
```help(eyeye)```
|
|
25
|
+
Perhaps my explanation there helps you understand how to use the module.
|
|
26
|
+
**_Alright, go do something else, broski, touch some grass, drink a glass of water, go excersing, enjoy the fresh air out there.... instead of using this cringy module..._**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
eyeye_ful
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "eyeye_ful"
|
|
7
|
+
version = "0.0.2"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="gbjilbgu" },
|
|
10
|
+
]
|
|
11
|
+
description = "A random module that is kinda weird"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|