{"id":835,"date":"2023-07-28T14:34:33","date_gmt":"2023-07-28T14:34:33","guid":{"rendered":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/"},"modified":"2023-07-28T14:34:33","modified_gmt":"2023-07-28T14:34:33","slug":"betekent-vierkante-fout-python","status":"publish","type":"post","link":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/","title":{"rendered":"Hoe de gemiddelde kwadratische fout (mse) in python te berekenen"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\"><strong>Mean Squared Error (MSE)<\/strong> is een gebruikelijke manier om de voorspellingsnauwkeurigheid van een model te meten. Het wordt als volgt berekend:<\/span><\/p>\n<p> <span style=\"color: #000000;\"><strong>MSE<\/strong> = (1\/n) * \u03a3(werkelijk \u2013 voorspelling) <sup>2<\/sup><\/span><\/p>\n<p> <span style=\"color: #000000;\">Goud:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>\u03a3<\/strong> \u2013 een mooi symbool dat \u2018som\u2019 betekent<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>n<\/strong> \u2013 steekproefomvang<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>real<\/strong> \u2013 de werkelijke waarde van de gegevens<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>voorspelling<\/strong> \u2013 de waarde van de voorspelde gegevens<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Hoe lager de MSE-waarde, hoe nauwkeuriger een model waarden kan voorspellen.<\/span><\/p>\n<h3> <strong><span style=\"color: #000000;\">Hoe MSE in Python te berekenen<\/span><\/strong><\/h3>\n<p> <span style=\"color: #000000;\">We kunnen een eenvoudige functie maken om MSE in Python te berekenen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">import<\/span> numpy <span style=\"color: #107d3f;\">as<\/span> np\n<span style=\"color: #107d3f;\">\ndef<\/span> mse(actual, pred): \n    actual, pred = np.array(actual), np.array(pred)\n    <span style=\"color: #107d3f;\">return<\/span> np.square(np.subtract(actual,pred)).mean() \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">We kunnen deze functie vervolgens gebruiken om de MSE voor twee tabellen te berekenen: een die de werkelijke gegevenswaarden bevat en een die de voorspelde gegevenswaarden bevat.<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>actual = [12, 13, 14, 15, 15, 22, 27]\npred = [11, 13, 14, 14, 15, 16, 18]\n\nmse(actual, pred)\n\n17.0<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De gemiddelde kwadratische fout (MSE) van dit model blijkt <strong>17,0<\/strong> te zijn.<\/span><\/p>\n<p> <span style=\"color: #000000;\">In de praktijk wordt <strong>de root mean square error (RMSE)<\/strong> vaker gebruikt om de nauwkeurigheid van het model te evalueren. Zoals de naam al doet vermoeden, is het eenvoudigweg de vierkantswortel van de gemiddelde kwadratische fout.<\/span><\/p>\n<p> <span style=\"color: #000000;\">We kunnen een soortgelijke functie defini\u00ebren om de RMSE te berekenen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #107d3f;\">import<\/span> numpy <span style=\"color: #107d3f;\">as<\/span> np\n<span style=\"color: #107d3f;\">\ndef<\/span> rmse(actual, pred): \n    actual, pred = np.array(actual), np.array(pred)\n    <span style=\"color: #107d3f;\">return<\/span> np.sqrt(np.square(np.subtract(actual,pred)).mean())\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">We kunnen deze functie vervolgens gebruiken om de RMSE voor twee tabellen te berekenen: \u00e9\u00e9n die de werkelijke gegevenswaarden bevat en \u00e9\u00e9n die de voorspelde gegevenswaarden bevat.<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong>actual = [12, 13, 14, 15, 15, 22, 27]\npred = [11, 13, 14, 14, 15, 16, 18]\n\nrmse(actual, pred)\n\n4.1231<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">De root mean square error (RMSE) van dit model blijkt <strong>4,1231<\/strong> te zijn.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Aanvullende bronnen<\/strong><\/span><\/h3>\n<p> <a href=\"https:\/\/statorials.org\/nl\/mse-rekenmachine\/\">Rekenmachine voor de gemiddelde kwadratische fout (MSE).<\/a><br \/> <a href=\"https:\/\/statorials.org\/nl\/hoe-de-gemiddelde-vierkante-mse-fout-in-excel-te-berekenen\/\">Hoe de gemiddelde vierkante fout (MSE) in Excel te berekenen<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mean Squared Error (MSE) is een gebruikelijke manier om de voorspellingsnauwkeurigheid van een model te meten. Het wordt als volgt berekend: MSE = (1\/n) * \u03a3(werkelijk \u2013 voorspelling) 2 Goud: \u03a3 \u2013 een mooi symbool dat \u2018som\u2019 betekent n \u2013 steekproefomvang real \u2013 de werkelijke waarde van de gegevens voorspelling \u2013 de waarde van de [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-835","post","type-post","status-publish","format-standard","hentry","category-gids"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials<\/title>\n<meta name=\"description\" content=\"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials\" \/>\n<meta property=\"og:description\" content=\"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-28T14:34:33+00:00\" \/>\n<meta name=\"author\" content=\"Dr.benjamin anderson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dr.benjamin anderson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u00a0Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/\",\"url\":\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/\",\"name\":\"Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/nl\/#website\"},\"datePublished\":\"2023-07-28T14:34:33+00:00\",\"dateModified\":\"2023-07-28T14:34:33+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\"},\"description\":\"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Thuis\",\"item\":\"https:\/\/statorials.org\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Hoe de gemiddelde kwadratische fout (mse) in python te berekenen\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/nl\/#website\",\"url\":\"https:\/\/statorials.org\/nl\/\",\"name\":\"Statorials\",\"description\":\"Uw gids voor statistische competentie\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/nl\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219\",\"name\":\"Dr.benjamin anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr.benjamin anderson\"},\"description\":\"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder\",\"sameAs\":[\"http:\/\/statorials.org\/nl\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials","description":"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/","og_locale":"de_DE","og_type":"article","og_title":"Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials","og_description":"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.","og_url":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/","og_site_name":"Statorials","article_published_time":"2023-07-28T14:34:33+00:00","author":"Dr.benjamin anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr.benjamin anderson","Gesch\u00e4tzte Lesezeit":"1\u00a0Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/","url":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/","name":"Hoe de gemiddelde kwadratische fout (MSE) in Python te berekenen - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/nl\/#website"},"datePublished":"2023-07-28T14:34:33+00:00","dateModified":"2023-07-28T14:34:33+00:00","author":{"@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219"},"description":"Een eenvoudige uitleg over het berekenen van de gemiddelde kwadratische fout in Python.","breadcrumb":{"@id":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/nl\/betekent-vierkante-fout-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Thuis","item":"https:\/\/statorials.org\/nl\/"},{"@type":"ListItem","position":2,"name":"Hoe de gemiddelde kwadratische fout (mse) in python te berekenen"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/nl\/#website","url":"https:\/\/statorials.org\/nl\/","name":"Statorials","description":"Uw gids voor statistische competentie","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/nl\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/d4b8842173cca1bb62cdec41860e4219","name":"Dr.benjamin anderson","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/statorials.org\/nl\/#\/schema\/person\/image\/","url":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","contentUrl":"http:\/\/statorials.org\/nl\/wp-content\/uploads\/2023\/10\/Dr.-Benjamin-Anderson-96x96.jpg","caption":"Dr.benjamin anderson"},"description":"Ik ben Benjamin, een gepensioneerde hoogleraar statistiek die nu een toegewijde Statorials-lesgever is. Ik heb uitgebreide ervaring en expertise op het gebied van statistiek en ik ben vastbesloten om mijn kennis te delen met studenten via Statorials. Lees verder","sameAs":["http:\/\/statorials.org\/nl"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/comments?post=835"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/posts\/835\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/media?parent=835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/categories?post=835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/nl\/wp-json\/wp\/v2\/tags?post=835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}