Skip to content
KH.Portfolio
All notes

Online Notes

47. Month 1 Final Project Direction

Goal:

Truth Layer / Scam Detector

Baseline:

Text
 ↓
TF-IDF
 ↓
Logistic Regression
 ↓
Scam / Not Scam

Then PyTorch version:

Text
 ↓
Text representation
 ↓
Dataset
 ↓
DataLoader
 ↓
Neural Network
 ↓
Prediction

Compare:

TF-IDF + Logistic Regression
            VS
PyTorch Neural Network

Possible comparison metrics: - accuracy - precision - recall - F1 - training time - inference time - implementation complexity

Goal: understand neural-network training. The PyTorch model does not need to beat Logistic Regression.


48. Current Learning Progress

Python Fluency                ✅
NumPy                         ✅
Pandas                        ✅
Jupyter                       ✅
Essential ML Fundamentals     ✅
scikit-learn                  ✅
Model Evaluation              ✅
Preprocessing/Pipelines       ✅
Cross-Validation              ✅
Basic FastAPI Model Serving   ✅

PyTorch:
Tensors                       ✅
Dataset / DataLoader          ✅
Neural Network / nn.Module    ✅
Basic ReLU                    ✅

Next:
Activation Functions          ⏳
Loss Functions                ⏳
Autograd / Backpropagation    ⏳
Optimizers                    ⏳
Training Loops                ⏳
Validation / Evaluation       ⏳
GPU / Device Handling         ⏳
Save / Load PyTorch Models    ⏳
Final Text Classification     ⏳

49. High-Value Cheat Sheet

Python

def function(x: int) -> int:
    return x * 2

items = [x * 2 for x in range(5)]

try:
    ...
except ValueError:
    ...

with open("file.txt") as file:
    ...

Pandas

df = pd.read_csv("data.csv")

df.head()
df.info()
df.describe()
df.isna().sum()

X = df.drop(columns=["target"])
y = df["target"]

scikit-learn

X_train, X_test, y_train, y_test = train_test_split(
    X,
    y,
    test_size=0.2,
    random_state=42,
    stratify=y
)

model.fit(X_train, y_train)

predictions = model.predict(X_test)

PyTorch

tensor = torch.tensor(
    [1, 2, 3],
    dtype=torch.float32
)
dataset = TensorDataset(X, y)

loader = DataLoader(
    dataset,
    batch_size=32,
    shuffle=True
)
class NeuralNetwork(nn.Module):

    def __init__(self):
        super().__init__()

        self.network = nn.Sequential(
            nn.Linear(2, 4),
            nn.ReLU(),
            nn.Linear(4, 1)
        )

    def forward(self, x):
        return self.network(x)

50. Concepts You Should Be Able to Explain

Before finishing Month 1, aim to explain these without relying on memorized code:

  1. What is the difference between a feature and a target?
  2. Classification vs regression?
  3. Why separate training and test data?
  4. What is data leakage?
  5. Overfitting vs underfitting?
  6. Precision vs recall?
  7. Why use preprocessing pipelines?
  8. Parameter vs hyperparameter?
  9. What is a tensor?
  10. What does tensor shape mean?
  11. Dataset vs DataLoader?
  12. What is a batch?
  13. What is an epoch?
  14. What is a neuron?
  15. What are weights and biases?
  16. What does nn.Linear do?
  17. What does forward() do?
  18. Why do neural networks need nonlinear activation functions?
  19. What changes when a neural network learns?
  20. Why might Logistic Regression still beat a neural network?

51. Mental Model to Keep

The complete workflow we're building toward is:

RAW DATA
   ↓
CLEAN / PREPROCESS
   ↓
FEATURE REPRESENTATION
   ↓
TENSORS
   ↓
DATASET
   ↓
DATALOADER
   ↓
BATCH
   ↓
NEURAL NETWORK
   ↓
PREDICTION
   ↓
LOSS
   ↓
BACKPROPAGATION
   ↓
OPTIMIZER
   ↓
UPDATE WEIGHTS
   ↓
REPEAT ACROSS BATCHES / EPOCHS
   ↓
EVALUATE ON UNSEEN DATA
   ↓
SAVE MODEL
   ↓
SERVE / USE FOR INFERENCE

If you understand why each box exists, you are building the right foundation for AI engineering.