import numpy as np
from autoencoder.io import read_text
from autoencoder.network import mlp

count = read_text('biochemists.tsv', header='infer')
y = count[:, 0].astype(int)
x = count[:, 1:]

net = mlp(x.shape[1], output_size=1, hidden_size=(), masking=False, loss_type='nb')
model = net['model']

model.summary()
model.compile(loss=net['loss'], optimizer='Adam')
model.fit(x, y, epochs=700, batch_size=32)

print('Theta: %d' % 1/np.exp(model.get_weights()[2][0][0]))

Add a simple NB regression test to compare coefficients with R function glm.nb
Add a simple NB regression test to compare coefficients with R function glm.nb


Former-commit-id: 0ab35ca5ae619fc4f9c2233598f4d7563afdf214