1

私はgraphlabとpythonが初めてで、割り当てに取り組もうとしています。質問は、製品マトリックスで選択した単語ごとに新しい列を作成することになっているから、選択した単語に対して感情分析を行うことです。エントリはそのような単語が出現する回数なので、単語「wordCount_select」の関数を作成しました

import graphlab
products = graphlab.SFrame('amazon_baby.gl')
products['word_count'] = graphlab.text_analytics.count_words(products['review'])
selected_words = ['awesome', 'great', 'fantastic', 'amazing', 'love', 'horrible', 'bad', 'terrible', 'awful', 'wow', 'hate']

関数

def wordCount_select(wc,selectedWord):
    if selectedWord in wc:
        return wc[selectedWord]
    else:
        return 0    


for word in selected_words:
    products[word] = products['word_count'].apply(lambda wc: wordCount_select(wc, word))

しかし、私はこのエラーを受けています

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-5-494af1bfc2ab> in <module>()
      7 
      8 for word in selected_words:
----> 9     products[word] = products['word_count'].apply(lambda wc: wordCount_select(wc, word))

C:\Users\elginelijahsoft\Anaconda2\envs\dato-env\lib\site-packages\graphlab\data_structures\sarray.pyc in apply(self, fn, dtype, skip_undefined, seed)
   1699 
   1700         with cython_context():
-> 1701             return SArray(_proxy=self.__proxy__.transform(fn, dtype, skip_undefined, seed))
   1702 
   1703 

C:\Users\elginelijahsoft\Anaconda2\envs\dato-env\lib\site-packages\graphlab\cython\context.pyc in __exit__(self, exc_type, exc_value, traceback)
     47             if not self.show_cython_trace:
     48                 # To hide cython trace, we re-raise from here
---> 49                 raise exc_type(exc_value)
     50             else:
     51                 # To show the full trace, we do nothing and let exception propagate

RuntimeError: Runtime Exception. Cannot evaluate lambda. Lambda workers cannot not start.

私が間違っていることと、ラムダワーカーが起動できない理由

4

1 に答える 1