{"id":21573931,"url":"https://github.com/ryanlucas3/macrorandomforest","last_synced_at":"2025-04-10T16:11:53.096Z","repository":{"id":47476771,"uuid":"453705333","full_name":"RyanLucas3/MacroRandomForest","owner":"RyanLucas3","description":"A modification of traditional random forest for time-series forecasting","archived":false,"fork":false,"pushed_at":"2024-04-16T10:54:14.000Z","size":12981,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-20T12:25:35.335Z","etag":null,"topics":["data-science","machine-learning","random-forest","time-series"],"latest_commit_sha":null,"homepage":"https://mrf-web.readthedocs.io/en/latest/index.html","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyanLucas3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt/TXT.rtf","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-30T14:39:29.000Z","updated_at":"2023-12-13T18:00:21.000Z","dependencies_parsed_at":"2024-11-24T12:19:06.551Z","dependency_job_id":null,"html_url":"https://github.com/RyanLucas3/MacroRandomForest","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLucas3%2FMacroRandomForest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLucas3%2FMacroRandomForest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLucas3%2FMacroRandomForest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyanLucas3%2FMacroRandomForest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyanLucas3","download_url":"https://codeload.github.com/RyanLucas3/MacroRandomForest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248251020,"owners_count":21072685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","machine-learning","random-forest","time-series"],"created_at":"2024-11-24T12:08:17.828Z","updated_at":"2025-04-10T16:11:53.070Z","avatar_url":"https://github.com/RyanLucas3.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MacroRandomForest\n\nWe documented this package in much more detail at: https://mrf-web.readthedocs.io/en/latest/index.html.\n\n---------------------------------------------------------------------------------------------------------------------------------\n*\"Machine Learning is useful for macroeconomic forecasting but not so useful for macroeconomics\" - Philippe Goulet Coulombe*\n-------------------------------------------------------------------------------------------------------------------------------\n![MRF_logo_2](https://user-images.githubusercontent.com/55145311/156574873-e72ef942-6979-4639-9089-9b2e06f7a80e.svg)\n\n# How it works\n\nRandom forest is an extremely popular algorithm because it allows for complex nonlinearities, handles high-dimensional data, bypasses overfitting, and requires little to no tuning. However, while random forest gladly delivers gains in prediction accuracy (and ergo a conditional mean closer to the truth), it is much more reluctant to disclose its inherent model. \n\nMRF shifts the focus of the forest away from predicting $y_t$ into modelling $\\beta_t$, which are the economically meaningful coefficients in a time-varying linear macro equation. More formally:\n\n$$y_t = X_t \\beta_t  + \\varepsilon_t$$\n\n$$\\beta_t = \\mathcal{F}(S_t)$$\n\nWhere $S_t$ are the state variables governing time variation and $\\mathcal{F}$ is a forest. $X_t$ is typically a subset of $S_t$ which we want to emphasize and for which associated coefficients may be of economic interest. There are interesting special cases. For instance, $X_t$ could use lags of $y_t$ -- an autoregressive random forest (ARRF) – which will outperform RF when applied to persistent time series. Typically $X_t \\subset S_t$ is rather small (and focused) compared to $S_t$. \n\nThe new algorithm comes with some benefits. First, it can be interpreted. Its main output, Generalized Time-Varying Parameters (GTVPs) is a versatile device nesting many popular nonlinearities (threshold/switching, smooth transition, structural breaks/change). In the end, we simply get a linear equation with time-varying coefficients following a very general law of motion. The latter is powered by a large data set, and an algorithm particularly apt with complex nonlinearities and high-dimensionality. \n\nBy striking an appealing balance of efficiency and flexibility, it forecasts better. Most ML algorithms are designed for large cross-sectional data sets, whereas macroeconomics is characterized by short dependent time series. If persistence (or any other linear relationship) is pervasive, important efficiency gains ensue from modeling them directly. When measured against econometric approaches, MRF can again perform better, but now by being less rigid about $\\beta_t$'s law of motion and avoiding overfitting. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanlucas3%2Fmacrorandomforest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanlucas3%2Fmacrorandomforest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanlucas3%2Fmacrorandomforest/lists"}