for words_per_topic in a:
print(words_per_topic)
c_a.append(palmetto.get_coherence(words_per_topic, coherence_type='ca'))
c_p.append(palmetto.get_coherence(words_per_topic, coherence_type='cp'))
npmi.append(palmetto.get_coherence(words_per_topic, coherence_type='npmi'))
uci.append(palmetto.get_coherence(words_per_topic, coherence_type='uci'))
print(c_a)
a is two dim list
Traceback (most recent call last):
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 445, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 440, in _make_request
httplib_response = conn.getresponse()
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/http/client.py", line 1369, in getresponse
response.begin()
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/http/client.py", line 310, in begin
version, status, reason = self._read_status()
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/http/client.py", line 271, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 756, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/util/retry.py", line 532, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/packages/six.py", line 770, in reraise
raise value
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 706, in urlopen
chunked=chunked,
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 447, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/urllib3/connectionpool.py", line 337, in _raise_timeout
self, url, "Read timed out. (read timeout=%s)" % timeout_value
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='palmetto.demos.dice-research.org', port=443): Read timed out. (read timeout=5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yxb/software/palmetto-py/palmettopy/palmetto.py", line 27, in _request_by_service
r = requests.get(request_uri, timeout=self.timeout)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/sessions.py", line 677, in send
history = [resp for resp in gen]
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/sessions.py", line 677, in <listcomp>
history = [resp for resp in gen]
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/sessions.py", line 245, in resolve_redirects
**adapter_kwargs
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/yxb/anaconda3/envs/nlp1/lib/python3.7/site-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='palmetto.demos.dice-research.org', port=443): Read timed out. (read timeout=5)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/yxb/MyCoding/NTMModelCode/BiNTM/model.py", line 159, in <module>
c_p.append(palmetto.get_coherence(words_per_topic, coherence_type='cp'))
File "/home/yxb/software/palmetto-py/palmettopy/palmetto.py", line 104, in get_coherence
return self._get_coherence(words, coherence_type)
File "/home/yxb/software/palmetto-py/palmettopy/palmetto.py", line 91, in _get_coherence
coherence = self._request_by_service(words, coherence_type)
File "/home/yxb/software/palmetto-py/palmettopy/palmetto.py", line 29, in _request_by_service
raise EndpointDown(request_uri)
palmettopy.exceptions.EndpointDown: http://palmetto.aksw.org/palmetto-webapp/service/cp?words=key%20remember%20atheist%20structure%20add%20instance%20repeat%20fun%20heavy%20doubt
Process finished with exit code 1
*but i can run the test example successfully*
when i run the code following get error: