flexibot 0.0.0__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.
flexibot-0.0.0/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+ Copyright (c) 2026 Luke William Warren
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: flexibot
3
+ Version: 0.0.0
4
+ License-File: LICENSE
5
+ Dynamic: license-file
@@ -0,0 +1,39 @@
1
+ # Flexibot
2
+
3
+ This is an efficient Python library made for the intended use of reinforcement learning in robotics.
4
+
5
+ !!WARNING THIS LIBRARY IS NOT FOR THE USE OF LLMS or Agents (e.g. ChatGPT, Gemini)!!
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install flexibot
11
+ ```
12
+ ## Example of how Flexibot is used
13
+
14
+ ```python
15
+ import flexibot as fl
16
+
17
+ isizess = [(1, 10), (1, 5), (1, 4), (1, 8)]
18
+ wsizess = [(10, 5), (5, 4), (4, 8), (8, 2)] # Inner numbers match input columns!
19
+ bsizess = [(1, 5), (1, 4), (1, 8), (1, 2)]
20
+
21
+ model = fl.network(isizes=isizess, wsizes=wsizess, bsizes=bsizess)
22
+
23
+ model.ReLU(activate=True)
24
+
25
+ while True:
26
+ g = model.MatrixMultiplication(2)
27
+
28
+ l, err = model.MSE(10)
29
+
30
+ if l < 0.001:
31
+ print(f"Success final answer {g}")
32
+ break
33
+ else:
34
+ model.Optim(0.01)
35
+ ```
36
+
37
+ ## License
38
+
39
+ MIT License
File without changes
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,109 @@
1
+ import numpy as np
2
+ import random as rad
3
+
4
+ class network():
5
+ def __init__(self, isizes, wsizes, bsizes):
6
+
7
+ # ~ initiate inputs ~ #
8
+ self.i1 = np.random.uniform(-0.1, 0.1, size=isizes.__getitem__(0))
9
+ self.i2 = np.random.uniform(-0.1, 0.1, size=isizes.__getitem__(1))
10
+ self.i3 = np.random.uniform(-0.1, 0.1, size=isizes.__getitem__(2))
11
+ self.i4 = np.random.uniform(-0.1, 0.1, size=isizes.__getitem__(3))
12
+
13
+ # ~ initiate parameters ~ #
14
+ self.w1 = np.random.uniform(-0.1, 0.1, size=wsizes.__getitem__(0))
15
+ self.w2 = np.random.uniform(-0.1, 0.1, size=wsizes.__getitem__(1))
16
+ self.w3 = np.random.uniform(-0.1, 0.1, size=wsizes.__getitem__(2))
17
+ self.w4 = np.random.uniform(-0.1, 0.1, size=wsizes.__getitem__(3))
18
+
19
+ self.b1 = np.random.uniform(-0.1, 0.1, size=bsizes.__getitem__(0))
20
+ self.b2 = np.random.uniform(-0.1, 0.1, size=bsizes.__getitem__(1))
21
+ self.b3 = np.random.uniform(-0.1, 0.1, size=bsizes.__getitem__(2))
22
+ self.b4 = np.random.uniform(-0.1, 0.1, size=bsizes.__getitem__(3))
23
+
24
+ def ReLU(self, activate):
25
+ if activate == True:
26
+ self.enable = True
27
+ else:
28
+ self.enable = False
29
+
30
+ def MatrixMultiplication(self, inchange):
31
+ """
32
+ input: numpy array
33
+ """
34
+
35
+ self.p1 = self.i1 @ self.w1 + self.b1
36
+ if self.enable == True:
37
+ self.p1 = np.maximum(0, self.p1)
38
+ self.i2 += inchange ** 2 / rad.uniform(1, 2)
39
+ self.p1 = np.resize(self.p1, self.i2.shape)
40
+ self.i2 += self.p1
41
+ self.i2 = np.clip(self.i2, -1.0, 1.0)
42
+
43
+
44
+
45
+ self.p2 = self.i2 @ self.w2 + self.b2
46
+ if self.enable == True:
47
+ self.p2 = np.maximum(0, self.p2)
48
+ self.i3 += inchange ** 2 / rad.uniform(1, 2)
49
+ self.p2 = np.resize(self.p2, self.i3.shape)
50
+ self.i3 += self.p2
51
+ self.i3 = np.clip(self.i3, -1.0, 1.0)
52
+
53
+
54
+
55
+ self.p3 = self.i3 @ self.w3 + self.b3
56
+ if self.enable == True:
57
+ self.p3 = np.maximum(0, self.p3)
58
+ self.i4 += inchange ** 2 / rad.uniform(1, 2)
59
+ self.p3 = np.resize(self.p3, self.i4.shape)
60
+ self.i4 += self.p3
61
+ self.i4 = np.clip(self.i4, -1.0, 1.0)
62
+
63
+
64
+
65
+ self.p4 = self.i4 @ self.w4 + self.b4
66
+ if self.enable == True:
67
+ self.p4 = np.maximum(0, self.p4)
68
+ self.i1 += inchange ** 2 / rad.uniform(1, 2)
69
+ self.p4 = np.resize(self.p4, self.i1.shape)
70
+ self.i1 += self.p4
71
+ self.i1 = np.clip(self.i1, -1.0, 1.0)
72
+
73
+
74
+ return self.p1, self.p2, self.p3, self.p4, self.i1, self.i2, self.i3, self.i4
75
+ def Smoothen(self, _inchange_):
76
+ self.MatrixMultiplication(_inchange_)
77
+
78
+ return np.ravel(self.p4)
79
+ def MSE(self, ref):
80
+
81
+ self.error = self.p4 - ref
82
+
83
+ MSE = np.power(self.error, 2)
84
+
85
+
86
+ self.MSE_loss = np.mean(MSE)
87
+
88
+ return self.MSE_loss, self.error
89
+
90
+ def Optim(self, lr):
91
+ grad4 = self.i4.T @ self.error
92
+ grad3 = self.i3.T @ self.error
93
+ grad2 = self.i2.T @ self.error
94
+ grad1 = self.i1.T @ self.error
95
+
96
+ # 2. MAGIC FIX: Force the gradients to match the exact shape
97
+ # of their respective weights before subtracting!
98
+ self.w4 -= lr * np.resize(grad4, self.w4.shape)
99
+ self.w3 -= lr * np.resize(grad3, self.w3.shape)
100
+ self.w2 -= lr * np.resize(grad2, self.w2.shape)
101
+ self.w1 -= lr * np.resize(grad1, self.w1.shape)
102
+
103
+ # 3. Clean bias updates (using resize so they always match the bias shape!)
104
+ self.b4 -= lr * np.resize(np.mean(self.error), self.b4.shape)
105
+ self.b3 -= lr * np.mean(self.error) # If these are always flat, they are fine
106
+ self.b2 -= lr * np.mean(self.error)
107
+ self.b1 -= lr * np.mean(self.error)
108
+
109
+ return self.w1, self.w2, self.w3, self.w4, self.b1, self.b2, self.b3, self.b4
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: flexibot
3
+ Version: 0.0.0
4
+ License-File: LICENSE
5
+ Dynamic: license-file
@@ -0,0 +1,8 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/flexibot/__init__.py
5
+ src/flexibot.egg-info/PKG-INFO
6
+ src/flexibot.egg-info/SOURCES.txt
7
+ src/flexibot.egg-info/dependency_links.txt
8
+ src/flexibot.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ flexibot