Artificial intelligence • Original RRTutors lesson
Classical Machine-Learning Algorithms
Compare linear and logistic models, decision trees, ensembles, k-nearest neighbors, and support-vector machines.
Concept and explanation
Classical algorithms remain useful for structured data and smaller datasets. Linear models provide compact decision rules; trees capture nonlinear interactions; random forests and boosting combine learners; k-nearest neighbors uses local similarity; support-vector machines optimize margins. Preprocessing, feature scale, data volume, interpretability, and latency influence the choice.
How to apply it
Establish a simple baseline, tune with a validation method, and compare quality with inference cost and explanation needs.
Worked example
A tabular risk-ranking task might compare logistic regression with a tree ensemble before considering a larger neural network.
Illustrative Python example
from sklearn.ensemble import RandomForestClassifier
model = RandomForestClassifier(
n_estimators=200, random_state=7, class_weight="balanced"
)
model.fit(X_train, y_train)
Expected result
The forest combines multiple decision trees; settings should be selected with validation.
Limitations and cautions
Model interpretability tools are approximations and do not establish causal explanations.
Practice exercise
Choose a baseline algorithm for a small tabular dataset and justify the choice using constraints.
Key takeaway: A more complex algorithm is not automatically a better solution.