Skip to content

Latest commit

 

History

History
76 lines (49 loc) · 4.22 KB

README.md

File metadata and controls

76 lines (49 loc) · 4.22 KB

Stock-Prediction-Models

This repository is created to store different trained model and their results of executions in a structured manner accoring to their timeline and value.

  1. To name a .ipynb file: 5_15_23_open.h5
("n-Year"_ "StartDate" _ "End Date" _ "feature name"."file extension")
  1. To name a model file: 5Model_15_23.h5
("n-Year"_ "StartDate" _ "End Date" _ "feature name"."file extension")

Model Details and Navigation (Without XGBoost)

  1. For Close Feature
5 year Model 8 Year Model 10 Year Model
Epoch 75 Epoch 75 Epoch 75
Epoch 100 Epoch 100 Epoch 100
Epoch 125 Epoch 125 Epoch 125
Epoch 150 Epoch 150 Epoch 150
  1. For Open Feature
5 year Model 8 Year Model 10 Year Model
Epoch 75 Epoch 75 Epoch 75
Epoch 100 Epoch 100 Epoch 100
Epoch 125 Epoch 125 Epoch 125
Epoch 150 Epoch 150 Epoch 150

XG Boost can be used as a standalone model, its strength lies in its ability to combine multiple weak models (decision trees) into a stronger ensemble. XGBoost uses a gradient boosting framework, where each subsequent tree is trained to correct the errors of the previous trees, leading to improved overall performance.

Grid Search CV

Grid Search CV is a popular hyperparameter tuning technique used in machine learning to find the optimal combination of hyperparameters for a given model. In XGBoost, a gradient boosting algorithm, Grid Search CV is particularly valuable due to the numerous hyperparameters that can significantly impact the model's performance.  

from sklearn.model_selection import GridSearchCV

# Define hyperparameter grid
param_grid = {
    'n_estimators': [50, 100, 200],
    'max_depth': [3, 5, 7],
    'learning_rate': [0.01, 0.1, 0.2]
}

# Create GridSearchCV object
grid_search = GridSearchCV(estimator=model_xgb, param_grid=param_grid, cv=5)

# Fit the grid search to the data
grid_search.fit(lstm_features_train, y_train)

# Get the best hyperparameters
best_params = grid_search.best_params_
print("Best Hyperparameters:", best_params)

# Use the best model to make predictions
best_model = grid_search.best_estimator_
y_pred = best_model.predict(lstm_features_test)

flowchart drawio

xg_boost