MemAI 0.1.3__tar.gz → 1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MemAI
3
- Version: 0.1.3
3
+ Version: 1.0.0
4
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
5
  Author: Apan Dan
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: MemAI
3
- Version: 0.1.3
3
+ Version: 1.0.0
4
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
5
  Author: Apan Dan
6
6
  License-Expression: MIT
@@ -1,11 +1,13 @@
1
1
  # The Shaper
2
2
  import numpy as np
3
3
 
4
+ class DumbnessError(Exception):
5
+ pass
4
6
 
5
7
  class Model:
6
- def __init__(self, name_id, dataset, modulo=False):
8
+ def __init__(self, name_id : str, dataset : list, modulo=False):
7
9
  self.name_id = name_id
8
- self.dataset = dataset
10
+ self.dataset : list = dataset
9
11
  self.modulo = modulo
10
12
 
11
13
  def change_dataset(self, new_dataset):
@@ -35,6 +37,8 @@ Estimates the correct output by subtracting the loss from the stored output.
35
37
  Calculates the difference between the closest stored input and the given input. Subtracting this difference adjusts the estimated output for the new input."""
36
38
 
37
39
 
40
+
41
+
38
42
  distances = [
39
43
  sum((c - t) ** 2 for c, t in zip(row[0], input))
40
44
  for row in self.dataset
@@ -47,6 +51,33 @@ Calculates the difference between the closest stored input and the given input.
47
51
  else:
48
52
  return c_l[1] - c_l[2] - sum([a - b for a, b in zip(c_l[0],input)])
49
53
 
54
+
55
+
56
+
57
+
58
+ def train(self, input:list, target: int | float):
59
+ """
60
+ this function allows the model to learn by letting it try to predict a given input and then putting its try in the dataset.
61
+ """
62
+
63
+
64
+ distances = [
65
+ sum((c - t) ** 2 for c, t in zip(row[0], input))
66
+ for row in self.dataset
67
+ ]
68
+ try:
69
+ closest_index = distances.index(min(distances))
70
+ except ValueError or TypeError or Exception:
71
+ raise DumbnessError("The dataset is empty bro! Do you want the model to be as dumb as 'YOU' bro?")
72
+ c_l = self.dataset[closest_index]
73
+
74
+ if self.modulo:
75
+ result = (c_l[1] - c_l[2] - sum([a - b for a, b in zip(c_l[0],input)])) % self.modulo
76
+ self.dataset.append([input,result,result-target])
77
+ else:
78
+ result = c_l[1] - c_l[2] - sum([a - b for a, b in zip(c_l[0],input)])
79
+ self.dataset.append([input,result,result-target])
80
+
50
81
  def get_correct_outputs(self):
51
82
  """
52
83
  It tries to reverse engineer all the *Expected Outputs* in the datasets by substracting the random output genarated from the loss of it.
@@ -0,0 +1 @@
1
+ from .Memai import Model
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "MemAI"
7
- version = "0.1.3"
7
+ version = "1.0.0"
8
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
9
  readme = "README.md"
10
10
  authors = [
@@ -1 +0,0 @@
1
- from .shaper import Model
File without changes
File without changes
File without changes
File without changes