I am trying to run a ML Program to fetch strategy of fix based on error keys. I tried to manipulate the testsize and randomstate but no luck. Sample of the rules in the "error_strategy_data.csv" Note: the below is formatted in rows and columns "errorMessage ", "strategy" in the csv errorMessage : Deadlock found when trying to get lock strategy: Retry transaction or redesign locking errorMessage :Syntax error near SELECT strategy: Fix SQL syntax or use parameterized queries errorMessage :Connection refused to database server strategy: Verify DB network settings and credentials errorMessage :Timeout occurred while executing query strategy: Retry the request with exponential backoff Below is my training model from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import classification_report import joblib data = pd.read_csv("C:\\Users\\Abhishek.mishra01\\Desktop\\error_strategy_data.csv") X = data["error_message"] y = data["strategy"] X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.5, random_state=42) pipeline = Pipeline([ ('tfidf', TfidfVectorizer( lowercase=True, stop_words='english', ngram_range=(1,2), max_features=5000, #strip_accents='unicode' )), ('clf', LogisticRegression(max_iter=1000, C=1)) ]) pipeline.fit(X_train, y_train) preds = pipeline.predict(X_test) print(classification_report(y_test, preds)) joblib.dump(pipeline, "error_strategy_model.joblib") ``` My Test class import joblib # Load model = joblib.load("error_strategy_model.joblib") # Predict error_message = "select" predicted_strategy = model.predict([error_message])[0] print("Suggested strategy:", predicted_strategy) Output expected: "Fix SQL syntax or use parameterized queries" but getting "Verify DB network settings and credentials" More interestingly, it is only picking the 3rd row as a strategy for any of the error message entered. Please help me out Continue reading...