🤖 AI/ML

Machine Learning

Machine Learning

Learns patterns from data to make predictions. Classified into supervised, unsupervised, and reinforcement learning.

📖 Detailed Explanation

Machine Learning is a subfield of AI that learns patterns from data without being explicitly programmed in order to make predictions or decisions. The term was first used by Arthur Samuel in 1959 with the definition "a computer system that learns through experience."

Machine learning developed from the perceptron in the 1950s, through SVMs in the 1990s, ensemble methods in the 2000s, and the deep learning revolution in 2012. Today it has expanded to LLMs and generative AI, and has become a core technology in almost every industry.

Machine learning is classified into 3 types according to the learning method. Supervised Learning learns from labeled data and is used for classification and regression problems. Unsupervised Learning identifies the structure of data without labels and is used for clustering and dimensionality reduction. Reinforcement Learning learns actions that maximize rewards.

In practice, machine learning is widely applied to recommendation systems, anomaly detection, demand forecasting, natural language processing, and computer vision. As of 2025, the global ML market size is over USD 50 billion, and demand for data scientists and ML engineers continues to increase.

💻 Code Example

import numpy as np
from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.datasets import load_breast_cancer

# 1. 데이터 로드
data = load_breast_cancer()
X, y = data.data, data.target
print(f"데이터 크기: {X.shape}, 클래스: {np.unique(y)}")

# 2. 데이터 분할 (학습 80%, 테스트 20%)
X_train, X_test, y_train, y_test = train_test_split(
    X, y, test_size=0.2, random_state=42, stratify=y
)

# 3. 피처 스케일링 (중요!)
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

# 4. 여러 모델 비교
models = {
    "Logistic Regression": LogisticRegression(max_iter=1000),
    "Random Forest": RandomForestClassifier(n_estimators=100, random_state=42),
    "Gradient Boosting": GradientBoostingClassifier(n_estimators=100, random_state=42)
}

print("\n=== 교차 검증 결과 (5-fold) ===")
for name, model in models.items():
    scores = cross_val_score(model, X_train_scaled, y_train, cv=5, scoring='accuracy')
    print(f"{name}: {scores.mean():.4f} (+/- {scores.std()*2:.4f})")

# 5. 최종 모델 학습 및 평가
best_model = GradientBoostingClassifier(n_estimators=100, random_state=42)
best_model.fit(X_train_scaled, y_train)
y_pred = best_model.predict(X_test_scaled)

print("\n=== 테스트 세트 성능 ===")
print(classification_report(y_test, y_pred, target_names=data.target_names))

# 6. 피처 중요도
feature_importance = sorted(
    zip(data.feature_names, best_model.feature_importances_),
    key=lambda x: x[1], reverse=True
)[:5]
print("\nTop 5 중요 피처:")
for feat, imp in feature_importance:
    print(f"  {feat}: {imp:.4f}")

🗣️ Say It Like This in Practice

💬 In a Meeting
"This churn prediction model is based on Gradient Boosting. It was trained on two years of past customer data and achieved an AUC of 0.85 on the test set. Feature importance analysis showed that the recent purchase interval and the total number of orders had the greatest impact."
💬 In an Interview
"Machine learning is classified into supervised learning, unsupervised learning, and reinforcement learning. Supervised learning builds prediction models from labeled data, and unsupervised learning finds data patterns without labels. Recently, self-supervised learning (Self-supervised) is also widely used."
💬 In a Technical Discussion
"For tabular data, Gradient Boosting family models (XGBoost, LightGBM) still outperform deep learning. Deep learning has strengths in unstructured data such as images, text, and speech. Choosing the right algorithm for the problem is important."

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

⚠️ Common Mistakes & Cautions

❌
Tuning hyperparameters with test data

Using the test set multiple times leads to overfitting. The test set should be used only once, for the final evaluation.

✅
Correct data splitting

Split the data into three sets (Train/Validation/Test) or use cross-validation. Tune hyperparameters with the validation set, and use the test set only for the final evaluation.

🔗 Related Terms

📚 Learn More