alpaca-lib / alpaca

0 stars 0 forks source link

Deep Neural Network initial implementation #50

Open osanseviero opened 6 years ago

osanseviero commented 6 years ago

As mentioned in #7, we would like to have a basic implementation of a Deep Neural Network. The design should be consistent with other major libraries and should have enough flexibility to add other types of layers (for the future when we add things like RNN or CNN).

Here is an example with Keras

model = Sequential()
model.add(Dense(512, input_dim=1000))
model.add(Dense(2, activation='softmax'))
model.compile(loss = 'mean_squared_error', optimizer='adam', metrics=['accuracy'])
model.fit(x_train, y_train, epochs=200, batch_size=100, verbose=0)

And a complex one in TFLearn.

We need to define our interface as well.

So, what do we need?

@EdgarGar and @Biller17 what do you think?

osanseviero commented 6 years ago

A resource that should be helpful to understand the forward pass and how to implement the nodes. http://neuralnetworksanddeeplearning.com/chap1.html.

Note: in this tutorial, the author is adding a sigmoid activation to all the nodes. We shouldn't do this - doing np.dot(w, x)+b should be enough. Also, look at how he is setting up random initial weights. This is ok (probably, in the future, we might want to add some options around this). The weights are adjusted with backpropagation.