Code Monkey home page Code Monkey logo

neural-tensor-network's People

Contributors

siddharth-agrawal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

neural-tensor-network's Issues

IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

I am getting below error when trying to run python neuralTensorNetwork.py

File "neuralTensorNetwork.py", line 753, in <module>
    neuralTensorNetwork()
  File "neuralTensorNetwork.py", line 733, in neuralTensorNetwork
    args = (data, 1,), method = 'L-BFGS-B', jac = True, options = {'maxiter': batch_iterations})
  File "/Users/khurram/anaconda3/envs/tf2/lib/python2.7/site-packages/scipy/optimize/_minimize.py", line 487, in minimize
    callback=callback, **options)
  File "/Users/khurram/anaconda3/envs/tf2/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py", line 335, in _minimize_lbfgsb
    f, g = func_and_grad(x)
  File "/Users/khurram/anaconda3/envs/tf2/lib/python2.7/site-packages/scipy/optimize/lbfgsb.py", line 285, in func_and_grad
    f = fun(x, *args)
  File "/Users/khurram/anaconda3/envs/tf2/lib/python2.7/site-packages/scipy/optimize/optimize.py", line 292, in function_wrapper
    return function(*(wrapper_args + args))
  File "/Users/khurram/anaconda3/envs/tf2/lib/python2.7/site-packages/scipy/optimize/optimize.py", line 63, in __call__
    fg = self.fun(x, *args)
  File "neuralTensorNetwork.py", line 219, in neuralTensorNetworkCost
    entity_vectors_e1 = entity_vectors[:, e1.tolist()]
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

Why do you roll all the models' parameters together?

You have this function, StackToParams where you seem to take all the models' parameters and roll them into one parameter, which seems moderately expensive. The only place it seems like you us this representation of your parameters is that allows you to say this, which is clean, I admit. But this seems like a lot of overhead to keep the code a little cleaner. And for this cleanliness, I feel like you've lost some readability. Am I missing something? Is there some other reason you chose to wrap all those parameters together?

An error at line 270 of NeuralTensorNetwork.py

Hi Guys!
I don't understand why the following line of NeuralTensorNetwork.py works well.

wrong_filter = (score_pos + 1 > score_neg)[0]

I think you should subtract 1 from ``score_pos''.

wrong_filter = (score_pos - 1 > score_neg)[0]

Get entity vectors for examples of 'i'th relation

File "neuralTensorNetwork.py", line 219, in neuralTensorNetworkCost
entity_vectors_e1 = entity_vectors[:, e1.tolist()]
IndexError: only integers, slices (:), ellipsis (...), numpy.newaxis (None) and integer or boolean arrays are valid indices

Activation function for calculating the score of a tripple is missing

Hello,

I think the acitviation function for calculating the score of a tripple after the training is missing.
https://github.com/siddharth-agrawal/Neural-Tensor-Network/blob/master/neuralTensorNetwork.py#L428-L434 and also in getPredictions().

dev_scores[i, 0] += U[rel][k, 0] * (np.dot(entity_vector_e1.T, np.dot(W[rel][:, :, k], entity_vector_e2)) +
np.dot(V[rel][:, k].T, entity_stack) + b[rel][0, k])

I think it should be like this:
test_score += U[rel][k, 0] * self.activationFunction((np.dot(entity_vector_e1.T, np.dot(W[rel][:, :, k], entity_vector_e2)) +
np.dot(V[rel][:, k].T, entity_stack) + b[rel][0, k]))

What do you think?

UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 0: ordinal not in range(128)

Hi,
When I run the neuralTensorNetwork.py file, I have encountered this problem:
I use Python 3.6.

Traceback (most recent call last):
File "neuralTensorNetwork.py", line 764, in
neuralTensorNetwork()
File "neuralTensorNetwork.py", line 710, in neuralTensorNetwork
word_indices, num_words = getWordIndices('wordIndices.p')
File "neuralTensorNetwork.py", line 591, in getWordIndices
word_dictionary = pickle.load(open(file_name, 'rb'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdf in position 0: ordinal not in range(128)

Does anyone know how to solve it?

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.