■ Machine Learning Crash Course (7 Days) +
Exercises
■ Module 1 – Python Basics for ML
- Variables, Lists, Loops, Functions
- Libraries: numpy, pandas
Example:
import numpy as np
import pandas as pd
arr = np.array([1, 2, 3, 4, 5])
print("Array:", arr)
data = {"Name": ["Yoni", "Sara", "Mahi"], "Age": [29, 25, 31]}
df = pd.DataFrame(data)
print(df)
Exercises:
1. Create a list of numbers from 1 to 10 and calculate their sum using a loop.
2. Use numpy to generate an array of 20 random numbers.
3. Create a pandas DataFrame with columns: Student, Grade.
■ Module 2 – Data Handling
- Load CSV/Excel
- Data Cleaning (remove nulls, fill missing values)
- Visualization: matplotlib, seaborn
Example:
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("data.csv")
print(df.head())
df['Age'].hist()
plt.show()
Exercises:
1. Load a dataset (CSV) and print the first 10 rows.
2. Remove rows with missing values.
3. Plot a histogram of a numeric column of your choice.
■ Module 3 – ML Foundations
- Supervised Learning (Regression & Classification)
- Unsupervised Learning (Clustering)
- Linear Regression Example
Example:
from sklearn.linear_model import LinearRegression
import numpy as np
x = np.array([1, 2, 3, 4, 5]).reshape(-1, 1)
y = np.array([2, 4, 5, 4, 5])
model = LinearRegression()
model.fit(x, y)
print("Prediction for 6 hours:", model.predict([[6]]))
Exercises:
1. Build a simple Linear Regression to predict temperature from hours of sunlight.
2. Try classification: predict pass/fail from hours studied.
■ Module 4 – Scikit-Learn Models
- Train/Test Split
- Linear Regression, Logistic Regression, Decision Trees
- Model Evaluation (Accuracy, MAE, RMSE)
Example:
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score
X = [[1],[2],[3],[4]]
y = [0,0,1,1]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5)
model = LogisticRegression()
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Accuracy:", accuracy_score(y_test, y_pred))
Exercises:
1. Split a dataset into training and testing sets (70/30).
2. Train a Decision Tree classifier and check accuracy.
3. Compare Logistic Regression vs Decision Tree results.
■ Module 5 – Projects
- Predict House Prices (Regression)
- Spam Detection (Classification)
Exercises:
1. Download a house price dataset and build a regression model.
2. Use a spam dataset (SMS/Email) and classify messages as spam or not.
■ Module 6 – Advanced ML
- Random Forests
- Support Vector Machines (SVM)
- KMeans Clustering
Exercises:
1. Train a Random Forest classifier on a dataset and check accuracy.
2. Apply KMeans clustering on a dataset and plot clusters.
3. Compare SVM results with Logistic Regression on the same dataset.
■ Module 7 – Wrap Up & Portfolio
- Upload projects to GitHub
- Learn how to explain model results
Exercises:
1. Create a GitHub account and upload one of your projects.
2. Write a README file explaining your project and results.
3. Share your project with a friend or mentor for feedback.