diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..0ea4095 Binary files /dev/null and b/.DS_Store differ diff --git a/ShreyRamanujam/.DS_Store b/ShreyRamanujam/.DS_Store new file mode 100644 index 0000000..15014ad Binary files /dev/null and b/ShreyRamanujam/.DS_Store differ diff --git a/ShreyRamanujam/A.py b/ShreyRamanujam/A.py new file mode 100644 index 0000000..3781051 --- /dev/null +++ b/ShreyRamanujam/A.py @@ -0,0 +1,13 @@ +import random +import math +y1 = [] +y2 = [] # Same as y cap +for i in range(100): + y1.append(random.randint(0,1)) + y2.append(random.uniform(0,1)) +o = 0 +for i in range(100): + o += y1[i] * math.log2(y2[i]) + (1 - y1[i]) * math.log2(1-y2[i]) + +o = -o/100 +print("Cross-Entropy loss value is: ", o) diff --git a/ShreyRamanujam/B.py b/ShreyRamanujam/B.py new file mode 100644 index 0000000..90b67a8 --- /dev/null +++ b/ShreyRamanujam/B.py @@ -0,0 +1,18 @@ +class numbers(): + def __init__(self, numbers): + self.numbers = numbers + + def findtargetpairs(self, target): + sno = 1 + targetdictionary = {} + for i in range(0, len(self.numbers)): + for j in range(0, len(self.numbers)): + if self.numbers[i] + self.numbers[j] == target: + targetdictionary[sno] = [i, j] + sno += 1 + return targetdictionary + + +mynumbers = numbers([10, 20, 10, 40, 50, 60, 70]) +target50 = mynumbers.findtargetpairs(50) +print(target50)