When trying to build the mittens model, I get the following error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-30-814206757e5a> in <module>()
2 cooccur_matrix,
3 vocab=vocab,
----> 4 initial_embedding_dict=vector_dict
5 )
~/anaconda3/envs/mittens/lib/python3.6/site-packages/mittens/mittens_base.py in fit(self, X, vocab, initial_embedding_dict, fixed_initialization)
78 X, vocab, initial_embedding_dict
79 )
---> 80 weights, log_coincidence = self._initialize(X)
81 return self._fit(X, weights, log_coincidence,
82 vocab=vocab,
~/anaconda3/envs/mittens/lib/python3.6/site-packages/mittens/mittens_base.py in _initialize(self, coincidence)
143 self.n_words = coincidence.shape[0]
144 bounded = np.minimum(coincidence, self.xmax)
--> 145 weights = (bounded / float(self.xmax)) ** self.alpha
146 log_coincidence = log_of_array_ignoring_zeros(coincidence)
147 return weights, log_coincidence
~/anaconda3/envs/mittens/lib/python3.6/site-packages/numpy/matrixlib/defmatrix.py in __pow__(self, other)
320
321 def __pow__(self, other):
--> 322 return matrix_power(self, other)
323
324 def __ipow__(self, other):
~/anaconda3/envs/mittens/lib/python3.6/site-packages/numpy/matrixlib/defmatrix.py in matrix_power(M, n)
139 raise ValueError("input must be a square array")
140 if not issubdtype(type(n), N.integer):
--> 141 raise TypeError("exponent must be an integer")
142
143 from numpy.linalg import inv
TypeError: exponent must be an integer
I was able to identify that the error is because self.alpha is set to 0.75. If I set that to 1.0 I do not get the error (though I will obviously not be weighting things as intended).
When trying to build the
mittens
model, I get the following error:I was able to identify that the error is because
self.alpha
is set to0.75
. If I set that to1.0
I do not get the error (though I will obviously not be weighting things as intended).Note: I am using
numpy 1.14.5