<jupyter_start><jupyter_text>Agenda- Traditional Programming vs ML- Types of Machine Learning     - Supervised Learning         - Unsupervised Learning        - Reinforcement Learning    - Learning problem definition and formalization  Traditional Programming vs ML  [Image Source](https://github.com/rasbt/stat479-machine-learning-fs19/blob/master/01_overview/01-ml-overview__notes.pdf) A More formal definition of ML: > A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E. (<NAME>)  [Image Source](http://adilmoujahid.com/posts/2016/06/introduction-deep-learning-python-caffe/?utm_content=buffer82f2c&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer) E: Collected and labeled dataset of dogs and catsT: To classify whether a photo has a cat or dogP: Accuracy of the classification [Your Turn!](https://forms.gle/2RwC8opUi6bDVpER6)  Types of Machine Learning   Supervised Learning [Image Source](https://python.astrotech.io/_images/iris-dataset.png)<jupyter_code>import numpy as np

import pandas as pd

from sklearn.datasets import load_iris

data,target = load_iris(return_X_y=True, as_frame= True)

iris_df = pd.concat([data,target], axis = 1,)

iris_df.loc[99]<jupyter_output><empty_output><jupyter_text>Unsupervised Learning__Clustering__<jupyter_code>from sklearn.datasets import load_iris

data_np = load_iris()["data"]

feature_names = load_iris()['feature_names']
pd.DataFrame(data = data, columns= feature_names)<jupyter_output><empty_output><jupyter_text>[Image Source](https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/) __Dimension Reduction__ [Image Source](https://scikit-learn.org/stable/auto_examples/manifold/plot_lle_digits.html)<jupyter_code>from sklearn import datasets
import matplotlib.pyplot as plt
digits = datasets.load_digits(n_class=6)
num = np.random.randint(0, 1000)

img = digits.data[num]

plt.imshow(img.reshape(8,8), cmap ="gray" )

print(img, digits.target[num])<jupyter_output>[ 0.  0.  6. 16. 15.  5.  0.  0.  0.  1. 16. 14.  8. 15.  1.  0.  0.  9.
 13.  1.  0. 12.  6.  0.  0.  5.  9.  0.  0.  9. 10.  0.  0.  6.  9.  0.
  0.  9. 11.  0.  0.  7. 16.  1.  0. 11. 11.  0.  0.  3. 16. 11. 13. 16.
  8.  0.  0.  0.  8. 16. 16. 12.  1.  0.] 0<jupyter_text>__Anomally Detection__ [Image Source](https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/)  Reinforcement Learning [Types of ML](https://forms.gle/twHHWvgNk5QhMsEs7)  Building ML Systems [Image Source](https://github.com/rasbt/stat479-machine-learning-fs19/blob/master/01_overview/01-ml-overview__notes.pdf)  More Explicitly: Components of ML Systems- Define Problem to be solved.- Collect data.- Choose an algorithm class.- Choose an optimization metric for the learning model.- Choose a metric for evaluation. __Note!__- optimization and model evaluation are different tasks!    - For optimization you might want to maximize log-Likelihood, or minimize mean squared errors, maximize information gain etc.    - For model evaluation, you might want to check: accuracy, precision, recall etc.  Supervised Learning in depth  Notation and ConventionsFor the features we will use $\mathbf{X}$$$ \begin{equation*}\mathbf{X} = \begin{pmatrix}x_{1,1} & x_{1,2} & \cdots & x_{1,p} \\x_{2,1} & x_{2,2} & \cdots & x_{2,p} \\\vdots  & \vdots  & \ddots & \vdots  \\x_{N,1} & x_{N,2} & \cdots & x_{N,p} \end{pmatrix}\end{equation*}$$and for the target we will use $\mathbf{y}$:$$ \begin{align}    y &= \begin{bmatrix}           y_{1} \\           y_{2} \\           \vdots \\           y_{N}         \end{bmatrix}  \end{align}$$<jupyter_code>## show data
data
## show target

target<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12710526315789475, 'fraction_numerical': 0.04421052631578947, 'mean_word_length': 3.942782834850455, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 18, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '46562', 'license': 'MIT', 'n_tokens_mistral': 1418, 'n_tokens_neox': 1293, 'n_words': 359, 'path': 'lectures/week-2/Lecture/Week-2-Machine Learning Problems 09-08-After_class.ipynb', 'repo_name': 'dbbabcock/UMBC_DATA602', 'size': '3806'}