ML_Termproject2023
ML_Termproject2023 is a final project for a graduate-level machine learning course. It was completed over 7 commits between November and December 2023.
Project Structure
flowchart TD
A[문제 정의] --> B[데이터 준비]
B --> C[Baseline 모델]
C --> D[모델 개선]
D --> E[하이퍼파라미터 튜닝]
E --> F[결과 분석]
F --> G[보고서 작성]
Model Comparison Experiments
from sklearn.model_selection import cross_val_score
from sklearn.metrics import accuracy_score
models = {
'Logistic Regression': LogisticRegression(),
'Random Forest': RandomForestClassifier(n_estimators=100),
'SVM': SVC(kernel='rbf'),
'XGBoost': XGBClassifier(),
'Neural Network': MLPClassifier(hidden_layer_sizes=(100, 50)),
}
results = {}
for name, model in models.items():
scores = cross_val_score(model, X_train, y_train, cv=5)
results[name] = {
'mean': scores.mean(),
'std': scores.std()
}
Hyperparameter Tuning
from sklearn.model_selection import GridSearchCV
param_grid = {
'n_estimators': [100, 200, 500],
'max_depth': [5, 10, 15, None],
'min_samples_split': [2, 5, 10],
}
grid_search = GridSearchCV(
RandomForestClassifier(),
param_grid,
cv=5,
scoring='accuracy',
n_jobs=-1,
verbose=1
)
grid_search.fit(X_train, y_train)
Lessons Learned
- Baselines matter: Good preprocessing beats a more complex model
- Cross-validation is non-negotiable: A single train/test split risks overfitting
- Feature importance analysis: Model interpretability matters in research
This was an undergraduate course project, but it laid a solid foundation in the fundamentals of ML experimentation.