I’m having trouble fitting a really basic neural network in Flux. I wanted to get a handle on the syntax by simulating simple data from a logistic regression, but the model isn’t converging to anything reasonable. I think this is probably due to a misunderstanding on my part of the syntax. Any thoughts on what I’m doing wrong? Code below

```
# generate logistic regression data
using Distributions
## size of data
n = 1000
d = 10 # covariates including bias
## seed
srand(1)
## coefficients
b = rand(Normal(), d)
## covariates
X = rand(Normal(), n, d)
X[:, 1] = ones(n)
## output
θ = sigmoid.(X * b) # true probabilities
y = rand.(Bernoulli.(θ))
mean((θ - y) .^ 2) # MSE with truth
## now drop bias from data
X = X[:, 2:d]
# set up neural network
using Flux
using Flux.Tracker
using Flux: @epochs
model = Chain(Dense(d - 1, 5, sigmoid),
Dense(5, 1, sigmoid))
# train model
## set up loss to minimize, optimizer, and data
loss(x, y) = Flux.mse(model(x), y)
opt = ADAM(params(model))
data = [(X', y)] # note the transpose of covariates!
loss(X', y) # 267.83
# now fit model
@epochs 100 Flux.train!(loss, data, opt)
# check model performance
loss(X', y) # 252.88
```