Skip to content

Instantly share code, notes, and snippets.

@ashokc
Created April 24, 2019 21:11
Show Gist options
  • Save ashokc/fab5f61d0445e1b3d564ae10f91d7796 to your computer and use it in GitHub Desktop.
Save ashokc/fab5f61d0445e1b3d564ae10f91d7796 to your computer and use it in GitHub Desktop.
def relabelData (x, y, w):
lineY = - ( w[0] + w[1] * x ) / w[2] # Current data decision boundary: w[0] + w[1] * x + w[2] * y
fvalsY = y - lineY
lineX = - ( w[0] + w[2] * y ) / w[1]
fvalsX = x - lineX
labels = []
for i, fy in enumerate(fvalsY):
fx = fvalsX[i]
if (fx < 0.0):
labels.append(0.0)
if (fx > 0.0):
labels.append(1.0)
labels = np.array(labels)
return labels
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment