DjPractLelo 0.1.2__tar.gz → 0.1.3__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.
Files changed (74) hide show
  1. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/10a_simple_genetic algorithm.py +48 -0
  2. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/1a_simple_nueral.py +34 -0
  3. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/1b_binary_bipolar.py +25 -0
  4. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/2a_macclouch_AND.py +24 -0
  5. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/2b_macclouch_OR.py +24 -0
  6. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/2c_macclouch_XOR.py +36 -0
  7. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/3a_hebb_rule.py +56 -0
  8. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/3b_delta_rule.py +63 -0
  9. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/4a_back-prop.py +31 -0
  10. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/4b_back-prop-error.py +34 -0
  11. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/6a_kohonen_self.py +38 -0
  12. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/9a_ratios_fuzzy.py +25 -0
  13. djpractlelo-0.1.3/DjPractLelo/resources/soft_computing/9b_tipping problem.py +31 -0
  14. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo.egg-info/PKG-INFO +1 -1
  15. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo.egg-info/SOURCES.txt +13 -0
  16. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/PKG-INFO +1 -1
  17. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/pyproject.toml +1 -1
  18. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/setup.py +1 -1
  19. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/__init__.py +0 -0
  20. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resource_loader.py +0 -0
  21. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/acyclic_graph.py +0 -0
  22. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/attributes.csv +0 -0
  23. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/audio-to-horus.py +0 -0
  24. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/average.csv +0 -0
  25. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/averaging.py +0 -0
  26. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/balance_sheet.csv +0 -0
  27. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/balance_sheet.py +0 -0
  28. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/billboard_content.py +0 -0
  29. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/binning.csv +0 -0
  30. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/cassandra.txt +0 -0
  31. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/clustering_warehouse.py +0 -0
  32. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/color_srgb.csv +0 -0
  33. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/csv-to-horus.py +0 -0
  34. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data-attribute.py +0 -0
  35. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data-binning.py +0 -0
  36. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data-pattern.csv +0 -0
  37. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data-pattern.py +0 -0
  38. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data-process.csv +0 -0
  39. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/data.csv +0 -0
  40. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/delivery_route.py +0 -0
  41. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/error_management.csv +0 -0
  42. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/error_management.py +0 -0
  43. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/fixer-uti.csv +0 -0
  44. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/fixer-utility.py +0 -0
  45. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/forex_planner.py +0 -0
  46. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/generate_data.py +0 -0
  47. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/generate_gml.csv +0 -0
  48. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/generate_gml.py +0 -0
  49. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/json-to-horus.py +0 -0
  50. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/logging.py +0 -0
  51. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/mysql-to-horus.py +0 -0
  52. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/network_routing.py +0 -0
  53. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/organize_data.py +0 -0
  54. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/organizing_data.csv +0 -0
  55. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/outlier-detect.py +0 -0
  56. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/outlier.csv +0 -0
  57. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/packing_option.py +0 -0
  58. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/payroll_generation.py +0 -0
  59. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/picture-to-horus.py +0 -0
  60. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/power-bi.txt +0 -0
  61. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/practical_manual.docx +0 -0
  62. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/shipping_route.py +0 -0
  63. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/time_data_vault.py +0 -0
  64. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/transform_data.csv +0 -0
  65. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/transform_data.py +0 -0
  66. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/video-to-horus.py +0 -0
  67. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/warehouse_location.py +0 -0
  68. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/data_science/xml-to-horus.py +0 -0
  69. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo/resources/soft_computing/practical_manual.docx +0 -0
  70. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo.egg-info/dependency_links.txt +0 -0
  71. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/DjPractLelo.egg-info/top_level.txt +0 -0
  72. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/LICENCE +0 -0
  73. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/README.md +0 -0
  74. {djpractlelo-0.1.2 → djpractlelo-0.1.3}/setup.cfg +0 -0
@@ -0,0 +1,48 @@
1
+ import numpy as np
2
+ import random
3
+
4
+ def activate_function(x):
5
+ return 1 / (1 + np.exp(-x))
6
+
7
+
8
+ n = int(input("Enter Number of inputs you want:"))
9
+
10
+ # Initial weights (only once)
11
+ weights = np.random.randn(n)
12
+
13
+ bias = np.random.uniform(0.1, 0.9)
14
+
15
+ # User inputs
16
+ inputs = []
17
+ for i in range(n):
18
+ inputs.append(float(input("Enter your input: ")))
19
+
20
+ inputs = np.array(inputs)
21
+
22
+ print("\nInitial Weights (First Generation):")
23
+ print(weights)
24
+
25
+ # Crossover (self crossover using split)
26
+ crossover_point = random.randint(1, n-1)
27
+ child_weights = np.concatenate((weights[:crossover_point], weights[crossover_point:]))
28
+
29
+ print("\nAfter Crossover:")
30
+ print(child_weights)
31
+
32
+ # Mutation (change one weight)
33
+ mutation_index = random.randint(0, n-1)
34
+ old_weight = child_weights[mutation_index]
35
+ child_weights[mutation_index] += np.random.randn()
36
+
37
+ print("\nAfter Mutation:")
38
+ print(f"Weight {mutation_index} changed from {old_weight} to {child_weights[mutation_index]}")
39
+
40
+ # Neuron output using evolved weights
41
+ z = 0
42
+ for i in range(n):
43
+ z += inputs[i] * child_weights[i]
44
+
45
+ z += bias
46
+
47
+ print("\nFinal Output:")
48
+ print(activate_function(z))
@@ -0,0 +1,34 @@
1
+ import numpy as np
2
+ import random
3
+
4
+ def activate_function(x):
5
+ return 1 / (1 + np.exp(-x))
6
+
7
+
8
+ n=int(input("Enter Number of inputs you want:"))
9
+
10
+ weights = np.random.randn(n)
11
+
12
+ bias = np.random.uniform(low=0.1, high=0.9)
13
+
14
+ #User input
15
+ inputs = []
16
+ for i in range(number):
17
+ val = float(input(f"Enter your input: "))
18
+ inputs.append(val)
19
+
20
+ z=0
21
+ for i in range(n):
22
+ z += (inputs[i] * weights[i])
23
+
24
+ z = z + bias
25
+
26
+ # Apply activation function
27
+ print(activate_function(z))
28
+
29
+
30
+
31
+
32
+
33
+
34
+
@@ -0,0 +1,25 @@
1
+ import math
2
+ import numpy as np
3
+
4
+ n=int(input("Enter Number of inputs you want:"))
5
+
6
+ weights = np.random.randn(n)
7
+
8
+ bias = np.random.uniform(low=0.1, high=0.9)
9
+
10
+ inputs = []
11
+ for i in range(n):
12
+ val = float(input(f"Enter your input: "))
13
+ inputs.append(val)
14
+
15
+ z=0
16
+ for i in range(n):
17
+ z += (inputs[i] * weights[i])
18
+
19
+ z = z + bias
20
+
21
+ binary_sigmoidal = 1 / (1 + np.exp(-z))
22
+ bipolar_sigmoidal = 2 / (1 + np.exp(-z)) - 1
23
+
24
+ print("Binary Sigmoidal = ", round(binary_sigmoidal, 3))
25
+ print("Bipolar Sigmoidal = ", round(bipolar_sigmoidal, 3))
@@ -0,0 +1,24 @@
1
+ #Mcclouch AND
2
+
3
+ x1inputs = [0, 0, 1, 1]
4
+ x2inputs = [0, 1, 0, 1]
5
+
6
+ # Weights (excitatory)
7
+ w1 = 1
8
+ w2 = 1
9
+
10
+ # Threshold(must be sum of weights to fire only when both inputs are 1)
11
+ threshold = w1+w2
12
+
13
+ print("x1 x2 sum Y")
14
+ for x1, x2 in zip(x1inputs, x2inputs):
15
+
16
+ addittion = x1 * w1 + x2 * w2
17
+
18
+ # Apply threshold
19
+ if addittion >= threshold:
20
+ Y = 1
21
+ else:
22
+ Y = 0
23
+
24
+ print(f"{x1} {x2} {addittion} {Y}")
@@ -0,0 +1,24 @@
1
+ # McCulloch-Pitts OR
2
+
3
+ x1inputs = [0, 0, 1, 1]
4
+ x2inputs = [0, 1, 0, 1]
5
+
6
+ # Weights (excitatory)
7
+ w1 = 1
8
+ w2 = 1
9
+
10
+ # Threshold (must be 1 to fire when at least one input is 1)
11
+ threshold = 1 # minimum excitatory input to fire
12
+
13
+ print("x1 x2 sum Y")
14
+ for x1, x2 in zip(x1inputs, x2inputs):
15
+
16
+ addition = x1 * w1 + x2 * w2
17
+
18
+ # Apply threshold
19
+ if addition >= threshold:
20
+ Y = 1
21
+ else:
22
+ Y = 0
23
+
24
+ print(f"{x1} {x2} {addition} {Y}")
@@ -0,0 +1,36 @@
1
+ '''XOR= '''
2
+ ''' 0 if inputs are same,else 1'''
3
+
4
+ x1inputs = [0, 0, 1, 1]
5
+ x2inputs = [0, 1, 0, 1]
6
+
7
+ print("x1 x2 Y")
8
+
9
+ for x1, x2 in zip(x1inputs, x2inputs):
10
+
11
+ # First layer neurons
12
+ # Neuron1 = x1 AND NOT x2
13
+ neuron1_sum = x1 * 1 + x2 * -1
14
+ neuron1_threshold = 1
15
+ if neuron1_sum >= neuron1_threshold:
16
+ neuron1 = 1
17
+ else:
18
+ neuron1 = 0
19
+
20
+ # Neuron2 = NOT x1 AND x2
21
+ neuron2_sum = x1 * -1 + x2 * 1
22
+ neuron2_threshold = 1
23
+ if neuron2_sum >= neuron2_threshold:
24
+ neuron2 = 1
25
+ else:
26
+ neuron2 = 0
27
+
28
+ # Output neuron = Neuron1 OR Neuron2
29
+ output_sum = neuron1 * 1 + neuron2 * 1
30
+ output_threshold = 1
31
+ if output_sum >= output_threshold:
32
+ Y = 1
33
+ else:
34
+ Y = 0
35
+
36
+ print(f"{x1} {x2} {Y}")
@@ -0,0 +1,56 @@
1
+ import numpy as np
2
+
3
+ # Sigmoid activation function
4
+ def activate_function(x):
5
+ return 1 / (1 + np.exp(-x))
6
+
7
+ # Learning rate for Hebbian learning
8
+ learning_rate = 0.1
9
+
10
+ n = int(input("Enter number of inputs you want: "))
11
+
12
+ weights = np.random.randn(n)
13
+ bias = np.random.randn()
14
+
15
+ print("\nInitial weights:", weights)
16
+ print("Bias:", bias, "\n")
17
+
18
+ inputs = []
19
+ for i in range(n):
20
+ val = float(input(f"Enter input {i+1}: "))
21
+ inputs.append(val)
22
+
23
+ inputs = np.array(inputs)
24
+
25
+ y=0
26
+ for i in range(n):
27
+ y += (inputs[i] * weights[i])
28
+
29
+ y = y + bias
30
+ print("\nWeighted sum (z) before Hebbian update:", y)
31
+
32
+ output = activate_function(y)
33
+ print("Output before Hebbian update:", round(output, 3))
34
+
35
+
36
+
37
+
38
+ #Hebbian Learning Rule
39
+ target = round(output)
40
+
41
+ # Update weights according to Hebb's rule
42
+ weights += learning_rate * inputs
43
+ bias += learning_rate
44
+
45
+ print("\nWeights after Hebbian learning:", weights)
46
+ print("Bias after Hebbian learning:", bias)
47
+
48
+ #Compute new sum and output after learning
49
+ for i in range(n):
50
+ y += (inputs[i] * weights[i])
51
+
52
+ y= y + bias
53
+ output_new = activate_function(y)
54
+
55
+ print("\nSum after Hebbian update:",y)
56
+ print("Output after Hebbian update:",output)
@@ -0,0 +1,63 @@
1
+ import numpy as np
2
+
3
+ # Sigmoid activation function
4
+ def activate_function(x):
5
+ return 1 / (1 + np.exp(-x))
6
+
7
+ # Learning rate
8
+ learning_rate = 0.1
9
+
10
+ n = int(input("Enter number of inputs you want: "))
11
+
12
+ weights = np.random.randn(n)
13
+ bias = np.random.randn()
14
+
15
+ print("\nInitial weights:", weights)
16
+ print("Bias:", bias, "\n")
17
+
18
+ inputs = []
19
+ for i in range(n):
20
+ val = float(input(f"Enter input {i+1}: "))
21
+ inputs.append(val)
22
+
23
+ inputs = np.array(inputs)
24
+
25
+ y = 0
26
+ for i in range(n):
27
+ y += (inputs[i] * weights[i])
28
+
29
+ y = y + bias
30
+ print("\nWeighted sum (z) before learning:", y)
31
+
32
+ output = activate_function(y)
33
+ print("Output before learning:",output)
34
+
35
+
36
+
37
+
38
+
39
+
40
+ # -------- Delta Rule --------
41
+ target = float(input("Enter target output (0 or 1): "))
42
+
43
+ error = target - output
44
+ print(error)
45
+
46
+
47
+ # Update weights and bias using Delta rule
48
+ weights += learning_rate * inputs*error
49
+ bias += learning_rate
50
+
51
+ print("\nWeights after Delta learning:", weights)
52
+ print("Bias after Delta learning:", bias)
53
+
54
+ #New sum and output after learning
55
+ y = 0
56
+ for i in range(n):
57
+ y += (inputs[i] * weights[i])
58
+
59
+ y = y + bias
60
+ output = activate_function(y)
61
+
62
+ print("\nSum after Delta update:", y)
63
+ print("Output after Delta update:", output)
@@ -0,0 +1,31 @@
1
+ import numpy as np
2
+
3
+ # Activation function and derivative
4
+ sig = lambda x: 1/(1+np.exp(-x))
5
+ dsig = lambda x: x*(1-x)
6
+
7
+ # Number of inputs
8
+ n = int(input("Enter number of inputs: "))
9
+
10
+ # Initialize weights and bias
11
+ weights = np.random.randn(n)
12
+ bias = np.random.rand()
13
+
14
+ # User input
15
+ inputs = np.array([float(input(f"Enter input {i+1}: ")) for i in range(n)])
16
+ target = float(input("Enter target output: "))
17
+
18
+ # Training
19
+ lr = 0.1
20
+ for _ in range(1000):
21
+ out = sig(np.dot(inputs, weights) + bias)
22
+ error = target - out
23
+ delta = error * dsig(out)
24
+ weights += lr * delta * inputs
25
+ bias += lr * delta
26
+
27
+ # Output
28
+ out = sig(np.dot(inputs, weights) + bias)
29
+ print("Trained output:", out)
30
+ print("Trained weights:", weights)
31
+ print("Trained bias:", bias)
@@ -0,0 +1,34 @@
1
+ import numpy as np
2
+
3
+ # Sigmoid and derivative
4
+ sig = lambda x: 1/(1+np.exp(-x))
5
+ dsig = lambda x: x*(1-x)
6
+
7
+ # Number of inputs
8
+ n = int(input("Enter number of inputs: "))
9
+
10
+ # User inputs
11
+ inputs = np.array([float(input(f"Enter input {i+1}: ")) for i in range(n)])
12
+ target = float(input("Enter target output: "))
13
+
14
+ # Initialize weights and bias
15
+ weights = np.random.randn(n)
16
+ bias = np.random.rand()
17
+
18
+ # Learning rate and epochs
19
+ lr = 0.1
20
+ epochs = 1000
21
+
22
+ # Training loop (backpropagation)
23
+ for _ in range(epochs):
24
+ out = sig(np.dot(inputs, weights) + bias) # Forward pass
25
+ error = target - out
26
+ delta = error * dsig(out)
27
+ weights += lr * delta * inputs # Update weights
28
+ bias += lr * delta # Update bias
29
+
30
+ # Final output
31
+ out = sig(np.dot(inputs, weights) + bias)
32
+ print("Trained output:", out)
33
+ print("Trained weights:", weights)
34
+ print("Trained bias:", bias)
@@ -0,0 +1,38 @@
1
+ import random
2
+ cities = [
3
+ [0, 0], # Kudal
4
+ [-25, 0], # Malvan
5
+ [0, -18], # Sawantwadi
6
+ [0, 35], # Kanakavali
7
+ [0, 65], # Vaibhavwadi
8
+ [-35, 65], # Devgad
9
+ [-20, -18] # Vengurle
10
+ ]
11
+
12
+ city_names = ["Kudal", "Malvan", "Sawantwadi", "Kanakavali", "Vaibhavwadi", "Devgad", "Vengurle"]
13
+
14
+ neurons = 3 # number of clusters.
15
+ learning_rate = 0.3
16
+ epochs = 50
17
+
18
+ # Initialize neuron positions randomly
19
+ weights = [[random.uniform(-50, 70), random.uniform(-20, 70)] for _ in range(neurons)]
20
+
21
+ #Training
22
+ for _ in range(epochs):
23
+ for city in cities:
24
+ winner = min(range(neurons), key=lambda i: (city[0]-weights[i][0])**2 + (city[1]-weights[i][1])**2)
25
+ for j in range(2):
26
+ weights[winner][j] += learning_rate * (city[j] - weights[winner][j])
27
+
28
+ # Print cluster centers
29
+ print("Neuron positions (cluster centers):")
30
+ for i, w in enumerate(weights):
31
+ print(f"Neuron {i}: {w}")
32
+
33
+ # Assign each city to its nearest neuron
34
+ print("\nCity assignments:")
35
+ for idx, city in enumerate(cities):
36
+ nearest = min(range(neurons), key=lambda i: (city[0]-weights[i][0])**2 + (city[1]-weights[i][1])**2)
37
+ print(f"{city_names[idx]} -> Cluster {nearest}")
38
+
@@ -0,0 +1,25 @@
1
+ #membership function
2
+ def fuzzy(x, a=4, b=7, c=10):
3
+ if x <= a or x >= c:
4
+ return 0
5
+ elif x <= b:
6
+ return (x - a) / (b - a)
7
+ else:
8
+ return (c - x) / (c - b)
9
+
10
+ n = int(input("Enter number of shops: "))
11
+ ratings = []
12
+
13
+ # User input
14
+ for i in range(n):
15
+ ratings.append(float(input(f"Enter rating for Shop {i+1}: ")))
16
+
17
+ # Fuzzification
18
+ memberships = [fuzzy(r) for r in ratings]
19
+ total = sum(memberships)
20
+
21
+ # Fuzzy ratios
22
+ print("\nShop Membership Fuzzy Ratio")
23
+ for i in range(n):
24
+ ratio = memberships[i] / total if total != 0 else 0
25
+ print(f"{i+1:>3} {memberships[i]:.2f} {ratio:.2f}")
@@ -0,0 +1,31 @@
1
+ def fuzzy(x, a, b, c):
2
+ if x <= a or x >= c:
3
+ return 0
4
+ elif x <= b:
5
+ return (x - a) / (b - a)
6
+ else:
7
+ return (c - x) / (c - b)
8
+
9
+ # ---- User Input ----
10
+ service = float(input("Enter service quality (0-10): "))
11
+ food = float(input("Enter food quality (0-10): "))
12
+
13
+ # ---- Fuzzification ----
14
+ service_poor = fuzzy(service, 0, 0, 5)
15
+ service_avg = fuzzy(service, 3, 5, 7)
16
+ service_good = fuzzy(service, 5, 10, 10)
17
+
18
+ food_bad = fuzzy(food, 0, 0, 5)
19
+ food_avg = fuzzy(food, 3, 5, 7)
20
+ food_good = fuzzy(food, 5, 10, 10)
21
+
22
+ # ---- Rule Evaluation ----
23
+ low_tip = max(service_poor, food_bad)
24
+ medium_tip = service_avg
25
+ high_tip = min(service_good, food_good)
26
+
27
+ # ---- Defuzzification (Weighted Average) ----
28
+ tip = (low_tip*5 + medium_tip*15 + high_tip*25) / \
29
+ (low_tip + medium_tip + high_tip)
30
+
31
+ print(f"\nRecommended Tip: {tip:.2f}%")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DjPractLelo
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: My first Python package
5
5
  Author: DjPractVala
6
6
  Author-email: DjPractVala <youremail@example.com>
@@ -56,4 +56,17 @@ DjPractLelo/resources/data_science/transform_data.py
56
56
  DjPractLelo/resources/data_science/video-to-horus.py
57
57
  DjPractLelo/resources/data_science/warehouse_location.py
58
58
  DjPractLelo/resources/data_science/xml-to-horus.py
59
+ DjPractLelo/resources/soft_computing/10a_simple_genetic algorithm.py
60
+ DjPractLelo/resources/soft_computing/1a_simple_nueral.py
61
+ DjPractLelo/resources/soft_computing/1b_binary_bipolar.py
62
+ DjPractLelo/resources/soft_computing/2a_macclouch_AND.py
63
+ DjPractLelo/resources/soft_computing/2b_macclouch_OR.py
64
+ DjPractLelo/resources/soft_computing/2c_macclouch_XOR.py
65
+ DjPractLelo/resources/soft_computing/3a_hebb_rule.py
66
+ DjPractLelo/resources/soft_computing/3b_delta_rule.py
67
+ DjPractLelo/resources/soft_computing/4a_back-prop.py
68
+ DjPractLelo/resources/soft_computing/4b_back-prop-error.py
69
+ DjPractLelo/resources/soft_computing/6a_kohonen_self.py
70
+ DjPractLelo/resources/soft_computing/9a_ratios_fuzzy.py
71
+ DjPractLelo/resources/soft_computing/9b_tipping problem.py
59
72
  DjPractLelo/resources/soft_computing/practical_manual.docx
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: DjPractLelo
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: My first Python package
5
5
  Author: DjPractVala
6
6
  Author-email: DjPractVala <youremail@example.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "DjPractLelo"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  description = "My first Python package"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="DjPractLelo",
5
- version="0.1.2",
5
+ version="0.1.3",
6
6
  author="DjPractVala",
7
7
  description="My demo Python package",
8
8
  packages=find_packages(),
File without changes
File without changes
File without changes