前提・実現したいこと
ほかの個所はエラーが出ないのですが、ここだけユニコードエラーが出ます。
コードや入力データはすべてUTF-8で書いています。
発生している問題・エラーメッセージ
UnicodeEncodeError Traceback (most recent call last) <ipython-input-250-7607677e8b6c> in <module> 2 import pyLDAvis.sklearn 3 pyLDAvis.enable_notebook() ----> 4 panel = pyLDAvis.sklearn.prepare(lda, X_tfidf, tv, mds='tsne') 5 panel C:\Users\Public\anaconda3\envs\py37\lib\site-packages\pyLDAvis\sklearn.py in prepare(lda_model, dtm, vectorizer, **kwargs) 93 """ 94 opts = fp.merge(_extract_data(lda_model, dtm, vectorizer), kwargs) ---> 95 return pyLDAvis.prepare(**opts) C:\Users\Public\anaconda3\envs\py37\lib\site-packages\pyLDAvis\_prepare.py in prepare(topic_term_dists, doc_topic_dists, doc_lengths, vocab, term_frequency, R, lambda_step, mds, n_jobs, plot_opts, sort_topics) 396 term_frequency = np.sum(term_topic_freq, axis=0) 397 --> 398 topic_info = _topic_info(topic_term_dists, topic_proportion, term_frequency, term_topic_freq, vocab, lambda_step, R, n_jobs) 399 token_table = _token_table(topic_info, term_topic_freq, vocab, term_frequency) 400 topic_coordinates = _topic_coordinates(mds, topic_term_dists, topic_proportion) C:\Users\Public\anaconda3\envs\py37\lib\site-packages\pyLDAvis\_prepare.py in _topic_info(topic_term_dists, topic_proportion, term_frequency, term_topic_freq, vocab, lambda_step, R, n_jobs) 252 'Category': 'Topic%d' % new_topic_id}) 253 --> 254 top_terms = pd.concat(Parallel(n_jobs=n_jobs)(delayed(_find_relevance_chunks)(log_ttd, log_lift, R, ls) \ 255 for ls in _job_chunks(lambda_seq, n_jobs))) 256 topic_dfs = map(topic_top_term_df, enumerate(top_terms.T.iterrows(), 1)) C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\parallel.py in __call__(self, iterable) 952 953 if not self._managed_backend: --> 954 n_jobs = self._initialize_backend() 955 else: 956 n_jobs = self._effective_n_jobs() C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\parallel.py in _initialize_backend(self) 719 """Build a process or thread pool and return the number of workers""" 720 try: --> 721 n_jobs = self._backend.configure(n_jobs=self.n_jobs, parallel=self, 722 **self._backend_args) 723 if self.timeout is not None and not self._backend.supports_timeout: C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\_parallel_backends.py in configure(self, n_jobs, parallel, prefer, require, idle_worker_timeout, **memmappingexecutor_args) 490 SequentialBackend(nesting_level=self.nesting_level)) 491 --> 492 self._workers = get_memmapping_executor( 493 n_jobs, timeout=idle_worker_timeout, 494 env=self._prepare_worker_env(n_jobs=n_jobs), C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\executor.py in get_memmapping_executor(n_jobs, **kwargs) 18 19 def get_memmapping_executor(n_jobs, **kwargs): ---> 20 return MemmappingExecutor.get_memmapping_executor(n_jobs, **kwargs) 21 22 C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\executor.py in get_memmapping_executor(cls, n_jobs, timeout, initializer, initargs, env, temp_folder, context_id, **backend_args) 40 _executor_args = executor_args 41 ---> 42 manager = TemporaryResourcesManager(temp_folder) 43 44 # reducers access the temporary folder in which to store temporary C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\_memmapping_reducer.py in __init__(self, temp_folder_root, context_id) 529 # exposes exposes too many low-level details. 530 context_id = uuid4().hex --> 531 self.set_current_context(context_id) 532 533 def set_current_context(self, context_id): C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\_memmapping_reducer.py in set_current_context(self, context_id) 533 def set_current_context(self, context_id): 534 self._current_context_id = context_id --> 535 self.register_new_context(context_id) 536 537 def register_new_context(self, context_id): C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\_memmapping_reducer.py in register_new_context(self, context_id) 558 new_folder_name, self._temp_folder_root 559 ) --> 560 self.register_folder_finalizer(new_folder_path, context_id) 561 self._cached_temp_folders[context_id] = new_folder_path 562 C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\_memmapping_reducer.py in register_folder_finalizer(self, pool_subfolder, context_id) 588 # semaphores and pipes 589 pool_module_name = whichmodule(delete_folder, 'delete_folder') --> 590 resource_tracker.register(pool_subfolder, "folder") 591 592 def _cleanup(): C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\externals\loky\backend\resource_tracker.py in register(self, name, rtype) 189 '''Register a named resource, and increment its refcount.''' 190 self.ensure_running() --> 191 self._send('REGISTER', name, rtype) 192 193 def unregister(self, name, rtype): C:\Users\Public\anaconda3\envs\py37\lib\site-packages\joblib\externals\loky\backend\resource_tracker.py in _send(self, cmd, name, rtype) 202 203 def _send(self, cmd, name, rtype): --> 204 msg = '{0}:{1}:{2}\n'.format(cmd, name, rtype).encode('ascii') 205 if len(name) > 512: 206 # posix guarantees that writes to a pipe of less than PIPE_BUF UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-19: ordinal not in range(128)
該当のソースコード
python
1import pyLDAvis 2import pyLDAvis.sklearn 3pyLDAvis.enable_notebook() 4panel = pyLDAvis.sklearn.prepare(lda, X_tfidf, tv, mds='tsne') 5panel
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー