gbrl 1.0.0.dev4__tar.gz → 1.0.0.dev5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. gbrl-1.0.0.dev5/PKG-INFO +120 -0
  2. gbrl-1.0.0.dev5/gbrl.egg-info/PKG-INFO +120 -0
  3. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/pyproject.toml +14 -1
  4. gbrl-1.0.0.dev4/PKG-INFO +0 -11
  5. gbrl-1.0.0.dev4/gbrl.egg-info/PKG-INFO +0 -11
  6. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/LICENSE +0 -0
  7. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/MANIFEST.in +0 -0
  8. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/README.md +0 -0
  9. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/__init__.py +0 -0
  10. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/ac_gbrl.py +0 -0
  11. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/config.py +0 -0
  12. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/gbrl_wrapper.py +0 -0
  13. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/gbt.py +0 -0
  14. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/config.h +0 -0
  15. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/fitter.cpp +0 -0
  16. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/fitter.h +0 -0
  17. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/gbrl.cpp +0 -0
  18. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/gbrl.h +0 -0
  19. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/gbrl_binding.cpp +0 -0
  20. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/loss.cpp +0 -0
  21. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/loss.h +0 -0
  22. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/main.cpp +0 -0
  23. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/math_ops.cpp +0 -0
  24. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/math_ops.h +0 -0
  25. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/node.cpp +0 -0
  26. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/node.h +0 -0
  27. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/optimizer.cpp +0 -0
  28. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/optimizer.h +0 -0
  29. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/predictor.cpp +0 -0
  30. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/predictor.h +0 -0
  31. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/scheduler.cpp +0 -0
  32. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/scheduler.h +0 -0
  33. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/split_candidate_generator.cpp +0 -0
  34. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/split_candidate_generator.h +0 -0
  35. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/types.cpp +0 -0
  36. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/types.h +0 -0
  37. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/utils.cpp +0 -0
  38. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cpp/utils.h +0 -0
  39. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_fitter.cu +0 -0
  40. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_fitter.h +0 -0
  41. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_loss.cu +0 -0
  42. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_loss.h +0 -0
  43. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_predictor.cu +0 -0
  44. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_predictor.h +0 -0
  45. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_preprocess.cu +0 -0
  46. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_preprocess.h +0 -0
  47. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_types.cu +0 -0
  48. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_types.h +0 -0
  49. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_utils.cu +0 -0
  50. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/src/cuda/cuda_utils.h +0 -0
  51. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl/utils.py +0 -0
  52. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl.egg-info/SOURCES.txt +0 -0
  53. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl.egg-info/dependency_links.txt +0 -0
  54. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl.egg-info/requires.txt +0 -0
  55. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/gbrl.egg-info/top_level.txt +0 -0
  56. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/setup.cfg +0 -0
  57. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/setup.py +0 -0
  58. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/tests/test_gbt_multi.py +0 -0
  59. {gbrl-1.0.0.dev4 → gbrl-1.0.0.dev5}/tests/test_gbt_single.py +0 -0
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.1
2
+ Name: gbrl
3
+ Version: 1.0.0.dev5
4
+ Summary: Gradient Boosted Trees for RL
5
+ Author-email: Benjamin Fuhrer <bfuhrer@nvidia.com>, Chen Tessler <ctessler@nvidia.com>, Gal Dalal <galal@nvidia.com>
6
+ Classifier: Development Status :: 4 - Beta
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: Other/Proprietary License
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: pybind11==2.11.1
18
+ Requires-Dist: numpy
19
+ Requires-Dist: torch
20
+ Provides-Extra: sklearn
21
+ Requires-Dist: scikit_learn==1.2.2; extra == "sklearn"
22
+
23
+ # Gradient Boosting Reinforcement Learning (GBRL)
24
+ GBRL is a Python-based GBT library designed and optimized for reinforcement learning (RL). GBRL is implemented in C++/CUDA aimed to seamlessly integrate within popular RL libraries.
25
+
26
+ ### Key Features:
27
+ - GBTs Tailored for RL: GBRL adapts the power of Gradient Boosting Trees to the unique challenges of RL environments, including non-stationarity and delayed feedback.
28
+ - Optimized Actor-Critic Architecture: GBRL features a shared tree-based structure for policy and value functions. This significantly reduces memory and computational overhead, enabling it to tackle complex, high-dimensional RL problems.
29
+ - Hardware Acceleration: GBRL leverages CUDA for hardware-accelerated computation, ensuring efficiency and speed.
30
+ - Seamless Integration: GBRL is designed for easy integration with popular RL libraries, making it readily accessible for practitioners.
31
+
32
+
33
+ ## Getting started
34
+
35
+ ### Dependencies
36
+ llvm
37
+ openmp
38
+
39
+ #### MAC OS
40
+
41
+ Make sure to run:
42
+ ```
43
+ brew install libomp
44
+ brew install llvm
45
+ ```
46
+
47
+ xcode command line tools should be installed installed
48
+
49
+ ### Installation
50
+ ```
51
+ pip install gbrl
52
+ ```
53
+
54
+ For GPU support GBRL looks for `CUDA_PATH` or `CUDA_HOME` environment variables. Unless found, GBRL will automatically compile only for CPU.
55
+
56
+ Verify that GPU is visible by running
57
+ ```
58
+ import gbrl
59
+
60
+ gbrl.cuda_available()
61
+ ```
62
+
63
+ *OPTIONAL*
64
+ For tree visualization make sure graphviz is installed before compilation.
65
+
66
+ ## Usage Example in an RL library
67
+ ```
68
+ import torch as th
69
+ from gbrl import ActorCriticGBRL
70
+ from stable_baselines3.common.distributions import CategoricalDistribution
71
+
72
+ ### initialize model ###
73
+ # define tree structure parameters
74
+ tree_struct = {'max_depth': 4, 'min_data_in_leaf': 0, 'n_bins': 256, 'grow_policy': 'oblivious'}
75
+ # define gbrl parameters
76
+ gbrl_params = {'control_variates': False, 'split_score_func': 'cosine', 'generator_type': 'Quantile'}
77
+ # actor and critic optimizers
78
+ policy_optimizer = {'algo': 'SGD', 'lr': 0.05}
79
+ value_optimizer = {'algo': 'SGD', lr: '0.25'}
80
+
81
+ # Given action_space instance of gym.spaces.Space
82
+
83
+ model = ActorCriticGBRL(tree_struct=tree_struct, output_dim=action_space.n, pg_optimizer=policy_optimizer, value_optimizer=value_optimizer, shared_tree_struct=True, gbrl_params=gbrl_params, device='cuda')
84
+ model.init_model()
85
+
86
+ action_dist = CategoricalDistribution(action_space.n)
87
+ ### Training loop ###
88
+ logits, values = model(obs, requires_grad=True) # returns numpy arrays
89
+
90
+ distribution = action_dist.proba_distribution(logits)
91
+ log_prob = distribution.log_prob(actions)
92
+
93
+ loss = ... calculate loss according to RL algorithm
94
+
95
+ loss.backward()
96
+
97
+ self.policy.step(obs)
98
+ ```
99
+
100
+ ## Current Supported Features
101
+ ### Tree Fitting
102
+ - Greedy (Depth-wise) tree building - (CPU/GPU)
103
+ - Oblivious (Symmetric) tree building - (CPU/GPU)
104
+ - L2 split score - (CPU/GPU)
105
+ - Cosine split score - (CPU/GPU)
106
+ - Uniform based candidate generation - (CPU/GPU)
107
+ - Quantile based candidate generation - (CPU/GPU)
108
+ - Supervised learning fitting / Multi-iteration fitting - (CPU/GPU)
109
+ - MultiRMSE loss (only)
110
+ - Categorical Inputs
111
+ ### GBT Inference
112
+ - SGD optimizer - (CPU/GPU)
113
+ - ADAM optimizer - (CPU only)
114
+ - Control Variates (gradient variance reduction technique) - (CPU only)
115
+ - Shared Tree for policy and value function - (CPU/GPU)
116
+ - Linear and constant learning rate scheduler - (CPU/GPU only constant)
117
+ - Support for up to two different optimizers (e.g, policy/value) - **(CPU/GPU if both are SGD)
118
+
119
+ ## Citing
120
+
@@ -0,0 +1,120 @@
1
+ Metadata-Version: 2.1
2
+ Name: gbrl
3
+ Version: 1.0.0.dev5
4
+ Summary: Gradient Boosted Trees for RL
5
+ Author-email: Benjamin Fuhrer <bfuhrer@nvidia.com>, Chen Tessler <ctessler@nvidia.com>, Gal Dalal <galal@nvidia.com>
6
+ Classifier: Development Status :: 4 - Beta
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: License :: Other/Proprietary License
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: pybind11==2.11.1
18
+ Requires-Dist: numpy
19
+ Requires-Dist: torch
20
+ Provides-Extra: sklearn
21
+ Requires-Dist: scikit_learn==1.2.2; extra == "sklearn"
22
+
23
+ # Gradient Boosting Reinforcement Learning (GBRL)
24
+ GBRL is a Python-based GBT library designed and optimized for reinforcement learning (RL). GBRL is implemented in C++/CUDA aimed to seamlessly integrate within popular RL libraries.
25
+
26
+ ### Key Features:
27
+ - GBTs Tailored for RL: GBRL adapts the power of Gradient Boosting Trees to the unique challenges of RL environments, including non-stationarity and delayed feedback.
28
+ - Optimized Actor-Critic Architecture: GBRL features a shared tree-based structure for policy and value functions. This significantly reduces memory and computational overhead, enabling it to tackle complex, high-dimensional RL problems.
29
+ - Hardware Acceleration: GBRL leverages CUDA for hardware-accelerated computation, ensuring efficiency and speed.
30
+ - Seamless Integration: GBRL is designed for easy integration with popular RL libraries, making it readily accessible for practitioners.
31
+
32
+
33
+ ## Getting started
34
+
35
+ ### Dependencies
36
+ llvm
37
+ openmp
38
+
39
+ #### MAC OS
40
+
41
+ Make sure to run:
42
+ ```
43
+ brew install libomp
44
+ brew install llvm
45
+ ```
46
+
47
+ xcode command line tools should be installed installed
48
+
49
+ ### Installation
50
+ ```
51
+ pip install gbrl
52
+ ```
53
+
54
+ For GPU support GBRL looks for `CUDA_PATH` or `CUDA_HOME` environment variables. Unless found, GBRL will automatically compile only for CPU.
55
+
56
+ Verify that GPU is visible by running
57
+ ```
58
+ import gbrl
59
+
60
+ gbrl.cuda_available()
61
+ ```
62
+
63
+ *OPTIONAL*
64
+ For tree visualization make sure graphviz is installed before compilation.
65
+
66
+ ## Usage Example in an RL library
67
+ ```
68
+ import torch as th
69
+ from gbrl import ActorCriticGBRL
70
+ from stable_baselines3.common.distributions import CategoricalDistribution
71
+
72
+ ### initialize model ###
73
+ # define tree structure parameters
74
+ tree_struct = {'max_depth': 4, 'min_data_in_leaf': 0, 'n_bins': 256, 'grow_policy': 'oblivious'}
75
+ # define gbrl parameters
76
+ gbrl_params = {'control_variates': False, 'split_score_func': 'cosine', 'generator_type': 'Quantile'}
77
+ # actor and critic optimizers
78
+ policy_optimizer = {'algo': 'SGD', 'lr': 0.05}
79
+ value_optimizer = {'algo': 'SGD', lr: '0.25'}
80
+
81
+ # Given action_space instance of gym.spaces.Space
82
+
83
+ model = ActorCriticGBRL(tree_struct=tree_struct, output_dim=action_space.n, pg_optimizer=policy_optimizer, value_optimizer=value_optimizer, shared_tree_struct=True, gbrl_params=gbrl_params, device='cuda')
84
+ model.init_model()
85
+
86
+ action_dist = CategoricalDistribution(action_space.n)
87
+ ### Training loop ###
88
+ logits, values = model(obs, requires_grad=True) # returns numpy arrays
89
+
90
+ distribution = action_dist.proba_distribution(logits)
91
+ log_prob = distribution.log_prob(actions)
92
+
93
+ loss = ... calculate loss according to RL algorithm
94
+
95
+ loss.backward()
96
+
97
+ self.policy.step(obs)
98
+ ```
99
+
100
+ ## Current Supported Features
101
+ ### Tree Fitting
102
+ - Greedy (Depth-wise) tree building - (CPU/GPU)
103
+ - Oblivious (Symmetric) tree building - (CPU/GPU)
104
+ - L2 split score - (CPU/GPU)
105
+ - Cosine split score - (CPU/GPU)
106
+ - Uniform based candidate generation - (CPU/GPU)
107
+ - Quantile based candidate generation - (CPU/GPU)
108
+ - Supervised learning fitting / Multi-iteration fitting - (CPU/GPU)
109
+ - MultiRMSE loss (only)
110
+ - Categorical Inputs
111
+ ### GBT Inference
112
+ - SGD optimizer - (CPU/GPU)
113
+ - ADAM optimizer - (CPU only)
114
+ - Control Variates (gradient variance reduction technique) - (CPU only)
115
+ - Shared Tree for policy and value function - (CPU/GPU)
116
+ - Linear and constant learning rate scheduler - (CPU/GPU only constant)
117
+ - Support for up to two different optimizers (e.g, policy/value) - **(CPU/GPU if both are SGD)
118
+
119
+ ## Citing
120
+
@@ -8,8 +8,9 @@ build-backend = "setuptools.build_meta"
8
8
 
9
9
  [project]
10
10
  name = "gbrl"
11
- version = "1.0.0.dev4"
11
+ version = "1.0.0.dev5"
12
12
  description = "Gradient Boosted Trees for RL"
13
+ readme = { file = "README.md", content-type = "text/markdown" }
13
14
  authors = [
14
15
  {name = "Benjamin Fuhrer", email = "bfuhrer@nvidia.com"},
15
16
  {name = "Chen Tessler", email = "ctessler@nvidia.com"},
@@ -20,6 +21,18 @@ dependencies = [
20
21
  "numpy",
21
22
  "torch"
22
23
  ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Intended Audience :: Developers",
27
+ "Intended Audience :: Science/Research",
28
+ "License :: Other/Proprietary License",
29
+ "Programming Language :: Python :: 3.9",
30
+ "Programming Language :: Python :: 3.10",
31
+ "Programming Language :: Python :: 3.11",
32
+ "Topic :: Software Development :: Libraries :: Python Modules"
33
+ ]
34
+
35
+ requires-python = ">=3.9"
23
36
 
24
37
  [project.optional-dependencies]
25
38
  sklearn = ["scikit_learn==1.2.2"]
gbrl-1.0.0.dev4/PKG-INFO DELETED
@@ -1,11 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: gbrl
3
- Version: 1.0.0.dev4
4
- Summary: Gradient Boosted Trees for RL
5
- Author-email: Benjamin Fuhrer <bfuhrer@nvidia.com>, Chen Tessler <ctessler@nvidia.com>, Gal Dalal <galal@nvidia.com>
6
- License-File: LICENSE
7
- Requires-Dist: pybind11==2.11.1
8
- Requires-Dist: numpy
9
- Requires-Dist: torch
10
- Provides-Extra: sklearn
11
- Requires-Dist: scikit_learn==1.2.2; extra == "sklearn"
@@ -1,11 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: gbrl
3
- Version: 1.0.0.dev4
4
- Summary: Gradient Boosted Trees for RL
5
- Author-email: Benjamin Fuhrer <bfuhrer@nvidia.com>, Chen Tessler <ctessler@nvidia.com>, Gal Dalal <galal@nvidia.com>
6
- License-File: LICENSE
7
- Requires-Dist: pybind11==2.11.1
8
- Requires-Dist: numpy
9
- Requires-Dist: torch
10
- Provides-Extra: sklearn
11
- Requires-Dist: scikit_learn==1.2.2; extra == "sklearn"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes