{"id":2426,"date":"2023-07-22T07:58:40","date_gmt":"2023-07-22T07:58:40","guid":{"rendered":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/"},"modified":"2023-07-22T07:58:40","modified_gmt":"2023-07-22T07:58:40","slug":"plot-der-logistischen-regression-in-python","status":"publish","type":"post","link":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/","title":{"rendered":"So zeichnen sie eine logistische regressionskurve in python"},"content":{"rendered":"<p><\/p>\n<hr>\n<p><span style=\"color: #000000;\">Sie k\u00f6nnen die Funktion <a href=\"https:\/\/seaborn.pydata.org\/generated\/seaborn.regplot.html\" target=\"_blank\" rel=\"noopener\">regplot()<\/a> der Seaborn-Datenvisualisierungsbibliothek verwenden, um eine logistische Regressionskurve in Python zu zeichnen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008000;\">import<\/span> seaborn <span style=\"color: #008000;\">as<\/span> sns\n\nsns. <span style=\"color: #3366ff;\">regplot<\/span> (x=x, y=y, data=df, logistic= <span style=\"color: #008000;\">True<\/span> <span style=\"color: #008080;\"><span style=\"color: #000000;\">, ci= <span style=\"color: #008000;\">None<\/span> )<\/span><\/span>\n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Das folgende Beispiel zeigt, wie diese Syntax in der Praxis verwendet wird.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Beispiel: Zeichnen einer logistischen Regressionskurve in Python<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">F\u00fcr dieses Beispiel verwenden wir den <strong>Standarddatensatz<\/strong> aus dem <a href=\"https:\/\/www.statlearning.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Buch Introduction to Statistical Learning<\/a> . Mit dem folgenden Code k\u00f6nnen wir eine Zusammenfassung des Datensatzes laden und anzeigen:<\/span><\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#import dataset from CSV file on Github\n<span style=\"color: #000000;\">url = \"https:\/\/raw.githubusercontent.com\/Statorials\/Python-Guides\/main\/default.csv\"\ndata = pd. <span style=\"color: #3366ff;\">read_csv<\/span> (url)\n<\/span><\/span>\n<span style=\"color: #008080;\">#view first six rows of dataset\n<\/span>data[0:6]\n\n        default student balance income\n0 0 0 729.526495 44361.625074\n1 0 1 817.180407 12106.134700\n2 0 0 1073.549164 31767.138947\n3 0 0 529.250605 35704.493935\n4 0 0 785.655883 38463.495879\n5 0 1 919.588530 7491.558572  \n<\/strong><\/pre>\n<p> <span style=\"color: #000000;\">Dieser Datensatz enth\u00e4lt die folgenden Informationen zu 10.000 Personen:<\/span><\/p>\n<ul>\n<li> <span style=\"color: #000000;\"><strong>Standard:<\/strong> Gibt an, ob eine Person in Verzug geraten ist oder nicht.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Student:<\/strong> gibt an, ob eine Person Student ist oder nicht.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Guthaben:<\/strong> Durchschnittliches Guthaben einer Person.<\/span><\/li>\n<li> <span style=\"color: #000000;\"><strong>Einkommen:<\/strong> Einkommen des Einzelnen.<\/span><\/li>\n<\/ul>\n<p> <span style=\"color: #000000;\">Angenommen, wir m\u00f6chten ein logistisches Regressionsmodell erstellen, das \u201eBalance\u201c verwendet, um die Wahrscheinlichkeit vorherzusagen, dass eine bestimmte Person zahlungsunf\u00e4hig wird.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Mit dem folgenden Code k\u00f6nnen wir eine logistische Regressionskurve zeichnen:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define the predictor variable and the response variable\n<span style=\"color: #000000;\">x = data[' <span style=\"color: #ff0000;\">balance<\/span> ']\ny = data[' <span style=\"color: #ff0000;\">default<\/span> ']<\/span>\n\n#plot logistic regression curve\n<span style=\"color: #000000;\">sns. <span style=\"color: #3366ff;\">regplot<\/span> (x=x, y=y, data=data, logistic= <span style=\"color: #008000;\">True<\/span> , ci= <span style=\"color: #008000;\">None<\/span> )<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-21793 aligncenter\" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/regplot1.png\" alt=\"\" width=\"540\" height=\"358\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">Die x-Achse zeigt die Werte der Pr\u00e4diktorvariablen \u201eBalance\u201c und die y-Achse zeigt die prognostizierte Ausfallwahrscheinlichkeit.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Wir k\u00f6nnen deutlich erkennen, dass h\u00f6here Gleichgewichtswerte mit h\u00f6heren Wahrscheinlichkeiten f\u00fcr einen Zahlungsausfall einer Person verbunden sind.<\/span><\/p>\n<p> <span style=\"color: #000000;\">Beachten Sie, dass Sie auch <strong>\u201escatter_kws\u201c<\/strong> und <strong>\u201eline_kws\u201c<\/strong> verwenden k\u00f6nnen, um die Farben der Punkte und der Kurve im Diagramm zu \u00e4ndern:<\/span> <\/p>\n<pre style=\"background-color: #ececec; font-size: 15px;\"> <strong><span style=\"color: #008080;\">#define the predictor variable and the response variable\n<span style=\"color: #000000;\">x = data[' <span style=\"color: #ff0000;\">balance<\/span> ']\ny = data[' <span style=\"color: #ff0000;\">default<\/span> ']<\/span>\n\n#plot logistic regression curve with black points and red line\n<span style=\"color: #000000;\">sns. <span style=\"color: #3366ff;\">regplot<\/span> (x=x, y=y, data=data, logistic= <span style=\"color: #008000;\">True<\/span> , ci= <span style=\"color: #008000;\">None<\/span> ),\n            scatter_kws={' <span style=\"color: #ff0000;\">color<\/span> ': ' <span style=\"color: #ff0000;\">black<\/span> '}, line_kws={' <span style=\"color: #ff0000;\">color<\/span> ': ' <span style=\"color: #ff0000;\">red<\/span> '})<\/span><\/span><\/strong> <\/pre>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-21794 \" src=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/regplot2.png\" alt=\"Logistische Regressionskurve in Python\" width=\"544\" height=\"363\" srcset=\"\" sizes=\"\"><\/p>\n<p> <span style=\"color: #000000;\">F\u00fchlen Sie sich frei, die Farben zu w\u00e4hlen, die Sie im Plot haben m\u00f6chten.<\/span><\/p>\n<h3> <span style=\"color: #000000;\"><strong>Zus\u00e4tzliche Ressourcen<\/strong><\/span><\/h3>\n<p> <span style=\"color: #000000;\">Die folgenden Tutorials bieten zus\u00e4tzliche Informationen zur logistischen Regression:<\/span><\/p>\n<p> <a href=\"https:\/\/statorials.org\/de\/logistische-regression-1\/\" target=\"_blank\" rel=\"noopener\">Einf\u00fchrung in die logistische Regression<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/so-melden-sie-logistische-regressionsergebnisse\/\" target=\"_blank\" rel=\"noopener\">So melden Sie Ergebnisse der logistischen Regression<\/a><br \/> <a href=\"https:\/\/statorials.org\/de\/logistische-regressionspython\/\" target=\"_blank\" rel=\"noopener\">So f\u00fchren Sie eine logistische Regression in Python durch (Schritt f\u00fcr Schritt)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sie k\u00f6nnen die Funktion regplot() der Seaborn-Datenvisualisierungsbibliothek verwenden, um eine logistische Regressionskurve in Python zu zeichnen: import seaborn as sns sns. regplot (x=x, y=y, data=df, logistic= True , ci= None ) Das folgende Beispiel zeigt, wie diese Syntax in der Praxis verwendet wird. Beispiel: Zeichnen einer logistischen Regressionskurve in Python F\u00fcr dieses Beispiel verwenden wir [&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":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>So zeichnen Sie eine logistische Regressionskurve in Python - Statorials<\/title>\n<meta name=\"description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.\" \/>\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\/de\/plot-der-logistischen-regression-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"So zeichnen Sie eine logistische Regressionskurve in Python - Statorials\" \/>\n<meta property=\"og:description\" content=\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Statorials\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-22T07:58:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/regplot1.png\" \/>\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=\"2 Minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/\",\"url\":\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/\",\"name\":\"So zeichnen Sie eine logistische Regressionskurve in Python - Statorials\",\"isPartOf\":{\"@id\":\"https:\/\/statorials.org\/de\/#website\"},\"datePublished\":\"2023-07-22T07:58:40+00:00\",\"dateModified\":\"2023-07-22T07:58:40+00:00\",\"author\":{\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\"},\"description\":\"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.\",\"breadcrumb\":{\"@id\":\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/#breadcrumb\"},\"inLanguage\":\"de-DE\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Heim\",\"item\":\"https:\/\/statorials.org\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"So zeichnen sie eine logistische regressionskurve in python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statorials.org\/de\/#website\",\"url\":\"https:\/\/statorials.org\/de\/\",\"name\":\"Statorials\",\"description\":\"Ihr Leitfaden f\u00fcr statistische Kompetenz !\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statorials.org\/de\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de-DE\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0\",\"name\":\"Dr. Benjamin Anderson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de-DE\",\"@id\":\"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"contentUrl\":\"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg\",\"caption\":\"Dr. Benjamin Anderson\"},\"description\":\"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen\",\"sameAs\":[\"https:\/\/statorials.org\/de\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"So zeichnen Sie eine logistische Regressionskurve in Python - Statorials","description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.","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\/de\/plot-der-logistischen-regression-in-python\/","og_locale":"de_DE","og_type":"article","og_title":"So zeichnen Sie eine logistische Regressionskurve in Python - Statorials","og_description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.","og_url":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/","og_site_name":"Statorials","article_published_time":"2023-07-22T07:58:40+00:00","og_image":[{"url":"https:\/\/statorials.org\/wp-content\/uploads\/2023\/08\/regplot1.png"}],"author":"Dr. Benjamin Anderson","twitter_card":"summary_large_image","twitter_misc":{"Verfasst von":"Dr. Benjamin Anderson","Gesch\u00e4tzte Lesezeit":"2 Minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/","url":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/","name":"So zeichnen Sie eine logistische Regressionskurve in Python - Statorials","isPartOf":{"@id":"https:\/\/statorials.org\/de\/#website"},"datePublished":"2023-07-22T07:58:40+00:00","dateModified":"2023-07-22T07:58:40+00:00","author":{"@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0"},"description":"In diesem Tutorial wird anhand eines Beispiels erl\u00e4utert, wie Sie eine logistische Regressionskurve in Python zeichnen.","breadcrumb":{"@id":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/#breadcrumb"},"inLanguage":"de-DE","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statorials.org\/de\/plot-der-logistischen-regression-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Heim","item":"https:\/\/statorials.org\/de\/"},{"@type":"ListItem","position":2,"name":"So zeichnen sie eine logistische regressionskurve in python"}]},{"@type":"WebSite","@id":"https:\/\/statorials.org\/de\/#website","url":"https:\/\/statorials.org\/de\/","name":"Statorials","description":"Ihr Leitfaden f\u00fcr statistische Kompetenz !","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statorials.org\/de\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de-DE"},{"@type":"Person","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/ec75c4d6365f2708f8a0ad3a42121aa0","name":"Dr. Benjamin Anderson","image":{"@type":"ImageObject","inLanguage":"de-DE","@id":"https:\/\/statorials.org\/de\/#\/schema\/person\/image\/","url":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","contentUrl":"https:\/\/statorials.org\/de\/wp-content\/uploads\/2023\/11\/Benjamin-Anderson-96x96.jpg","caption":"Dr. Benjamin Anderson"},"description":"Hallo, ich bin Benjamin, ein pensionierter Statistikprofessor, der sich zum engagierten Statorials-Lehrer entwickelt hat. Mit umfassender Erfahrung und Fachwissen auf dem Gebiet der Statistik bin ich bestrebt, mein Wissen zu teilen, um Studenten durch Statorials zu bef\u00e4higen. Mehr wissen","sameAs":["https:\/\/statorials.org\/de"]}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/2426"}],"collection":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/comments?post=2426"}],"version-history":[{"count":0,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/posts\/2426\/revisions"}],"wp:attachment":[{"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/media?parent=2426"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/categories?post=2426"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/statorials.org\/de\/wp-json\/wp\/v2\/tags?post=2426"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}