kerem.im
Günlük Notlar
Tüm kayıtlar
log #002 · ·

Starting Machine Learning with Python

Day one of the ML with Python course on Coursera: what machine learning is, how it relates to AI, its main techniques and the model lifecycle.

İçindekiler
  1. What is Machine Learning?
  2. Why is Python important in Machine Learning?
  3. But how does it differ from AI?
  4. Types of learning
  5. Machine learning techniques
  6. Classification vs. regression
  7. Clustering
  8. Machine Learning Model Lifecycle
  9. Example: a recommendation system

Today I’ve started the ML with Python course on Coursera.

What is Machine Learning?

Machine learning is a branch of AI. We use algorithms to train a model so that it learns not just the data itself but also the pattern behind it. These models are then used to predict without hard-coded rules. We may think of it like a human. We learn from our past, which corresponds to the data AI trained on, and predict an outcome based on our experience.

Why is Python important in Machine Learning?

Python is like the native language of machine learning because Pandas, NumPy are widely used as the primary tool. Pandas is used to handle the tabular data and NumPy is used for mathematical operations within the data.

But how does it differ from AI?

AI is a broad term which comprises computer vision, NLP, GenAI, deep learning and finally machine learning. Actually, deep learning is a subset of machine learning which consists of multiple neural layers and can automatically extract information from unstructured data.

Types of learning

Machine learning models differ based on how they learn. Firstly, there are supervised ones. These are trained on labeled data to make decisions. Unsupervised models find patterns in data without labels. Semi-supervised is something in between these two. Finally, reinforcement learning models learn from feedback they receive from their environment.

Machine learning techniques

There are several techniques used in machine learning.

  1. Classification (supervised)
  2. Regression/Estimation (supervised)
  3. Clustering
  4. Association
  5. Anomaly Detection
  6. Sequence Mining
  7. Dimension Reduction
  8. Recommendation Systems

We’ll later cover some of these in depth.

Classification vs. regression

We can choose between classification and regression before training our ML model. Classification categorizes data into one of the predetermined groups. For example, this may be useful for my case as I will try to categorize epitopes based on whether they’re useful as a target or not. Regression on the other hand, produces continuous numerical values from input data. This also matters as my predictions are not just binary but also regards how strong is a bond etc.

Clustering

Clustering is mainly used in unsupervised MLs as they group similar objects without the need for predetermined classes. For example, when I type 1, a, &, %, c, 9, one may create three groups: 1, 9, a, c and &, %. This is called clustering.

Machine Learning Model Lifecycle

First, we must define the problem. Then we collect data and prepare it. This process is called ETL which stands for extract, transform and load. It consists of, as the name suggests, collecting data and then cleaning, transforming and storing it in a new place. This is important for the model to handle data efficiently. Next two steps are called “model development and evaluation” and model deployment. Note that this lifecycle is not necessarily unidirectional. We may iterate back and forth while accomplishing our goal.

flowchart LR
  A["Define the problem"] --> B["Collect and prepare data (ETL)"]
  B --> C["Model development and evaluation"]
  C --> D["Model deployment"]
  D -.->|"iterate back and forth"| A

Example: a recommendation system

Let’s assume we have a client who wants its customers to receive recommendations based on their purchase history. We first must understand the problem. After that, we will collect data. What data could be useful here? Purchase history is a trivial answer but there is more to it. For example, demographics, product data, saved products, liked products or even search history might be useful. We have to transform and merge this data into one piece.

Then, we will prepare this data by detecting errors, missing data and different formatting. We want to make sure that irrelevant data and extreme values are excluded (unlike in epitope hunting where we are looking for those extreme values!), and each data column is in the proper format. Afterwards, we may proceed with grouping the products in terms of skin issues they target. This is the step of creating new features.

Then we start building our model. First, we use a technique called content-based filtering. If someone is using a product with acid in it, it’s likely that they’re fighting acne and might buy a product with similar ingredients. Secondly, we use collaborative filtering which resembles the rating mechanism used by e-commerce websites. If many customers like a product and even rate it 5/5, it’s likely that the next customer will be close to the average. Finally, we combine these two techniques and evaluate our model based on how it performs on never-before-seen data. Voilà, we have our first model.

Kopyalandı!