<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>scikit-learn Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/scikit-learn/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/scikit-learn/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Thu, 15 May 2025 10:26:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Data Science Datasets: Iris flower data set</title>
		<link>https://creatronix.de/data-science-datasets-iris-flower-data-set/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Wed, 25 Apr 2018 08:55:12 +0000</pubDate>
				<category><![CDATA[Data Science & SQL]]></category>
		<category><![CDATA[data science]]></category>
		<category><![CDATA[iris flower data set]]></category>
		<category><![CDATA[scikit-learn]]></category>
		<category><![CDATA[sklearn]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=1373</guid>

					<description><![CDATA[<p>Motivation When you are going to learn some data science the aquisition of data is often the first step. To get you started scikit-learn comes with a bunch of so called &#8220;toy datasets&#8221;. One of them is the Iris dataset. Prerequisites &#38; Imports Besides scikit-learn we will use pandas for data handling and matplotlib with&#8230;</p>
<p>The post <a href="https://creatronix.de/data-science-datasets-iris-flower-data-set/">Data Science Datasets: Iris flower data set</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Motivation</h2>
<p>When you are going to learn some data science the aquisition of data is often the first step.</p>
<p>To get you started scikit-learn comes with a bunch of so called &#8220;toy datasets&#8221;. One of them is the Iris dataset.</p>
<h2>Prerequisites &amp; Imports</h2>
<p>Besides scikit-learn we will use <a href="https://creatronix.de/introduction-to-pandas/">pandas</a> for data handling and <a href="https://creatronix.de/introduction-to-matplotlib/">matplotlib</a> with seaborn for visualization. So let&#8217;s install them:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>pip install scikit-learn pandas seaborn matplotlib</code></pre>
</div>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>from sklearn import datasets
import seaborn as sns
import pandas as pd
sns.set_palette('husl')
import matplotlib.pyplot as plt
%matplotlib inline</code></pre>
</div>
<h2>Iris data set</h2>
<p>The Iris flower data set or Fisher&#8217;s Iris data set became a typical test case for many statistical classification techniques in machine learning such as support vector machines.</p>
<p>It is sometimes called Anderson&#8217;s <i>Iris</i> data set because Edgar Anderson collected the data to quantify the morphological variation of <i>Iris</i> flowers of three related species.</p>
<p>This data set can be imported from scikit-learn like the following:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>iris = datasets.load_iris() 
</code></pre>
</div>
<div>
<h2>Convert to Pandas Dataframe</h2>
</div>
<p>To work with the dataset we convert it into a pandas dataframe.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>df = pd.DataFrame(
    iris['data'],
    columns=iris['feature_names']
)
df['species'] = iris['target']
df['species'] = df['species'].map({
    0 : 'Iris-setosa',
    1 : 'Iris-versicolor',
    2 : 'Iris-virginica'
})</code></pre>
</div>
<div>
<h2>Data visualization</h2>
<p>Seaborn has a nice way to visualize data for exploration with the pariplot function.</p>
<p>It takes every feature and compares it pairwise with every other feature</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>g = sns.pairplot(df, hue='species', markers='+')
plt.show()</code></pre>
</div>
</div>
<h2><img fetchpriority="high" decoding="async" src="https://creatronix.de/wp-content/uploads/2018/04/iris_sns_pairplot-1024x888.png" alt="" class="alignnone size-large wp-image-5972" width="1024" height="888" srcset="https://creatronix.de/wp-content/uploads/2018/04/iris_sns_pairplot-1024x888.png 1024w, https://creatronix.de/wp-content/uploads/2018/04/iris_sns_pairplot-300x260.png 300w, https://creatronix.de/wp-content/uploads/2018/04/iris_sns_pairplot-768x666.png 768w, https://creatronix.de/wp-content/uploads/2018/04/iris_sns_pairplot.png 1137w" sizes="(max-width: 1024px) 100vw, 1024px" /></h2>
<h2>Further Reading</h2>
<p><a href="https://scikit-learn.org/stable/datasets/toy_dataset.html#iris-plants-dataset">https://scikit-learn.org/stable/datasets/toy_dataset.html#iris-plants-dataset</a></p>
<p><a href="https://www.kaggle.com/code/jchen2186/machine-learning-with-iris-dataset">https://www.kaggle.com/code/jchen2186/machine-learning-with-iris-dataset</a></p>
<p><a href="https://creatronix.de/introduction-to-jupyter-notebook/">Introduction to Jupyter Notebook</a></p>
<p><a href="https://creatronix.de/introduction-to-pandas/">Introduction to Pandas</a></p>
<p><a href="https://creatronix.de/pandas-cheat-sheet/">Pandas Cheat Sheet</a></p>
<p><a href="https://creatronix.de/introduction-to-matplotlib/">Introduction to matplotlib</a></p>
<p>The post <a href="https://creatronix.de/data-science-datasets-iris-flower-data-set/">Data Science Datasets: Iris flower data set</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
