AI Phase2
AI Phase2
AI Phase2
PHASE-2
INTRODUCTION:
HYBRID APPROCHES:
Combining ensemble methods and deep learning architectures
can yield even better results. For instance, you can use an
ensemble of deep neural networks or integrate deep learning
features into ensemble models. Hybrid approaches leverage the
strengths of both worlds for enhanced accuracy and robustness.
Random Forest:
Random Forest is an ensemble learning algorithm that builds
multiple decision trees and combines their predictions. Each tree is
trained on a random subset of the data and features, reducing
overfitting and improving generalization.
CODE:
from sklearn.ensemble import
RandomForestClassifierfrom
sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# Load your dataset and split it into training and testing sets
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.2)
Gradient Boosting:
Gradient Boosting is another ensemble method that builds multiple
decision trees sequentially, with each tree correcting the errors of the
previous one. It is known for its high predictive accuracy.
CODE:
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.model_selection import train_test_split from
sklearn.metrics import accuracy_score
# Load your dataset and split it into training and testing sets X_train,
X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
CODE:
import tensorflow as tf
from tensorflow.keras import layers, models
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score