Skip to content
Discussion options

You must be logged in to vote

The circle equation is fine. The sign is backwards.

In make_circles, label 1 is the inner ring and label 0 is the outer one. Quick check:

X, y = make_circles(1000, noise=0.03, random_state=42)
d = np.sqrt((X**2).sum(1))
d[y == 0].mean()   # 0.998
d[y == 1].mean()   # 0.801

Your forward returns d**2 - r**2, which gets larger the further a point sits from the center. BCEWithLogitsLoss reads a larger logit as "more likely to be class 1", so you're telling it the outer ring is class 1. No value of (h, k, rad) can satisfy that, so gradient descent keeps pushing the boundary further into the wrong place. That's why accuracy falls off instead of climbing.

I ran your code as posted to be sure. Af…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Dark07light
Comment options

Answer selected by Dark07light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants