
import torch
import matplotlib.pyplot as plt
import seaborn as sns
X = torch.tensor([[1,0,0],[1,1,0],[1,0,1],[1,1,1]],dtype = torch.float32)
sigma = torch.tensor([0.4502, 0.4875, 0.4875, 0.5250])
andgate = torch.tensor([int(x) for x in sigma>=0.5], dtype = torch.float32)
plt.style.use('seaborn-whitegrid')
sns.set_style("white")
plt.figure(figsize=(5,3))
plt.title("AND GATE",fontsize=16)
plt.scatter(X[:,1],X[:,2],c=andgate,cmap="rainbow")
plt.xlim(-1,3)
plt.ylim(-1,3)
plt.grid(alpha=.4,axis="y")
plt.gca().spines["top"].set_alpha(.0)
plt.gca().spines["right"].set_alpha(.0);
import numpy as np
x = np.arange(-1,3,0.5)
plt.plot(x,(0.23-0.15*x)/0.15 ,color="k",linestyle="--");