Title: TypeError: unsupported operand type(s) for +: 'int' and 'str' · Issue #21 · luispedro/BuildingMachineLearningSystemsWithPython · GitHub
Open Graph Title: TypeError: unsupported operand type(s) for +: 'int' and 'str' · Issue #21 · luispedro/BuildingMachineLearningSystemsWithPython
X Title: TypeError: unsupported operand type(s) for +: 'int' and 'str' · Issue #21 · luispedro/BuildingMachineLearningSystemsWithPython
Description: I see the following error when running ch04/blei_lda.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last)
Open Graph Description: I see the following error when running ch04/blei_lda.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) X Description: I see the following error when running ch04/blei_lda.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-2-5...
Opengraph URL: https://github.com/luispedro/BuildingMachineLearningSystemsWithPython/issues/21
X: @github
Domain: github.com
Links:
Viewport: width=device-width
Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeError: unsupported operand type(s) for +: 'int' and 'str'","articleBody":"I see the following error when running [ch04/blei_lda.py](https://github.com/luispedro/BuildingMachineLearningSystemsWithPython/blob/master/ch04/blei_lda.py)\r\n```\r\n---------------------------------------------------------------------------\r\nTypeError Traceback (most recent call last)\r\n\u003cipython-input-2-5511c9e27cd2\u003e in \u003cmodule\u003e()\r\n 37 for ti in range(model.num_topics):\r\n 38 words = model.show_topic(ti, 64)\r\n---\u003e 39 tf = sum(f for f, w in words)\r\n 40 with open('topics.txt', 'w') as output:\r\n 41 output.write('\\n'.join('{}:{}'.format(w, int(1000. * f / tf)) for f, w in words))\r\n\r\nTypeError: unsupported operand type(s) for +: 'int' and 'str'\r\n\r\n```\r\n\r\nI think, since the frequency, f, and word, w, are the opposite on words, did you want to write **w, f in words** instead, as in the following?\r\n```\r\n 39 tf = sum(f for w, f in words)\r\n 40 with open('topics.txt', 'w') as output:\r\n 41 output.write('\\n'.join('{}:{}'.format(w, int(1000. * f / tf)) for w, f in words))\r\n```","author":{"url":"https://github.com/masayas","@type":"Person","name":"masayas"},"datePublished":"2017-03-12T02:37:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/21/BuildingMachineLearningSystemsWithPython/issues/21"}
route-pattern /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) route-controller voltron_issues_fragments route-action issue_layout fetch-nonce v2:f70b811d-012a-1293-c9cd-24345674d85d current-catalog-service-hash 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 request-id 8E44:272909:5CCB4B:78BC78:696B713D html-safe-nonce 8515613ca9d5d858a16dd6c7470073a860edda05f0f1729c0a9e3691c87d9b6d visitor-payload eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RTQ0OjI3MjkwOTo1Q0NCNEI6NzhCQzc4OjY5NkI3MTNEIiwidmlzaXRvcl9pZCI6Ijc2NTcwODM5MjM0NjM4OTMzMDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== visitor-hmac 4d450bcadbeedc7329aced173c5ec2604f94f69c5b6ac99c7b175c7fa534010f hovercard-subject-tag issue:213576284 github-keyboard-shortcuts repository,issues,copilot google-site-verification Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I octolytics-url https://collector.github.com/github/collect analytics-location / fb:app_id 1401488693436528 apple-itunes-app app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/luispedro/BuildingMachineLearningSystemsWithPython/21/issue_layout twitter:image https://opengraph.githubassets.com/8d9119f355c716eb39a36e09fe772a9781e39003798bcc9b5de624dfcc720612/luispedro/BuildingMachineLearningSystemsWithPython/issues/21 twitter:card summary_large_image og:image https://opengraph.githubassets.com/8d9119f355c716eb39a36e09fe772a9781e39003798bcc9b5de624dfcc720612/luispedro/BuildingMachineLearningSystemsWithPython/issues/21 og:image:alt I see the following error when running ch04/blei_lda.py --------------------------------------------------------------------------- TypeError Traceback (most recent call last) og:image:width 1200 og:image:height 600 og:site_name GitHub og:type object og:author:username masayas hostname github.com expected-hostname github.com None 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d turbo-cache-control no-preview go-import github.com/luispedro/BuildingMachineLearningSystemsWithPython git https://github.com/luispedro/BuildingMachineLearningSystemsWithPython.git octolytics-dimension-user_id 79334 octolytics-dimension-user_login luispedro octolytics-dimension-repository_id 13086750 octolytics-dimension-repository_nwo luispedro/BuildingMachineLearningSystemsWithPython octolytics-dimension-repository_public true octolytics-dimension-repository_is_fork false octolytics-dimension-repository_network_root_id 13086750 octolytics-dimension-repository_network_root_nwo luispedro/BuildingMachineLearningSystemsWithPython turbo-body-classes logged-out env-production page-responsive disable-turbo false browser-stats-url https://api.github.com/_private/browser/stats browser-errors-url https://api.github.com/_private/browser/errors release 82560a55c6b2054555076f46e683151ee28a19bc ui-target full theme-color #1e2327 color-scheme light dark
URLs of crawlers that visited me.