#1A. Design a simple linear neural network model for single Neuron

x = float(input("Enter value of x:"))
w = float(input("Enter value of weight w:"))
b = float(input("Enter value of bias b:"))
net = float(w*x+b)
if(net<0):
  out=0
elif((net>=0)&(net<=1)):
  out=net
else:
  out=1
print("net=",net)
print("output=",out)


#1B. Design a simple linear neural network model for number of Neurons.

n = int(input("Enter the number of input neurons:"))
# w will take weight and x will take the input 2
w = []
x = []
#taking the value of input and their weight
for i in range(0,n):
  a = float(input("Enter the input:"))
  x.append(a)
  b = float(input("Enter the weight:"))
  w.append(b)
print("The given weights are w:")
print(w)
print("The given input are:")
print(x)

y = 0.0
for i in range(0,n):
   y = y + (w[i]*x[i])

print("The net input is:")
print(round(y,3))


#1C. Design a simple linear neural network model for number of Neurons and bias.

n = int(input("Enter the number of input neurons:"))
# w will take weight and x will take the input 2
w = []
x = []
#taking the value of input and their weight
for i in range(0,n):
  a = float(input("Enter the input:"))
  x.append(a)
  b = float(input("Enter the weight:"))
  w.append(b)
print("The given weights are w:")
print(w)
print("The given input are:")
print(x)

y = 0.0
bias = float(input("Enter the bias:"))
for i in range(0,n):
   y = y + (w[i]*x[i])

print("The net input is:")
print(round(y+bias,3))


#1D . Calculate the output of neural net using both binary and bipolar sigmoidal function,binary,bipolar and ramp function

import numpy as np

def binary_sigmoid(x):
  return 1 / (1 + np.exp(-x))

def bipolar_sigmoid(x):
  return (2 / (1 + np.exp(-x))) - 1

def binary_step(x):
  return np.where(x>=0 ,1,0)

def bipolar_step(x):
  return np.where(x>=0 ,1,-1)

def ramp_function(x):
  return np.maximum(0,x)





#Example input(simulating a neuron's weighted sum + bias)
inputs = 0.93 + 0.45

#Apply binary and bipolar sigmoid functions



print("Binary Sigmoid Output:", binary_sigmoid(inputs))
print("Bipolar Sigmoid Output:", bipolar_sigmoid(inputs))
print("Binary Step Output:", binary_step(inputs))
print("Bipolar Step Output:", bipolar_step(inputs))
print("Ramp Function Output:", ramp_function(inputs))





