<jupyter_start><jupyter_text>Data Loading Get some data to play with<jupyter_code>from sklearn.datasets import fetch_openml
blood = fetch_openml('blood-transfusion-service-center')
print(blood.DESCR)
blood.data.shape
blood.data
import pandas as pd
X = pd.DataFrame(blood.data, columns=['recency', 'frequency', 'total_amount', 'since_first'])
blood.target.shape
blood.target
y = pd.Series(blood.target)
y.value_counts()
import matplotlib.pyplot as plt
pd.plotting.scatter_matrix(X, c=y=='2', cmap='Paired', figsize=(10, 10));<jupyter_output><empty_output><jupyter_text>**Data is always a numpy array (or sparse matrix) of shape (n_samples, n_features)** Split the data to get going<jupyter_code>from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y)
X.shape
X_train.shape
X_test.shape<jupyter_output><empty_output><jupyter_text>Exercises Excercise 1Load the iris dataset from the ``sklearn.datasets`` module using the ``load_iris`` function.The function returns a dictionary-like object that has the same attributes as ``blood``.What is the number of classes, features and data points in this dataset?Use a scatterplot to visualize the dataset.You can look at ``DESCR`` attribute to learn more about the dataset.``print(iris.DESCR)``Split the data into training and test set. Exercise 2Usually data doesn't come in that nice a format. You can find the csv file that contains the iris dataset at the following path:```pythonimport sklearn.datasetsimport osiris_path = os.path.join(sklearn.datasets.__path__[0], 'data', 'iris.csv')```Load the data from there using pandas ``pd.read_csv`` method and bring it into the same format as before with the data in a variable X and the labels in a variable y. The first few lines of ``iris.csv`` file looks like:```150,4,setosa,versicolor,virginica5.1,3.5,1.4,0.2,04.9,3.0,1.4,0.2,04.7,3.2,1.3,0.2,04.6,3.1,1.5,0.2,0```  http://github.com/amueller/ml-workshop-1-of-4<jupyter_code># %load solutions/load_iris.py<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11750245821042281, 'fraction_numerical': 0.024582104228121928, 'mean_word_length': 6.320143884892087, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '141412', 'license': 'MIT', 'n_tokens_mistral': 721, 'n_tokens_neox': 684, 'n_words': 204, 'path': 'notebooks/01 - Data Loading.ipynb', 'repo_name': 'snowdj/ml-workshop-1-of-4', 'size': '2034'}