{"id":1768,"date":"2020-07-13T22:20:21","date_gmt":"2020-07-13T22:20:21","guid":{"rendered":"http:\/\/optimumsportsperformance.com\/blog\/?p=1768"},"modified":"2022-11-08T03:40:10","modified_gmt":"2022-11-08T03:40:10","slug":"python-tips-tricks-random-forest-classifier-for-tidyx-episode-18","status":"publish","type":"post","link":"https:\/\/optimumsportsperformance.com\/blog\/python-tips-tricks-random-forest-classifier-for-tidyx-episode-18\/","title":{"rendered":"Python Tips &#038; Tricks: Random Forest Classifier for TidyX Episode 18"},"content":{"rendered":"<p>As a means of working on improving some of my Python skills, I decided I&#8217;ll attempt to re-create different elements from some of our <span style=\"color: #0000ff;\"><strong><a style=\"color: #0000ff;\" href=\"https:\/\/www.youtube.com\/channel\/UCP8l94xtoemCH_GxByvTuFQ\/videos\">TidyX Screen Casts<\/a><\/strong><\/span>.<\/p>\n<p>This past week, we did an episode on building a random forest classifier for coffee ratings (<strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/optimumsportsperformance.com\/blog\/tidyx-episode-18-random-forests\/\">CLICK HERE<\/a><\/span><\/strong>). I&#8217;ve recreated almost all of the steps that we did in R in Python Code.<\/p>\n<p><strong>1) Loading the data from the <span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/rfordatascience\/tidytuesday\">TidyTuesday github page<\/a>.<\/span><\/strong><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1769\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM-1024x655.png\" alt=\"\" width=\"594\" height=\"380\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM-1024x655.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM-300x192.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM-768x491.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.12.18-PM-624x399.png 624w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><\/a><\/p>\n<p><strong>2) Data pre-processing<\/strong><\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1770\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM-1024x659.png\" alt=\"\" width=\"625\" height=\"402\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM-1024x659.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM-300x193.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM-768x495.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.13.15-PM-624x402.png 624w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p><strong>3) Exploratory data analysis<\/strong><\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1771\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM-1024x821.png\" alt=\"\" width=\"625\" height=\"501\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM-1024x821.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM-300x241.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM-768x616.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM-624x500.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.14.23-PM.png 1776w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p><strong>4) Random Forest classifier development and model testing<\/strong><\/p>\n<p><a href=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-1772\" src=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM-1024x748.png\" alt=\"\" width=\"625\" height=\"457\" srcset=\"https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM-1024x748.png 1024w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM-300x219.png 300w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM-768x561.png 768w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM-624x456.png 624w, https:\/\/optimumsportsperformance.com\/blog\/wp-content\/uploads\/2020\/07\/Screen-Shot-2020-07-13-at-3.15.21-PM.png 1982w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>You can access the full Jupyter Notebook on my <strong><span style=\"color: #0000ff;\"><a style=\"color: #0000ff;\" href=\"https:\/\/github.com\/pw2\/Python-Tips-and-Tricks\/blob\/master\/TidyTues_Python_Random%20Forest.ipynb\">GITHUB page<\/a><\/span><\/strong>. I&#8217;m still trying to get the hang of Python so if there are any <em>Pythonistas <\/em>out there that have feedback or see errors in my code, I&#8217;m all ears!<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a means of working on improving some of my Python skills, I decided I&#8217;ll attempt to re-create different elements from some of our TidyX Screen Casts. This past week, we did an episode on building a random forest classifier for coffee ratings (CLICK HERE). I&#8217;ve recreated almost all of the steps that we did [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48,46],"tags":[],"class_list":["post-1768","post","type-post","status-publish","format-standard","hentry","category-model-building-in-python","category-python-tips-tricks"],"_links":{"self":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1768","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/comments?post=1768"}],"version-history":[{"count":3,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1768\/revisions"}],"predecessor-version":[{"id":1775,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/posts\/1768\/revisions\/1775"}],"wp:attachment":[{"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/media?parent=1768"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/categories?post=1768"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/optimumsportsperformance.com\/blog\/wp-json\/wp\/v2\/tags?post=1768"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}