Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using multiple models & grid search #1

Open
ChrisD-7 opened this issue May 22, 2024 · 5 comments
Open

Using multiple models & grid search #1

ChrisD-7 opened this issue May 22, 2024 · 5 comments

Comments

@ChrisD-7
Copy link

Hey I was impressed with your model I would like to know if you would consider multiple models with grid search for a better understanding.

Second if you could predict the wait times as well

@ashita03
Copy link
Owner

ashita03 commented May 22, 2024 via email

@ChrisD-7
Copy link
Author

Yes my bad 😂 confused h1b with green card wait time

Lmk if you would like to collaborate on any projects

PS : what about probability of h1b

@ashita03
Copy link
Owner

I'd love to! I just checked out the kind of projects you've worked on, and I must add that they're commendable!

So there are different kinds of H1B/International Visas, maybe we could check out the probabilities of approval for each of these visa classes

@ChrisD-7
Copy link
Author

ChrisD-7 commented May 23, 2024

that too and if we can get some of the recent data we can perform eda to check better stats for the grid search I was talking

The file that has some grid search implemented

# Testing Multiple Models:
# List of models
models = [
    DecisionTreeClassifier(),
    LogisticRegression(max_iter=1000),
    SVC(),
    RandomForestClassifier(),
    BernoulliNB(),
    KNeighborsClassifier()
]

model_names = ["Decision Tree", "Logistic Regression", "SVC", "Random Forest", "Naive Bayes", "K-Neighbors"]

# Initialize dictionary to store accuracies
model_accuracies = {}

# Training and Evaluating Models
for model, name in zip(models, model_names):
    model.fit(X_train, y_train)
    predictions = model.predict(X_test)
    accuracy = accuracy_score(y_test, predictions)
    model_accuracies[name] = accuracy  # Store the accuracy in the dictionary
    print(f"{name} Test Accuracy: {accuracy:.2f}")
    print("Confusion Matrix:\n", confusion_matrix(y_test, predictions))
    print("Classification Report:\n", classification_report(y_test, predictions))

# Identify the best performing model
best_model_name = max(model_accuracies, key=model_accuracies.get)
best_accuracy = model_accuracies[best_model_name]
print(f"The best performing model is: {best_model_name} with an accuracy of {best_accuracy:.2f}")

# Select the best model
best_model = models[model_names.index(best_model_name)]
     

We can then run grid search on it

@ashita03
Copy link
Owner

Woah! This is awesome. I am yet to try this in Python since I have based this entire project on R.
Have you tried this or provided a template code for trial and error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants