This is a Logistic Regression model enhanced with a rule-based system for multi-label classification of Dockerfile-related commit messages. It combines machine learning with domain-specific rules to achieve accurate categorization.
1from joblib import load
2
3# Load the model and preprocessing artifacts
4model = load("logistic_model.joblib")
5tfidf_vectorizer = load("tfidf_vectorizer.joblib")
6mlb = load("label_binarizer.joblib")
7
8# Example usage
9new_messages = [
10 "Fixed an issue with the base image in Dockerfile",
11 "Added multistage builds to reduce image size",
12 "Updated Python version in Dockerfile to 3.10"
13]
14X_new_tfidf = tfidf_vectorizer.transform(new_messages)
15
16# Predict the labels
17predictions = model.predict(X_new_tfidf)
18predicted_labels = mlb.inverse_transform(predictions)
19
20# Print results
21for msg, labels in zip(new_messages, predicted_labels):
22 print(f"Message: {msg}")
23 print(f"Predicted Labels: {', '.join(labels) if labels else 'No labels'}\n")