MemAI 0.1.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.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: MemAI
3
+ Version: 0.1.2
4
+ Summary: Memory based AI. It doesn't require any parameters and also doesn't require huge amount of data. just needs the sufficient
5
+ Author: Apan Dan
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: numpy
10
+
11
+ # Updates
12
+
13
+ - Added The display feature
14
+ - fixed a bug
15
+
16
+
17
+
18
+
19
+ ## How to Use
20
+
21
+ ### 1. Install
22
+
23
+ ```bash
24
+ pip install The-Shaper
25
+ ```
26
+
27
+ ### 2. Import
28
+
29
+ ```python
30
+ import shaper
31
+ ```
32
+
33
+ ### 3. Create a Dataset
34
+
35
+ Each dataset row contains `[input, output, loss]`. Inputs should be lists, even for a single value.
36
+
37
+ ```python
38
+ dataset = [
39
+ [[1], 3, -1],
40
+ [[2], 3, 0],
41
+ [[3], 5, 0]
42
+ ]
43
+ ```
44
+
45
+ ### 4. Create a Model
46
+
47
+ ```python
48
+ AI = shaper.Model("MyModel", dataset, None)
49
+ ```
50
+
51
+ The third argument is the modulo. Use `None` for no modulo.
52
+
53
+ ### 5. Make a Prediction
54
+
55
+ ```python
56
+ result = AI.think([2])
57
+ print(result)
58
+ ```
59
+
60
+ ### 6. Get Correct Outputs
61
+
62
+ ```python
63
+ print(AI.get_correct_outputs())
64
+ ```
65
+
66
+ This returns the reconstructed outputs using `output - loss`.
67
+
68
+ ### 7. Change the Dataset
69
+
70
+ ```python
71
+ AI.change_dataset([
72
+ [[4], 7, 0],
73
+ [[5], 8, 1]
74
+ ])
75
+ ```
76
+
77
+ ## Display the Dataset
78
+
79
+ Use `display()` to print your model's dataset in a neat table.
80
+
81
+ ```python
82
+ import shaper
83
+
84
+ dataset = [
85
+ [[1], 3, -1],
86
+ [[2], 3, 0],
87
+ [[3], 5, 0]
88
+ ]
89
+
90
+ AI = shaper.Model("MyModel", dataset, None)
91
+ AI.display()
92
+ ```
93
+
94
+ Example output:
95
+
96
+ ```text
97
+ ==================================================
98
+ THE SHAPER: MyModel
99
+ ==================================================
100
+ INPUT OUTPUT LOSS
101
+ --------------------------------------------------
102
+ [1] 3 -1
103
+ [2] 3 0
104
+ [3] 5 0
105
+ ==================================================
106
+ ```
107
+
108
+ Each row shows the input, stored output, and loss.
109
+
110
+ The model will use the updated dataset for future predictions.
@@ -0,0 +1,9 @@
1
+ README.md
2
+ pyproject.toml
3
+ MemAI.egg-info/PKG-INFO
4
+ MemAI.egg-info/SOURCES.txt
5
+ MemAI.egg-info/dependency_links.txt
6
+ MemAI.egg-info/requires.txt
7
+ MemAI.egg-info/top_level.txt
8
+ memai/Memai.py
9
+ memai/__init__.py
@@ -0,0 +1 @@
1
+ numpy
@@ -0,0 +1 @@
1
+ memai
memai-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: MemAI
3
+ Version: 0.1.2
4
+ Summary: Memory based AI. It doesn't require any parameters and also doesn't require huge amount of data. just needs the sufficient
5
+ Author: Apan Dan
6
+ License-Expression: MIT
7
+ Requires-Python: >=3.10
8
+ Description-Content-Type: text/markdown
9
+ Requires-Dist: numpy
10
+
11
+ # Updates
12
+
13
+ - Added The display feature
14
+ - fixed a bug
15
+
16
+
17
+
18
+
19
+ ## How to Use
20
+
21
+ ### 1. Install
22
+
23
+ ```bash
24
+ pip install The-Shaper
25
+ ```
26
+
27
+ ### 2. Import
28
+
29
+ ```python
30
+ import shaper
31
+ ```
32
+
33
+ ### 3. Create a Dataset
34
+
35
+ Each dataset row contains `[input, output, loss]`. Inputs should be lists, even for a single value.
36
+
37
+ ```python
38
+ dataset = [
39
+ [[1], 3, -1],
40
+ [[2], 3, 0],
41
+ [[3], 5, 0]
42
+ ]
43
+ ```
44
+
45
+ ### 4. Create a Model
46
+
47
+ ```python
48
+ AI = shaper.Model("MyModel", dataset, None)
49
+ ```
50
+
51
+ The third argument is the modulo. Use `None` for no modulo.
52
+
53
+ ### 5. Make a Prediction
54
+
55
+ ```python
56
+ result = AI.think([2])
57
+ print(result)
58
+ ```
59
+
60
+ ### 6. Get Correct Outputs
61
+
62
+ ```python
63
+ print(AI.get_correct_outputs())
64
+ ```
65
+
66
+ This returns the reconstructed outputs using `output - loss`.
67
+
68
+ ### 7. Change the Dataset
69
+
70
+ ```python
71
+ AI.change_dataset([
72
+ [[4], 7, 0],
73
+ [[5], 8, 1]
74
+ ])
75
+ ```
76
+
77
+ ## Display the Dataset
78
+
79
+ Use `display()` to print your model's dataset in a neat table.
80
+
81
+ ```python
82
+ import shaper
83
+
84
+ dataset = [
85
+ [[1], 3, -1],
86
+ [[2], 3, 0],
87
+ [[3], 5, 0]
88
+ ]
89
+
90
+ AI = shaper.Model("MyModel", dataset, None)
91
+ AI.display()
92
+ ```
93
+
94
+ Example output:
95
+
96
+ ```text
97
+ ==================================================
98
+ THE SHAPER: MyModel
99
+ ==================================================
100
+ INPUT OUTPUT LOSS
101
+ --------------------------------------------------
102
+ [1] 3 -1
103
+ [2] 3 0
104
+ [3] 5 0
105
+ ==================================================
106
+ ```
107
+
108
+ Each row shows the input, stored output, and loss.
109
+
110
+ The model will use the updated dataset for future predictions.
memai-0.1.2/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # Updates
2
+
3
+ - Added The display feature
4
+ - fixed a bug
5
+
6
+
7
+
8
+
9
+ ## How to Use
10
+
11
+ ### 1. Install
12
+
13
+ ```bash
14
+ pip install The-Shaper
15
+ ```
16
+
17
+ ### 2. Import
18
+
19
+ ```python
20
+ import shaper
21
+ ```
22
+
23
+ ### 3. Create a Dataset
24
+
25
+ Each dataset row contains `[input, output, loss]`. Inputs should be lists, even for a single value.
26
+
27
+ ```python
28
+ dataset = [
29
+ [[1], 3, -1],
30
+ [[2], 3, 0],
31
+ [[3], 5, 0]
32
+ ]
33
+ ```
34
+
35
+ ### 4. Create a Model
36
+
37
+ ```python
38
+ AI = shaper.Model("MyModel", dataset, None)
39
+ ```
40
+
41
+ The third argument is the modulo. Use `None` for no modulo.
42
+
43
+ ### 5. Make a Prediction
44
+
45
+ ```python
46
+ result = AI.think([2])
47
+ print(result)
48
+ ```
49
+
50
+ ### 6. Get Correct Outputs
51
+
52
+ ```python
53
+ print(AI.get_correct_outputs())
54
+ ```
55
+
56
+ This returns the reconstructed outputs using `output - loss`.
57
+
58
+ ### 7. Change the Dataset
59
+
60
+ ```python
61
+ AI.change_dataset([
62
+ [[4], 7, 0],
63
+ [[5], 8, 1]
64
+ ])
65
+ ```
66
+
67
+ ## Display the Dataset
68
+
69
+ Use `display()` to print your model's dataset in a neat table.
70
+
71
+ ```python
72
+ import shaper
73
+
74
+ dataset = [
75
+ [[1], 3, -1],
76
+ [[2], 3, 0],
77
+ [[3], 5, 0]
78
+ ]
79
+
80
+ AI = shaper.Model("MyModel", dataset, None)
81
+ AI.display()
82
+ ```
83
+
84
+ Example output:
85
+
86
+ ```text
87
+ ==================================================
88
+ THE SHAPER: MyModel
89
+ ==================================================
90
+ INPUT OUTPUT LOSS
91
+ --------------------------------------------------
92
+ [1] 3 -1
93
+ [2] 3 0
94
+ [3] 5 0
95
+ ==================================================
96
+ ```
97
+
98
+ Each row shows the input, stored output, and loss.
99
+
100
+ The model will use the updated dataset for future predictions.
@@ -0,0 +1,91 @@
1
+ # The Shaper
2
+ import numpy as np
3
+
4
+
5
+ class Model:
6
+ def __init__(self, name_id, dataset, modulo=False):
7
+ self.name_id = name_id
8
+ self.dataset = dataset
9
+ self.modulo = modulo
10
+
11
+ def change_dataset(self, new_dataset):
12
+ """
13
+ This function allows to change the dataset. As there are no parameters in ***The Shaper***, the dataset is
14
+ very important. And this makes changing it easier.
15
+ """
16
+ self.dataset = new_dataset
17
+
18
+ def think(self, input,):
19
+ """The **input** is the value to be calculated, the **output** is the stored result, and the **loss** is the correct output minus the stored output.
20
+
21
+ To predict an output, we find the closest input in the dataset and use its output and loss to estimate the correct result.
22
+
23
+ The formula is:
24
+
25
+ \[
26
+ OUT_{closest}-L_{closest}-(INP_{closest}-INP)
27
+ \]
28
+
29
+ **Logic:** \(OUT_{closest}-L_{closest}\)
30
+
31
+ Estimates the correct output by subtracting the loss from the stored output.
32
+
33
+ **Converter:** \(INP_{closest}-INP\)
34
+
35
+ Calculates the difference between the closest stored input and the given input. Subtracting this difference adjusts the estimated output for the new input."""
36
+
37
+
38
+ distances = [
39
+ sum((c - t) ** 2 for c, t in zip(row[0], input))
40
+ for row in self.dataset
41
+ ]
42
+ closest_index = distances.index(min(distances))
43
+ c_l = self.dataset[closest_index]
44
+
45
+ if self.modulo:
46
+ return (c_l[1] - c_l[2] - sum([a - b for a, b in zip(c_l[0],input)])) % self.modulo
47
+ else:
48
+ return c_l[1] - c_l[2] - sum([a - b for a, b in zip(c_l[0],input)])
49
+
50
+ def get_correct_outputs(self):
51
+ """
52
+ It tries to reverse engineer all the *Expected Outputs* in the datasets by substracting the random output genarated from the loss of it.
53
+ it is nothing but the logic part in the main **think** function. so the formula of this become :
54
+
55
+ ***OUT - L***
56
+
57
+ *From the* *SHAPER* ai
58
+ """
59
+ return (np.array([row[1] for row in self.dataset]) - np.array([row[2] for row in self.dataset])).tolist()
60
+ def display(self):
61
+ """Displays the dataset in a neat and clean manner."""
62
+
63
+ print(f"\n{'=' * 50}")
64
+ print(f" MODEL NAME : {self.name_id}")
65
+ print(f"{'=' * 50}")
66
+ print(f"{'INPUT':<20}{'OUTPUT':<15}{'LOSS':<10}")
67
+ print("-" * 50)
68
+
69
+ for row in self.dataset:
70
+ print(f"{str(row[0]):<20}{str(row[1]):<15}{str(row[2]):<10}")
71
+
72
+ print("=" * 50)
73
+
74
+ Easter_egg = """
75
+ If you are seeing this, this is an easter egg.
76
+
77
+ Here is how the idea came to me.
78
+
79
+ I was in my bed with a pen and a notebook beside me
80
+ thinking for something that I could invent. A new type
81
+ of AI. This is me writing at the age of 10 from India,
82
+ West Bengal if you are wondering. So I don't know how
83
+ but this idea came to me. And I quickly wrote it down.
84
+ Tested it on n+1 and xor. First I didnt know the name
85
+ so I gave it the name ***SIMPLE AI***. Then I named it
86
+ to the shaper.
87
+
88
+ Writen by,
89
+ Apan Dan
90
+ """
91
+
@@ -0,0 +1 @@
1
+ from .shaper import Model
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = [ "setuptools>=68" ]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "MemAI"
7
+ version = "0.1.2"
8
+ description = "Memory based AI. It doesn't require any parameters and also doesn't require huge amount of data. just needs the sufficient"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "Apan Dan" }
12
+ ]
13
+ requires-python = ">=3.10"
14
+ dependencies = [
15
+ "numpy"
16
+ ]
17
+
18
+ # Fixed: Formatted exactly as one of the allowed table definitions
19
+ license = "MIT"
20
+
21
+ [tool.setuptools]
22
+ packages = [ "memai" ]
memai-0.1.2/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+