{"id":209379,"date":"2024-07-23T13:00:36","date_gmt":"2024-07-23T17:00:36","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=209379"},"modified":"2024-08-12T14:53:01","modified_gmt":"2024-08-12T18:53:01","slug":"the-boruta-shap-algorithm-a-cpu-and-gpu-version","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/","title":{"rendered":"The Boruta-Shap Algorithm: A CPU and GPU Version"},"content":{"rendered":"\n<p>After you do feature engineering, feature importance is a key step before deploying a strategy backtesting code. Boruta-Shap comes as a viable source for that purpose. However, this algorithm might take a lot of time to run with large datasets. This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster. Code will be implemented using the XGBoost library and futures library for CPU parallelism.<\/p>\n\n\n\n<p>We will cover:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>What is the Boruta-Shap algorithm?<\/li>\n\n\n\n<li>How the Boruta-Shap algorithm works<\/li>\n\n\n\n<li>Significance of Boruta-Shap<\/li>\n\n\n\n<li>Accelerating Boruta-Shap Algorithm<\/li>\n\n\n\n<li>A CPU-and-GPU-based algorithm to run quicker the Boruta-Shap algorithm<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-the-boruta-shap-algorithm\">What is the Boruta-Shap algorithm?<\/h2>\n\n\n\n<p>The Boruta-Shap algorithm is a good technique for feature selection, especially in&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/trading-using-machine-learning-python\/\">machine learning<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/steps-data-science\/\">data science<\/a>&nbsp;applications, is the Boruta-Shap algorithm. Boruta-Shap combines the Boruta feature selection process with the Shapley values to enhance feature importance assessment.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-the-boruta-shap-algorithm-works\">How the Boruta-Shap algorithm works<\/h2>\n\n\n\n<p>The Boruta-Shap algorithm works in the following way:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, we create shuffled versions of all the input features.<\/li>\n\n\n\n<li>Second, Boruta is used to identify a tentative set of important features using a&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/machine-learning-classification\/\">machine learning model<\/a>.<\/li>\n\n\n\n<li>Then, Shapley values are calculated for these tentative features using the above model (often a tree-based model like&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/random-forest-algorithm-in-python\/\">Random Forest<\/a>&nbsp;or&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/random-walk\/\">Gradient Boosting Machine<\/a>). The tentative features are chosen based on comparing their usefulness with respect to their shuffled versions.<\/li>\n\n\n\n<li>The Shapley values provide a more nuanced understanding of feature importance, capturing interactions between features and their impact on model predictions.<\/li>\n\n\n\n<li>Finally, features are ranked based on their Shapley values, helping to prioritize the most influential features for model training and interpretation.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"significance-of-boruta-shap\">Significance of Boruta-Shap<\/h2>\n\n\n\n<p>The Boruta-Shap algorithm has the following benefits.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Robustness &#8211; it can produce accurate feature importance rankings even for noisy, high-dimensional datasets.<\/li>\n\n\n\n<li>Interpretability is aided by the use of Shapley values, which provide information on how each feature affects model predictions.<\/li>\n\n\n\n<li>Boruta-Shap considers feature interactions and the value of individual features, which is important in complex datasets.<\/li>\n\n\n\n<li>This algorithm is used before you do feature engineering.<\/li>\n<\/ul>\n\n\n\n<p><em>Visit QuantInsti website to watch this clip: <em>&#8220;Industry expert and renowned author, Dr. Ernest Chan talks about Financial Data Science &amp; Feature Engineering and shares his knowledge:&#8221;<\/em> <a href=\"https:\/\/blog.quantinsti.com\/boruta-shap-gpu-python\/\">https:\/\/blog.quantinsti.com\/boruta-shap-gpu-python\/<\/a><\/em> <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"accelerating-boruta-shap-algorithm\">Accelerating Boruta-Shap Algorithm<\/h2>\n\n\n\n<p>Despite Boruta-Shap&#8217;s strength, its computational cost can be high, particularly for large datasets with many characteristics. To solve this, I&#8217;ve included a Boruta-Shap code that uses the CPU and GPU in tandem to expedite the Boruta-Shap&#8217;s execution. Cool, right?<\/p>\n\n\n\n<p>This approach drastically cuts computation time by effectively allocating the workload and utilizing the parallel processing powers of both CPUs and GPUs.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a-cpu-and-gpu-based-algorithm-to-run-quicker-the-boruta-shap-algorithm\">A CPU-and-GPU-based algorithm to run quicker the Boruta-Shap algorithm<\/h2>\n\n\n\n<p>Let&#8217;s dissect the code. Depending on the number of cores available in your CPU, the code will group the number of trials in buckets and each bucket will be run in parallel. We use a modified version of the code provided by Moosa Ali (2022), who implements the CPU-based algorithm.<\/p>\n\n\n\n<p>Let\u2019s code!<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Import the necessary libraries\nimport scipy as sp\nimport numpy as np\nimport pandas as pd\nimport shap\nfrom xgboost import XGBRFClassifier\nfrom xgboost import XGBRFRegressor\nfrom sklearn.preprocessing import LabelEncoder\nfrom concurrent import futures<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/18e9aa348c9cb844fb349508594aff39#file-import_libraries-py\">import_libraries.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>The following function is responsible for computing the minimum number of trials needed as a threshold to accept an input feature as a selected feature based on the probability mass function (pmf) and a significance level. It iterates over the pmf and accumulates the&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/probability-trading\/\">probabilities<\/a>&nbsp;until the cumulative probability exceeds the significance level.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># Set the minimum number of trials as a threshold number to accept an input feature as a selected feature\ndef get_tail_items(pmf, significance_level=0.05):\n   # Set total to zero\n   total = 0\n   # Create a loop based on the probability mass function\n   for i, x in enumerate(pmf):\n       # Increment the total variable with the probability \u201cx\u201d of i\n       total += x\n       # If total is higher than the significance level\n       if total &gt;= significance_level:\n           # Break the code\n           break\n   # Return i\n   return i<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/134f005e7732d3bc83356823c926be20#file-get_tail_items_func-py\">get_tail_items_func.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>The next function selects features based on the number of hits they receive during the trials. It categorizes features into two zones:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>green zone (features with hits higher than a threshold) and<\/li>\n\n\n\n<li>blue zone (features with hits between upper and lower thresholds).<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># select features from n number of trials\ndef choose_features(feature_hits, TRIALS, thresh):\n   # Define the  boundaries for the green zone\n   # Define the green zone threshold\n   green_zone_thresh = TRIALS - thresh\n   # Define the blue zone upper threshold\n   blue_zone_upper = green_zone_thresh\n   # Define the blue zone lower threshold\n   blue_zone_lower = thresh\n\n\n   # Select the input features as green whenever their hits are higher than the green zone threshold\n   green_zone = [key for key, value in feature_hits.items() if value &gt;= green_zone_thresh]\n   # Select the input features as blue whenever their hits are between the blue zone lower threshold and the blue zone upper threshold \n   blue_zone = [key for key, value in feature_hits.items() if (value &gt;= blue_zone_lower and value &lt; blue_zone_upper)]\n   return green_zone, blue_zone<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/34e820620d311e184211dc31f404b61a#file-choose_features_func-py\">choose_features_func.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p>The following last function is the main function implementing the Boruta-Shap algorithm. It takes input data X and target variable y, along with optional parameters such as trials, workers, significance_level, and seed.<\/p>\n\n\n\n<p>Find below what the function does:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Set the seed<\/li>\n\n\n\n<li>It initializes a dictionary features_hits to track the number of hits for each feature.<\/li>\n\n\n\n<li>Shuffled column names are generated for feature shuffling.<\/li>\n\n\n\n<li>The data is split into training and testing sets.<\/li>\n\n\n\n<li>Label encoding is applied to the target variable y.<\/li>\n\n\n\n<li>A classification model (XGBRFClassifier, a tool from the&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/xgboost-python\/\">XGBoost<\/a>&nbsp;library) is defined. To make the classifier work with a GPU, you just need to set the tree_method to &#8216;gpu_hist&#8217;. Creating the model from scratch will be something quite complex. However, you can create the model using the&nbsp;<a href=\"https:\/\/blog.quantinsti.com\/nvidia-gpu-rapids-libraries-trading\/\">Rapids libraries<\/a>.<\/li>\n\n\n\n<li>The features_hits_func function is defined to perform feature shuffling, model fitting, and Shapley value computation for each trial. This function can be run within a loop for each trial or all the trials can be computed in parallel with the CPU.<\/li>\n\n\n\n<li>A multi-threading and a loop technique are used to run multiple trials concurrently. In this case, we group all the range of trials in buckets as per the number of workers (threads used). For example, if we have 25 trials and we have 10 threads to use:<\/li>\n\n\n\n<li>We define params_list_for_loop as the first 20 trials and last_params_list as the last 5 trials. We will run the features_hits_func function for the first 10 trials in parallel.<\/li>\n\n\n\n<li>Once this is run, we iterate to the next 10 trials, which will be run in parallel, too.<\/li>\n\n\n\n<li>Once we\u2019re done with that, we finally run the last 5 trials in parallel.<\/li>\n\n\n\n<li>After all trials, the probability mass function is calculated, and the minimum number of trials as a threshold is determined.<\/li>\n\n\n\n<li>Features are classified into green, blue, or rejected based on the thresholds and hits received.<\/li>\n\n\n\n<li>The function returns the selected features. In case no features were selected, we select all.<\/li>\n<\/ol>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">def boruta_shap_algorithm(X, y, trials=20, workers=2, significance_level=0.05, seed=2024):\n   # Set the seed\n   np.random.seed(seed)       \n\n\n   # Assert that the number of samples of both data match\n   assert X.shape[0] == y.shape[0], \"X and y dimensions don't coincide\"\n\n\n   # Set a dictionary to save the number of hits for each feature\n   features_hits = {feature:0 for feature in X.columns}\n\n\n   # Create the names of all the features shuffled\n   shuffled_col_names = [str(column+'_shuffle') for column in X.columns]\n\n\n   # Set the train and test X data\n   X_train, X_test = X.iloc[:int(0.8*len(X))], X.iloc[int(0.8*len(X)):]\n\n\n   # Set the label enconder object\n   le = LabelEncoder()\n\n\n   # Transform the y series to a prediction features useful for the machine-learning model\n   label_encoded = le.fit_transform(y)\n\n\n   # Transform the encoded label into a Pandas series\n   y = pd.Series(data=label_encoded, index=y.index, name='y')\n\n\n   # Set the y train data\n   y_train = y.iloc[:int(0.8*len(y))]\n  \n   # define the model\n   classifier = XGBRFClassifier(n_estimators=100, subsample=1, colsample_bynode=1, tree_method='gpu_hist', random_state=seed) \n\n\n   # Define a function to compute the number of times the features\n   def features_hits_func(trial):\n       # Set the seed for the trial\n       np.random.seed(seed+trial)\n\n\n       # Set the X train data for the shuffled features\n       X_shuffle_train = X_train.apply(np.random.permutation)\n       # Set the names for the X train shuffled features\n       X_shuffle_train.columns = shuffled_col_names\n       # Set the X-test data for the shuffled features\n       X_shuffle_test = X_test.apply(np.random.permutation)\n       # Set the names for the X-test shuffled features\n       X_shuffle_test.columns = shuffled_col_names\n\n\n       # Set the whole input features for the Boruta-Shap algorithm training\n       X_boruta_train = pd.concat([X_train, X_shuffle_train], axis=1)\n       # Set the whole input features for the Boruta-Shap algorithm test data\n       X_boruta_test = pd.concat([X_test, X_shuffle_test], axis=1)\n\n\n       # Fit the model\n       model = classifier.fit(X_boruta_train, y_train)\n\n\n       # Set the explainer object\n       explainer = shap.TreeExplainer(model)\n\n\n       # Get the Shap values for each feature\n       shap_values = explainer.shap_values(X_boruta_test)\n\n\n       # Set the mean value of each feature's Shap values\n       features_importance = np.array(np.abs(shap_values).mean(0))\n       # Set a dataframe with the above features' importance\n       features_importance_df = pd.DataFrame(data=features_importance, index=X_boruta_test.columns, columns=['Values'])\n\n\n       # Subset the feature importance dataframe with the non-shuffled features\n       feature_imp_X = features_importance_df.iloc[:len(X.columns)]\n       # Subset the feature importance dataframe with the shuffled features\n       feature_imp_shuffled = features_importance_df.iloc[len(X.columns):]\n\n\n       # Add one hit in case the feature is better than the best Shap value of all the shuffled features\n       for feature in feature_imp_X.index:\n           features_hits[feature] += int(feature_imp_X.loc[feature,'Values'] &gt; feature_imp_shuffled['Values'].max())\n\n\n   # Define a function to run multiple trials as per the maximum number of cores available in your CPU\n   def multithreading_loop(function, params_list):\n       # Set the number of lists we'll have as per the number of cores\n       num_lists = int(np.floor(len(params_list)\/workers))\n       # Set the params list to be used to loop\n       params_list_for_loop = params_list[:int(num_lists*workers)]\n       # If the number of trials in the above list is higher than the num_lists\n       if len(params_list)&gt;int(num_lists*workers):\n           # Create the last params list to be used to multithread the computations\n           last_params_list = params_list[int(num_lists*workers):]\n\n\n       # For each list of trials\n       for i in range(0,num_lists):\n           # Use the number of cores for the futures library executor\n           with futures.ThreadPoolExecutor(workers) as executor:\n               # Run the features_hits_func function to compute the hits in parallel\n               list(executor.map(function, params_list_for_loop[int(workers*i):int(workers*(i+1))]))\n       # Once you finish the above, run the last trials to be computed in parallel\n       if len(params_list)&gt;int(num_lists*workers):\n           # Use the number of cores for the futures library executor\n           with futures.ThreadPoolExecutor(len(last_params_list)) as executor:\n               # Run the features_hits_func function to compute the hits in parallel\n               list(executor.map(function, last_params_list))\n\n\n   # Set the range for the number of trails as a list\n   trails_list = [*range(trials)]\n\n\n   # Run the loop to compute the trails in parallel in buckets\n   multithreading_loop(features_hits_func, trails_list)     \n  \n   # Calculate the probability mass function: Get the Binomial distribution in \"trials\" number of buckets\n   pmf = [sp.stats.binom.pmf(x, trials, .5) for x in range(trials + 1)]\n\n\n   # Set the minimum number of trials as the threshold to classify an input feature as a selected feature\n   thresh = get_tail_items(pmf, significance_level)\n  \n   # green are the accepted features, blue are the tentative features\n   green, blue = choose_features(features_hits, trials, thresh)\n\n\n   # If there are green features\n   if len(green) != 0:\n       # Return the green features\n       return green\n   # If there aren't green features\n   else:\n       # If there are blue features\n       if len(blue) != 0:\n           # Return the blue features\n           return blue\n       # If there aren't blue features\n       else:\n           # Return all the features\n           return X.columns.tolist()<\/pre>\n\n\n\n<p><a href=\"https:\/\/gist.github.com\/quantra-go-algo\/7c1ab7ae5a89c47ac6ef6f6e32a5fd2a#file-gpu_cpu_based_boruta_shap_func-py\">gpu_cpu_based_boruta_shap_func.py&nbsp;<\/a>hosted with \u2764 by&nbsp;<a href=\"https:\/\/github.com\/\">GitHub<\/a><\/p>\n\n\n\n<p><strong>References<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ali, Moosa (2022).&nbsp;<em>Boruta Feature Selection Explained in Python<\/em>. Medium,&nbsp;<a href=\"https:\/\/medium.com\/geekculture\/boruta-feature-selection-explained-in-python-7ae8bf4aa1e7\">https:\/\/medium.com\/geekculture\/boruta-feature-selection-explained-in-python-7ae8bf4aa1e7<\/a><\/li>\n\n\n\n<li>Lundberg, S. M., &amp; Lee, S. I. (2017). A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems (pp. 4765-4774).<\/li>\n\n\n\n<li>Piatetsky-Shapiro, G., &amp; Mateosian, R. (2017). Boruta feature selection in r. KDnuggets, 17(19), 1-7.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h3>\n\n\n\n<p>You have learned how to create the Boruta-Shap algorithm using both the CPU and GPU. You\u2019ll see a great difference, compared with using only the CPU, if you use a dataframe with many observations. Besides, the higher the number of threads and cores, the better the parallelism and the quicker the loop will run.<\/p>\n\n\n\n<p><em>What\u2019s next? You would ask.<\/em><br>Well, you can use the above code to get the feature importance before you backtest a strategy. We suggest you use the Boruta-Shap algorithm before you optimize a strategy&#8217;s parameters. You can find the source file below.<\/p>\n\n\n\n<p>In case you want to learn more about machine learning, keep track of this learning&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/learning-track\/machine-learning-deep-learning-trading-1\">track<\/a>! You\u2019ll learn the basics of machine learning in finance.<\/p>\n\n\n\n<p>Now that you&#8217;ve grasped the power of Boruta Shap for identifying key features, you might be wondering how to put it into practice for real-world problems. Here&#8217;s where things get exciting! This&nbsp;<a href=\"https:\/\/quantra.quantinsti.com\/learning-track\/machine-learning-deep-learning-trading-1\">Machine Learning &amp; Deep Learning for Trading<\/a>&nbsp;course by Quantra helps you learn these techniques for building advanced trading strategies. You&#8217;ll not only learn the theory behind Boruta Shap but also gain hands-on experience implementing it to select the most impactful features for your own trading algorithms.<\/p>\n\n\n\n<p>It&#8217;s the perfect next step to turn your newfound knowledge into action!<br>Happy Learning!<\/p>\n\n\n\n<p><em>Originally posted on <a href=\"https:\/\/blog.quantinsti.com\/boruta-shap-gpu-python\/\">QuantInsti<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster. <\/p>\n","protected":false},"author":825,"featured_media":158185,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341],"tags":[17480,806,852,1225,1224,595,16962,11087,17481,17482],"contributors-categories":[13654],"class_list":{"0":"post-209379","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"tag-boruta-shap-algorithm","13":"tag-data-science","14":"tag-machine-learning","15":"tag-numpy","16":"tag-pandas","17":"tag-python","18":"tag-rapids-libraries","19":"tag-scipy","20":"tag-shap-python-library","21":"tag-xgboost-library","22":"contributors-categories-quantinsti"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>The Boruta-Shap Algorithm: A CPU and GPU Version<\/title>\n<meta name=\"description\" content=\"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/209379\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Boruta-Shap Algorithm: A CPU and GPU Version\" \/>\n<meta property=\"og:description\" content=\"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2024-07-23T17:00:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-12T18:53:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jos\u00e9 Carlos Gonz\u00e1les Tanaka\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jos\u00e9 Carlos Gonz\u00e1les Tanaka\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Jos\u00e9 Carlos Gonz\u00e1les Tanaka\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/f56024231fae4f14b0df92817cf8c884\"\n\t            },\n\t            \"headline\": \"The Boruta-Shap Algorithm: A CPU and GPU Version\",\n\t            \"datePublished\": \"2024-07-23T17:00:36+00:00\",\n\t            \"dateModified\": \"2024-08-12T18:53:01+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/\"\n\t            },\n\t            \"wordCount\": 1279,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/09\\\/abstract-quant-purple-blue-sphere.jpg\",\n\t            \"keywords\": [\n\t                \"Boruta-Shap Algorithm\",\n\t                \"Data Science\",\n\t                \"Machine Learning\",\n\t                \"NumPy\",\n\t                \"Pandas\",\n\t                \"Python\",\n\t                \"RAPIDS Libraries\",\n\t                \"scipy\",\n\t                \"shap Python library\",\n\t                \"XGBoost library\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/\",\n\t            \"name\": \"The Boruta-Shap Algorithm: A CPU and GPU Version | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/09\\\/abstract-quant-purple-blue-sphere.jpg\",\n\t            \"datePublished\": \"2024-07-23T17:00:36+00:00\",\n\t            \"dateModified\": \"2024-08-12T18:53:01+00:00\",\n\t            \"description\": \"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/09\\\/abstract-quant-purple-blue-sphere.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/09\\\/abstract-quant-purple-blue-sphere.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Quant\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/f56024231fae4f14b0df92817cf8c884\",\n\t            \"name\": \"Jos\u00e9 Carlos Gonz\u00e1les Tanaka\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/jose-carlos-gonzales-tanaka\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"The Boruta-Shap Algorithm: A CPU and GPU Version","description":"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/209379\/","og_locale":"en_US","og_type":"article","og_title":"The Boruta-Shap Algorithm: A CPU and GPU Version","og_description":"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/","og_site_name":"IBKR Campus US","article_published_time":"2024-07-23T17:00:36+00:00","article_modified_time":"2024-08-12T18:53:01+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","type":"image\/jpeg"}],"author":"Jos\u00e9 Carlos Gonz\u00e1les Tanaka","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jos\u00e9 Carlos Gonz\u00e1les Tanaka","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/"},"author":{"name":"Jos\u00e9 Carlos Gonz\u00e1les Tanaka","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/f56024231fae4f14b0df92817cf8c884"},"headline":"The Boruta-Shap Algorithm: A CPU and GPU Version","datePublished":"2024-07-23T17:00:36+00:00","dateModified":"2024-08-12T18:53:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/"},"wordCount":1279,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","keywords":["Boruta-Shap Algorithm","Data Science","Machine Learning","NumPy","Pandas","Python","RAPIDS Libraries","scipy","shap Python library","XGBoost library"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/","name":"The Boruta-Shap Algorithm: A CPU and GPU Version | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","datePublished":"2024-07-23T17:00:36+00:00","dateModified":"2024-08-12T18:53:01+00:00","description":"This unique article provides us with an estimation of the mentioned algorithm using CPU parallelism and GPU to make it run faster.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/the-boruta-shap-algorithm-a-cpu-and-gpu-version\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","width":1000,"height":563,"caption":"Quant"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/f56024231fae4f14b0df92817cf8c884","name":"Jos\u00e9 Carlos Gonz\u00e1les Tanaka","url":"https:\/\/www.interactivebrokers.com\/campus\/author\/jose-carlos-gonzales-tanaka\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2022\/09\/abstract-quant-purple-blue-sphere.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/209379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/825"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=209379"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/209379\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/158185"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=209379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=209379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=209379"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=209379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}