snuspl / dolphin

14 stars 2 forks source link

Introduce a new Matrix interface and implementation based on JBLAS #143

Closed beomyeol closed 8 years ago

beomyeol commented 8 years ago

Since Nd4j has several problem as mentioned in #142, this pull request introduces a new Matrix interface that supports float data type and will replace Nd4j library, and an implementation based on jblas. The interface of Matrix is motivated by jblas's FloatMatrix, but does not have all methods of FloatMatrix. We can add methods which have not been implemented later if needed. In addition, this pull request also introduces Function interface for activation functions and MatrixUtils, a utility class for Matrix. The implementation of a sigmoid function is included in this PR and other implementations such as ReLU, Softmax, Tanh will be added later. MatrixUtils provides functions for comparison and readNumpy() for loading matrix data from Numpy-compatible plain text files.

beomyeol commented 8 years ago

I've added ReLU, identity, absolute value, square and hyperbolic tangent function. Please take a look at these too.

beomyeol commented 8 years ago

I changed the assumption that the argument of derivative() method is the return value of apply(). In this case, derivates of the absolute value function and the square function cannot be derived from their return values because the signs of original inputs are lost by apply() operation. Thus, I removed the absolute value and square functions.

jsjason commented 8 years ago

I did a pass, @beomyeol. It would've been painful to write this code; thanks a lot!

beomyeol commented 8 years ago

@jsjason I addressed your comments. Please take another look.

jsjason commented 8 years ago

@beomyeol This looks great. I'll merge this after you address my new comments.

beomyeol commented 8 years ago

@jsjason Thanks for your review. I've addressed your new comments :)