{
  "id": 9722,
  "title": "Sample code different from benchmark",
  "url": "/competitions/avito-prohibited-content/discussion/9722",
  "author_name": "",
  "post_date": "2014-07-12T03:41:29.353Z",
  "votes": null,
  "comment_count": 18,
  "views": 3734,
  "content": "<p>I'm unable to reproduce the 0.89061 result with the provided sample code.</p>\n<p>After uncommenting the lines in main(), I got&nbsp;0.88598. &nbsp;Many other entrants on the leaderboard also have this score, so it appears it's not just me.</p>\n<p>In the <a href=\"https://www.kaggle.com/c/avito-prohibited-content/forums/t/9550/mistake-about-the-provided-python-code\">other thread</a>, it's said that a fix to line 57 is required:</p>\n<p><code>item = {featureName:featureValue.decode('utf-8') for featureName,featureValue in item.iteritems() if featureValue is not None}<br></code></p>\n<p>However, I get the exact same result file (no diffs) with or without this fix.</p>\n\n<p>What other changes are required to the sample code to achieve the stated benchmark score? &nbsp;Could this be a platform difference? I'm on Mac OS 10.9 / Python 2.7.7 / nltk 2.0.4.</p>",
  "messages": [
    {
      "id": "50377",
      "postDate": "07/12/2014 03:41:29",
      "content": "<p>I'm unable to reproduce the 0.89061 result with the provided sample code.</p>\n<p>After uncommenting the lines in main(), I got&nbsp;0.88598. &nbsp;Many other entrants on the leaderboard also have this score, so it appears it's not just me.</p>\n<p>In the <a href=\"https://www.kaggle.com/c/avito-prohibited-content/forums/t/9550/mistake-about-the-provided-python-code\">other thread</a>, it's said that a fix to line 57 is required:</p>\n<p><code>item = {featureName:featureValue.decode('utf-8') for featureName,featureValue in item.iteritems() if featureValue is not None}<br></code></p>\n<p>However, I get the exact same result file (no diffs) with or without this fix.</p>\n\n<p>What other changes are required to the sample code to achieve the stated benchmark score? &nbsp;Could this be a platform difference? I'm on Mac OS 10.9 / Python 2.7.7 / nltk 2.0.4.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50400",
      "postDate": "07/12/2014 13:19:26",
      "content": "<p>@Synthient</p>\n<p>Try to change a little bit on the alpha in the SGD classifier, and set correct words and stem to True, you will got 0.9.</p>\n<p>clf = SGDClassifier( loss=&quot;log&quot;, penalty=&quot;l2&quot;, alpha=1e-5, class_weight=&quot;auto&quot;)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50409",
      "postDate": "07/12/2014 16:41:08",
      "content": "<p>Thanks. I mostly just wanted to reproduce the benchmark score. When the published code doesn't work or doesn't produce the advertised result, sometimes there's something else missing...</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50916",
      "postDate": "07/20/2014 08:20:52",
      "content": "<p>Hi Kevin,</p>\n<p>Do you know the sample size and other parameters used for Avito Best Prediction, e.g. learning rate and alpha? I am assuming it used the Corrected Words and Stemming.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "50917",
      "postDate": "07/20/2014 08:22:36",
      "content": "<p>Hi Synth,</p>\n<p>I also think you need to set nIter = 100 or something, the default nIter for SGDClassiffier is 5, but it will hardly converge within 5 iteration</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51147",
      "postDate": "07/24/2014 17:27:04",
      "content": "<p>Can anybody help me with this piece of code. I have no idea what is does? I would be glad if can somebody explain the code line by line. Thanks in advance.</p>\n<p><em>stopwords= frozenset(word.decode('utf-8') for word in nltk.corpus.stopwords.words(&quot;russian&quot;) if word!=&quot;&#1085;&#1077;&quot;) </em><br><em>stemmer = SnowballStemmer('russian')</em><br><em>engChars = [ord(char) for char in u&quot;cCyoOBaAKpPeE&quot;]</em><br><em>rusChars = [ord(char) for char in u&quot;&#1089;&#1057;&#1091;&#1086;&#1054;&#1042;&#1072;&#1040;&#1050;&#1088;&#1056;&#1077;&#1045;&quot;]</em><br><em>eng_rusTranslateTable = dict(zip(engChars, rusChars))</em><br><em>rus_engTranslateTable = dict(zip(rusChars, engChars))</em></p>\n<p><em>logging.basicConfig(format = u'[LINE:%(lineno)d]# %(levelname)-8s [%(asctime)s] %(message)s', level = logging.NOTSET)</em><br> <br><em>def correctWord (w):</em><br><em> &quot;&quot;&quot; Corrects word by replacing characters with written similarly depending on which language the word. </em><br><em> Fraudsters use this technique to avoid detection by anti-fraud algorithms.&quot;&quot;&quot;</em></p>\n<p><em>if len(re.findall(ur&quot;[&#1072;-&#1103;]&quot;,w))&gt;len(re.findall(ur&quot;[a-z]&quot;,w)):</em><br><em> return w.translate(eng_rusTranslateTable)</em><br><em> else:</em><br><em> return w.translate(rus_engTranslateTable)</em></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51155",
      "postDate": "07/24/2014 19:48:05",
      "content": "<p>[quote]</p>\n<p><em>engChars = [ord(char) for char in u&quot;cCyoOBaAKpPeE&quot;]</em><br><em>rusChars = [ord(char) for char in u&quot;&#1089;&#1057;&#1091;&#1086;&#1054;&#1042;&#1072;&#1040;&#1050;&#1088;&#1056;&#1077;&#1045;&quot;]</em></p>\n<p><em>[/quote]</em></p>\n<p><em>- this is&nbsp;<a href=\"https://en.wikipedia.org/wiki/Homoglyph\">homoglyphs</a>&nbsp;in english and russian layouts.&nbsp;</em></p>\n<p><em>[quote]</em></p>\n<p><em>if len(re.findall(ur&quot;[&#1072;-&#1103;]&quot;,w))&gt;len(re.findall(ur&quot;[a-z]&quot;,w)):</em></p>\n<p><em>...</em></p>\n<p>[/quote]</p>\n<p>- this is detection&nbsp;which language the word.</p>\n<p>The remaining lines are evident, IMHO...</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51168",
      "postDate": "07/25/2014 06:54:24",
      "content": "<p>[quote=Kevin Hu;50400]</p>\n<p>@Synthient</p>\n<p>Try to change a little bit on the alpha in the SGD classifier, and set correct words and stem to True, you will got 0.9.</p>\n<p>clf = SGDClassifier( loss=&quot;log&quot;, penalty=&quot;l2&quot;, alpha=1e-5, class_weight=&quot;auto&quot;)</p>\n<p>[/quote]</p>\n<p>Even after this change i cant able to get 0.89</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51169",
      "postDate": "07/25/2014 06:54:56",
      "content": "<p>still in 0.286</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51179",
      "postDate": "07/25/2014 16:15:18",
      "content": "<p>[quote=Parthiban Gowthaman;51169]</p>\n<p>still in 0.286</p>\n<p>[/quote]</p>\n<p>Increase the number of iterations, using&nbsp;<strong>n_iter</strong>: parameter, additionally, changing the number of features also helpful.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51180",
      "postDate": "07/25/2014 17:06:43",
      "content": "<p>Double check if you are submitting the updated file created by the python script</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51255",
      "postDate": "07/28/2014 06:39:23",
      "content": "<p>I am unable to reproduce 0.89 benchmark. The score was 0.37.</p>\n<p>I have made following changes:</p>\n<p><em>item = {featureName:featureValue.decode('utf-8') for featureName,featureValue in item.iteritems() if featureValue is not None}</em></p>\n<p>Changed the alpha value in SGD classifier to 1e-5, n_ter = 100</p>\n<p>Uncommented the 4 lines in main&nbsp;</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51285",
      "postDate": "07/29/2014 04:15:59",
      "content": "<p>I was getting the correct benchmark at first and then when I switched computers I started getting low values like 0.28. These only happened when I was running the code within Spyder, so it must have been using an old version of python or more likely loading outdated versions of the libraries. Make sure you have the most recent version of everything (by installing a distribution like Anaconda, for example) and then run the sample code directly from the command prompt rather than from an IDE.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51287",
      "postDate": "07/29/2014 04:31:25",
      "content": "<p>[quote=James King;51285]</p>\n<p>I was getting the correct benchmark at first and then when I switched computers I started getting low values like 0.28. These only happened when I was running the code within Spyder, so it must have been using an old version of python or more likely loading outdated versions of the libraries. Make sure you have the most recent version of everything (by installing a distribution like Anaconda, for example) and then run the sample code directly from the command prompt rather than from an IDE.</p>\n<p>[/quote]</p>\n<p>When I executed the same code in Ubuntu platform, I&nbsp; am able to get 0.9. It might be that the libraries are outdated and older version of python.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51432",
      "postDate": "07/31/2014 18:13:08",
      "content": "<p>My question is around the existing python code given to us and the benchmark of 0.89. How did people get it to run with the existing code: &quot;clf.fit(trainFeatures,trainTargets)&quot;</p>\n<p><code>I get this error:</code></p>\n\n<p><code>[LINE:159]# INFO [2014-07-31 17:08:40,598] Feature preparation done, fitting model...<br>Traceback (most recent call last):<br>File &quot;avito_ProhibitedContent_SampleCode.py&quot;, line 184, in &lt;module&gt;<br>main()<br>File &quot;avito_ProhibitedContent_SampleCode.py&quot;, line 165, in main<br>clf.fit(trainFeatures,trainTargets)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/base.py&quot;, line 430, in fit<br>self._fit_binary(X, y, sample_weight)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/stochastic_gradient.py&quot;, line 131, in _fit_binary<br>X = np.asarray(X, dtype=np.float64, order='C')<br>File &quot;/usr/lib/python2.7/dist-packages/numpy/core/numeric.py&quot;, line 235, in asarray<br>return array(a, dtype, copy=False, order=order)<br>ValueError: setting an array element with a sequence.</code></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51437",
      "postDate": "07/31/2014 20:37:11",
      "content": "<p>For those that had the ~0.30 result problem, how did you get around that?</p>\n<p>So far I have tried running the provided script in both Windows and Linux, with different versions of Anaconda environment (1.9 and 2.0) and all the latest updates. Results vary between 0.27 and 0.30 but not more.</p>\n<p>Has anyone been able to pinpoint if it is an issue with the feature calculation if you don't have specific library versions or if it is something in the model itself?</p>\n<p>Any specific versions of operating system and python libraries, etc. that work? Also have you installed the entire nltk or only the few parts required to run the script?</p>\n<p>Thanks,</p>\n<p>Andreas</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51451",
      "postDate": "08/01/2014 05:38:04",
      "content": "<p>What version of scikit are you using ? I get error in the code below. Please help -&nbsp;</p>\n\n\n<p><code>self._fit_binary(X, y, sample_weight)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/stochastic_gradient.py&quot;, line 131, in _fit_binary<br>X = np.asarray(X, dtype=np.float64, order='C')<br>File &quot;/usr/lib/python2.7/dist-packages/numpy/core/numeric.py&quot;, line 235, in asarray<br>return array(a, dtype, copy=False, order=order)<br>ValueError: setting an array element with a sequence.</code></p>\n\n<p><code>trainFeatures,trainTargets, trainItemIds=processData(os.path.join(dataFolder,&quot;avito_train.tsv&quot;), featureIndexes, itemsLimit=3000)<br> logging.info(&quot;Feature preparation done, fitting model...&quot;)<br> clf = SGDClassifier( loss=&quot;log&quot;,<br> penalty=&quot;l2&quot;,<br> alpha=1e-4,<br> class_weight=&quot;auto&quot;)<br>clf.fit(trainFeatures,trainTargets)<br>#clf.fit(trainFeatures.toarray(),trainTargets)</code></p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51452",
      "postDate": "08/01/2014 05:38:42",
      "content": "",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "51506",
      "postDate": "08/01/2014 22:03:15",
      "content": "<p>Resolved : I had an older version of scikit. Got 0.15 now and it all worked.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 50400,
      "author_name": "kevinandhu",
      "author_url": "",
      "post_date": "07/12/2014 13:19:26",
      "content": "<p>@Synthient</p>\n<p>Try to change a little bit on the alpha in the SGD classifier, and set correct words and stem to True, you will got 0.9.</p>\n<p>clf = SGDClassifier( loss=&quot;log&quot;, penalty=&quot;l2&quot;, alpha=1e-5, class_weight=&quot;auto&quot;)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50409,
      "author_name": "brundage",
      "author_url": "",
      "post_date": "07/12/2014 16:41:08",
      "content": "<p>Thanks. I mostly just wanted to reproduce the benchmark score. When the published code doesn't work or doesn't produce the advertised result, sometimes there's something else missing...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50916,
      "author_name": "sayan21",
      "author_url": "",
      "post_date": "07/20/2014 08:20:52",
      "content": "<p>Hi Kevin,</p>\n<p>Do you know the sample size and other parameters used for Avito Best Prediction, e.g. learning rate and alpha? I am assuming it used the Corrected Words and Stemming.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 50917,
      "author_name": "sayan21",
      "author_url": "",
      "post_date": "07/20/2014 08:22:36",
      "content": "<p>Hi Synth,</p>\n<p>I also think you need to set nIter = 100 or something, the default nIter for SGDClassiffier is 5, but it will hardly converge within 5 iteration</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51147,
      "author_name": "novice7",
      "author_url": "",
      "post_date": "07/24/2014 17:27:04",
      "content": "<p>Can anybody help me with this piece of code. I have no idea what is does? I would be glad if can somebody explain the code line by line. Thanks in advance.</p>\n<p><em>stopwords= frozenset(word.decode('utf-8') for word in nltk.corpus.stopwords.words(&quot;russian&quot;) if word!=&quot;&#1085;&#1077;&quot;) </em><br><em>stemmer = SnowballStemmer('russian')</em><br><em>engChars = [ord(char) for char in u&quot;cCyoOBaAKpPeE&quot;]</em><br><em>rusChars = [ord(char) for char in u&quot;&#1089;&#1057;&#1091;&#1086;&#1054;&#1042;&#1072;&#1040;&#1050;&#1088;&#1056;&#1077;&#1045;&quot;]</em><br><em>eng_rusTranslateTable = dict(zip(engChars, rusChars))</em><br><em>rus_engTranslateTable = dict(zip(rusChars, engChars))</em></p>\n<p><em>logging.basicConfig(format = u'[LINE:%(lineno)d]# %(levelname)-8s [%(asctime)s] %(message)s', level = logging.NOTSET)</em><br> <br><em>def correctWord (w):</em><br><em> &quot;&quot;&quot; Corrects word by replacing characters with written similarly depending on which language the word. </em><br><em> Fraudsters use this technique to avoid detection by anti-fraud algorithms.&quot;&quot;&quot;</em></p>\n<p><em>if len(re.findall(ur&quot;[&#1072;-&#1103;]&quot;,w))&gt;len(re.findall(ur&quot;[a-z]&quot;,w)):</em><br><em> return w.translate(eng_rusTranslateTable)</em><br><em> else:</em><br><em> return w.translate(rus_engTranslateTable)</em></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51155,
      "author_name": "vasilyleksin",
      "author_url": "",
      "post_date": "07/24/2014 19:48:05",
      "content": "<p>[quote]</p>\n<p><em>engChars = [ord(char) for char in u&quot;cCyoOBaAKpPeE&quot;]</em><br><em>rusChars = [ord(char) for char in u&quot;&#1089;&#1057;&#1091;&#1086;&#1054;&#1042;&#1072;&#1040;&#1050;&#1088;&#1056;&#1077;&#1045;&quot;]</em></p>\n<p><em>[/quote]</em></p>\n<p><em>- this is&nbsp;<a href=\"https://en.wikipedia.org/wiki/Homoglyph\">homoglyphs</a>&nbsp;in english and russian layouts.&nbsp;</em></p>\n<p><em>[quote]</em></p>\n<p><em>if len(re.findall(ur&quot;[&#1072;-&#1103;]&quot;,w))&gt;len(re.findall(ur&quot;[a-z]&quot;,w)):</em></p>\n<p><em>...</em></p>\n<p>[/quote]</p>\n<p>- this is detection&nbsp;which language the word.</p>\n<p>The remaining lines are evident, IMHO...</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51168,
      "author_name": "parthibangowthaman",
      "author_url": "",
      "post_date": "07/25/2014 06:54:24",
      "content": "<p>[quote=Kevin Hu;50400]</p>\n<p>@Synthient</p>\n<p>Try to change a little bit on the alpha in the SGD classifier, and set correct words and stem to True, you will got 0.9.</p>\n<p>clf = SGDClassifier( loss=&quot;log&quot;, penalty=&quot;l2&quot;, alpha=1e-5, class_weight=&quot;auto&quot;)</p>\n<p>[/quote]</p>\n<p>Even after this change i cant able to get 0.89</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51169,
      "author_name": "parthibangowthaman",
      "author_url": "",
      "post_date": "07/25/2014 06:54:56",
      "content": "<p>still in 0.286</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51179,
      "author_name": "upulbandara",
      "author_url": "",
      "post_date": "07/25/2014 16:15:18",
      "content": "<p>[quote=Parthiban Gowthaman;51169]</p>\n<p>still in 0.286</p>\n<p>[/quote]</p>\n<p>Increase the number of iterations, using&nbsp;<strong>n_iter</strong>: parameter, additionally, changing the number of features also helpful.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51180,
      "author_name": "snisioi",
      "author_url": "",
      "post_date": "07/25/2014 17:06:43",
      "content": "<p>Double check if you are submitting the updated file created by the python script</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51255,
      "author_name": "novice7",
      "author_url": "",
      "post_date": "07/28/2014 06:39:23",
      "content": "<p>I am unable to reproduce 0.89 benchmark. The score was 0.37.</p>\n<p>I have made following changes:</p>\n<p><em>item = {featureName:featureValue.decode('utf-8') for featureName,featureValue in item.iteritems() if featureValue is not None}</em></p>\n<p>Changed the alpha value in SGD classifier to 1e-5, n_ter = 100</p>\n<p>Uncommented the 4 lines in main&nbsp;</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51285,
      "author_name": "jfkingiii",
      "author_url": "",
      "post_date": "07/29/2014 04:15:59",
      "content": "<p>I was getting the correct benchmark at first and then when I switched computers I started getting low values like 0.28. These only happened when I was running the code within Spyder, so it must have been using an old version of python or more likely loading outdated versions of the libraries. Make sure you have the most recent version of everything (by installing a distribution like Anaconda, for example) and then run the sample code directly from the command prompt rather than from an IDE.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51287,
      "author_name": "novice7",
      "author_url": "",
      "post_date": "07/29/2014 04:31:25",
      "content": "<p>[quote=James King;51285]</p>\n<p>I was getting the correct benchmark at first and then when I switched computers I started getting low values like 0.28. These only happened when I was running the code within Spyder, so it must have been using an old version of python or more likely loading outdated versions of the libraries. Make sure you have the most recent version of everything (by installing a distribution like Anaconda, for example) and then run the sample code directly from the command prompt rather than from an IDE.</p>\n<p>[/quote]</p>\n<p>When I executed the same code in Ubuntu platform, I&nbsp; am able to get 0.9. It might be that the libraries are outdated and older version of python.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51432,
      "author_name": "avanigoe",
      "author_url": "",
      "post_date": "07/31/2014 18:13:08",
      "content": "<p>My question is around the existing python code given to us and the benchmark of 0.89. How did people get it to run with the existing code: &quot;clf.fit(trainFeatures,trainTargets)&quot;</p>\n<p><code>I get this error:</code></p>\n\n<p><code>[LINE:159]# INFO [2014-07-31 17:08:40,598] Feature preparation done, fitting model...<br>Traceback (most recent call last):<br>File &quot;avito_ProhibitedContent_SampleCode.py&quot;, line 184, in &lt;module&gt;<br>main()<br>File &quot;avito_ProhibitedContent_SampleCode.py&quot;, line 165, in main<br>clf.fit(trainFeatures,trainTargets)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/base.py&quot;, line 430, in fit<br>self._fit_binary(X, y, sample_weight)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/stochastic_gradient.py&quot;, line 131, in _fit_binary<br>X = np.asarray(X, dtype=np.float64, order='C')<br>File &quot;/usr/lib/python2.7/dist-packages/numpy/core/numeric.py&quot;, line 235, in asarray<br>return array(a, dtype, copy=False, order=order)<br>ValueError: setting an array element with a sequence.</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51437,
      "author_name": "andreasmerentitis",
      "author_url": "",
      "post_date": "07/31/2014 20:37:11",
      "content": "<p>For those that had the ~0.30 result problem, how did you get around that?</p>\n<p>So far I have tried running the provided script in both Windows and Linux, with different versions of Anaconda environment (1.9 and 2.0) and all the latest updates. Results vary between 0.27 and 0.30 but not more.</p>\n<p>Has anyone been able to pinpoint if it is an issue with the feature calculation if you don't have specific library versions or if it is something in the model itself?</p>\n<p>Any specific versions of operating system and python libraries, etc. that work? Also have you installed the entire nltk or only the few parts required to run the script?</p>\n<p>Thanks,</p>\n<p>Andreas</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51451,
      "author_name": "avanigoe",
      "author_url": "",
      "post_date": "08/01/2014 05:38:04",
      "content": "<p>What version of scikit are you using ? I get error in the code below. Please help -&nbsp;</p>\n\n\n<p><code>self._fit_binary(X, y, sample_weight)<br>File &quot;/usr/lib/pymodules/python2.7/sklearn/linear_model/stochastic_gradient.py&quot;, line 131, in _fit_binary<br>X = np.asarray(X, dtype=np.float64, order='C')<br>File &quot;/usr/lib/python2.7/dist-packages/numpy/core/numeric.py&quot;, line 235, in asarray<br>return array(a, dtype, copy=False, order=order)<br>ValueError: setting an array element with a sequence.</code></p>\n\n<p><code>trainFeatures,trainTargets, trainItemIds=processData(os.path.join(dataFolder,&quot;avito_train.tsv&quot;), featureIndexes, itemsLimit=3000)<br> logging.info(&quot;Feature preparation done, fitting model...&quot;)<br> clf = SGDClassifier( loss=&quot;log&quot;,<br> penalty=&quot;l2&quot;,<br> alpha=1e-4,<br> class_weight=&quot;auto&quot;)<br>clf.fit(trainFeatures,trainTargets)<br>#clf.fit(trainFeatures.toarray(),trainTargets)</code></p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 51452,
      "author_name": "avanigoe",
      "author_url": "",
      "post_date": "08/01/2014 05:38:42",
      "content": "",
      "votes": null,
      "replies": []
    },
    {
      "id": 51506,
      "author_name": "avanigoe",
      "author_url": "",
      "post_date": "08/01/2014 22:03:15",
      "content": "<p>Resolved : I had an older version of scikit. Got 0.15 now and it all worked.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "50377": "",
    "50400": "",
    "50409": "",
    "50916": "",
    "50917": "",
    "51147": "",
    "51155": "",
    "51168": "",
    "51169": "",
    "51179": "",
    "51180": "",
    "51255": "",
    "51285": "",
    "51287": "",
    "51432": "",
    "51437": "",
    "51451": "",
    "51452": "",
    "51506": ""
  },
  "source": "meta"
}