corerec 0.1.0__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 (169) hide show
  1. corerec-0.1.0/PKG-INFO +11 -0
  2. corerec-0.1.0/README.md +334 -0
  3. corerec-0.1.0/corerec.egg-info/PKG-INFO +11 -0
  4. corerec-0.1.0/corerec.egg-info/SOURCES.txt +167 -0
  5. corerec-0.1.0/corerec.egg-info/dependency_links.txt +1 -0
  6. corerec-0.1.0/corerec.egg-info/requires.txt +1 -0
  7. corerec-0.1.0/corerec.egg-info/top_level.txt +1 -0
  8. corerec-0.1.0/engine/Tmodel.py +35 -0
  9. corerec-0.1.0/engine/__init__.py +106 -0
  10. corerec-0.1.0/engine/async_ddp.py +87 -0
  11. corerec-0.1.0/engine/common_import.py +24 -0
  12. corerec-0.1.0/engine/core_rec.py +47 -0
  13. corerec-0.1.0/engine/cr_boosters/__init__.py +38 -0
  14. corerec-0.1.0/engine/cr_boosters/_functional.py +84 -0
  15. corerec-0.1.0/engine/cr_boosters/_multi_tensor/__init__.py +30 -0
  16. corerec-0.1.0/engine/cr_boosters/_multi_tensor/__init__.pyi +15 -0
  17. corerec-0.1.0/engine/cr_boosters/adadelta.py +452 -0
  18. corerec-0.1.0/engine/cr_boosters/adagrad.py +555 -0
  19. corerec-0.1.0/engine/cr_boosters/adam.py +790 -0
  20. corerec-0.1.0/engine/cr_boosters/adamax.py +463 -0
  21. corerec-0.1.0/engine/cr_boosters/asgd.py +454 -0
  22. corerec-0.1.0/engine/cr_boosters/lbfgs.py +488 -0
  23. corerec-0.1.0/engine/cr_boosters/lr_scheduler.py +2151 -0
  24. corerec-0.1.0/engine/cr_boosters/nadam.py +639 -0
  25. corerec-0.1.0/engine/cr_boosters/optimizer.py +1052 -0
  26. corerec-0.1.0/engine/cr_boosters/radam.py +598 -0
  27. corerec-0.1.0/engine/cr_boosters/rmsprop.py +510 -0
  28. corerec-0.1.0/engine/cr_boosters/sgd.py +504 -0
  29. corerec-0.1.0/engine/cr_boosters/sparse_adam.py +181 -0
  30. corerec-0.1.0/engine/cr_boosters/swa_utils.py +463 -0
  31. corerec-0.1.0/engine/datasets.py +82 -0
  32. corerec-0.1.0/engine/metrics.py +67 -0
  33. corerec-0.1.0/engine/models.py +223 -0
  34. corerec-0.1.0/engine/predict.py +64 -0
  35. corerec-0.1.0/engine/timecapsule.py +263 -0
  36. corerec-0.1.0/engine/torch_nn/__init__.py +61 -0
  37. corerec-0.1.0/engine/torch_nn/_reduction.py +60 -0
  38. corerec-0.1.0/engine/torch_nn/attention/__init__.py +129 -0
  39. corerec-0.1.0/engine/torch_nn/attention/_flex_attention.py +488 -0
  40. corerec-0.1.0/engine/torch_nn/attention/_utils.py +59 -0
  41. corerec-0.1.0/engine/torch_nn/attention/bias.py +354 -0
  42. corerec-0.1.0/engine/torch_nn/backends/__init__.py +0 -0
  43. corerec-0.1.0/engine/torch_nn/backends/thnn.py +6 -0
  44. corerec-0.1.0/engine/torch_nn/common_types.py +44 -0
  45. corerec-0.1.0/engine/torch_nn/cpp.py +89 -0
  46. corerec-0.1.0/engine/torch_nn/functional.py +6259 -0
  47. corerec-0.1.0/engine/torch_nn/grad.py +298 -0
  48. corerec-0.1.0/engine/torch_nn/init.py +665 -0
  49. corerec-0.1.0/engine/torch_nn/intrinsic/__init__.py +35 -0
  50. corerec-0.1.0/engine/torch_nn/intrinsic/modules/__init__.py +31 -0
  51. corerec-0.1.0/engine/torch_nn/intrinsic/modules/fused.py +30 -0
  52. corerec-0.1.0/engine/torch_nn/intrinsic/qat/__init__.py +1 -0
  53. corerec-0.1.0/engine/torch_nn/intrinsic/qat/modules/__init__.py +31 -0
  54. corerec-0.1.0/engine/torch_nn/intrinsic/qat/modules/conv_fused.py +37 -0
  55. corerec-0.1.0/engine/torch_nn/intrinsic/qat/modules/linear_fused.py +15 -0
  56. corerec-0.1.0/engine/torch_nn/intrinsic/qat/modules/linear_relu.py +15 -0
  57. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/__init__.py +13 -0
  58. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/dynamic/__init__.py +1 -0
  59. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/dynamic/modules/__init__.py +5 -0
  60. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/dynamic/modules/linear_relu.py +5 -0
  61. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/modules/__init__.py +12 -0
  62. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/modules/bn_relu.py +7 -0
  63. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/modules/conv_relu.py +9 -0
  64. corerec-0.1.0/engine/torch_nn/intrinsic/quantized/modules/linear_relu.py +5 -0
  65. corerec-0.1.0/engine/torch_nn/modules/__init__.py +334 -0
  66. corerec-0.1.0/engine/torch_nn/modules/_functions.py +319 -0
  67. corerec-0.1.0/engine/torch_nn/modules/activation.py +1746 -0
  68. corerec-0.1.0/engine/torch_nn/modules/adaptive.py +330 -0
  69. corerec-0.1.0/engine/torch_nn/modules/batchnorm.py +883 -0
  70. corerec-0.1.0/engine/torch_nn/modules/channelshuffle.py +56 -0
  71. corerec-0.1.0/engine/torch_nn/modules/container.py +967 -0
  72. corerec-0.1.0/engine/torch_nn/modules/conv.py +1852 -0
  73. corerec-0.1.0/engine/torch_nn/modules/distance.py +93 -0
  74. corerec-0.1.0/engine/torch_nn/modules/dropout.py +305 -0
  75. corerec-0.1.0/engine/torch_nn/modules/flatten.py +158 -0
  76. corerec-0.1.0/engine/torch_nn/modules/fold.py +315 -0
  77. corerec-0.1.0/engine/torch_nn/modules/instancenorm.py +471 -0
  78. corerec-0.1.0/engine/torch_nn/modules/lazy.py +289 -0
  79. corerec-0.1.0/engine/torch_nn/modules/linear.py +293 -0
  80. corerec-0.1.0/engine/torch_nn/modules/loss.py +1993 -0
  81. corerec-0.1.0/engine/torch_nn/modules/module.py +2889 -0
  82. corerec-0.1.0/engine/torch_nn/modules/normalization.py +415 -0
  83. corerec-0.1.0/engine/torch_nn/modules/padding.py +813 -0
  84. corerec-0.1.0/engine/torch_nn/modules/pixelshuffle.py +115 -0
  85. corerec-0.1.0/engine/torch_nn/modules/pooling.py +1494 -0
  86. corerec-0.1.0/engine/torch_nn/modules/rnn.py +1823 -0
  87. corerec-0.1.0/engine/torch_nn/modules/sparse.py +546 -0
  88. corerec-0.1.0/engine/torch_nn/modules/transformer.py +1198 -0
  89. corerec-0.1.0/engine/torch_nn/modules/upsampling.py +293 -0
  90. corerec-0.1.0/engine/torch_nn/modules/utils.py +81 -0
  91. corerec-0.1.0/engine/torch_nn/parallel/__init__.py +28 -0
  92. corerec-0.1.0/engine/torch_nn/parallel/_functions.py +136 -0
  93. corerec-0.1.0/engine/torch_nn/parallel/comm.py +260 -0
  94. corerec-0.1.0/engine/torch_nn/parallel/data_parallel.py +286 -0
  95. corerec-0.1.0/engine/torch_nn/parallel/distributed.py +2401 -0
  96. corerec-0.1.0/engine/torch_nn/parallel/parallel_apply.py +130 -0
  97. corerec-0.1.0/engine/torch_nn/parallel/replicate.py +213 -0
  98. corerec-0.1.0/engine/torch_nn/parallel/scatter_gather.py +139 -0
  99. corerec-0.1.0/engine/torch_nn/parameter.py +231 -0
  100. corerec-0.1.0/engine/torch_nn/parameter.pyi +29 -0
  101. corerec-0.1.0/engine/torch_nn/qat/__init__.py +18 -0
  102. corerec-0.1.0/engine/torch_nn/qat/dynamic/__init__.py +7 -0
  103. corerec-0.1.0/engine/torch_nn/qat/dynamic/modules/__init__.py +3 -0
  104. corerec-0.1.0/engine/torch_nn/qat/dynamic/modules/linear.py +10 -0
  105. corerec-0.1.0/engine/torch_nn/qat/modules/__init__.py +24 -0
  106. corerec-0.1.0/engine/torch_nn/qat/modules/conv.py +12 -0
  107. corerec-0.1.0/engine/torch_nn/qat/modules/embedding_ops.py +14 -0
  108. corerec-0.1.0/engine/torch_nn/qat/modules/linear.py +10 -0
  109. corerec-0.1.0/engine/torch_nn/quantizable/__init__.py +1 -0
  110. corerec-0.1.0/engine/torch_nn/quantizable/modules/__init__.py +9 -0
  111. corerec-0.1.0/engine/torch_nn/quantizable/modules/activation.py +10 -0
  112. corerec-0.1.0/engine/torch_nn/quantizable/modules/rnn.py +11 -0
  113. corerec-0.1.0/engine/torch_nn/quantized/__init__.py +40 -0
  114. corerec-0.1.0/engine/torch_nn/quantized/_reference/__init__.py +1 -0
  115. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/__init__.py +31 -0
  116. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/conv.py +19 -0
  117. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/linear.py +12 -0
  118. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/rnn.py +17 -0
  119. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/sparse.py +13 -0
  120. corerec-0.1.0/engine/torch_nn/quantized/_reference/modules/utils.py +15 -0
  121. corerec-0.1.0/engine/torch_nn/quantized/dynamic/__init__.py +1 -0
  122. corerec-0.1.0/engine/torch_nn/quantized/dynamic/modules/__init__.py +32 -0
  123. corerec-0.1.0/engine/torch_nn/quantized/dynamic/modules/conv.py +18 -0
  124. corerec-0.1.0/engine/torch_nn/quantized/dynamic/modules/linear.py +10 -0
  125. corerec-0.1.0/engine/torch_nn/quantized/dynamic/modules/rnn.py +22 -0
  126. corerec-0.1.0/engine/torch_nn/quantized/functional.py +10 -0
  127. corerec-0.1.0/engine/torch_nn/quantized/modules/__init__.py +70 -0
  128. corerec-0.1.0/engine/torch_nn/quantized/modules/activation.py +18 -0
  129. corerec-0.1.0/engine/torch_nn/quantized/modules/batchnorm.py +12 -0
  130. corerec-0.1.0/engine/torch_nn/quantized/modules/conv.py +21 -0
  131. corerec-0.1.0/engine/torch_nn/quantized/modules/dropout.py +13 -0
  132. corerec-0.1.0/engine/torch_nn/quantized/modules/embedding_ops.py +15 -0
  133. corerec-0.1.0/engine/torch_nn/quantized/modules/functional_modules.py +15 -0
  134. corerec-0.1.0/engine/torch_nn/quantized/modules/linear.py +14 -0
  135. corerec-0.1.0/engine/torch_nn/quantized/modules/normalization.py +17 -0
  136. corerec-0.1.0/engine/torch_nn/quantized/modules/rnn.py +11 -0
  137. corerec-0.1.0/engine/torch_nn/quantized/modules/utils.py +15 -0
  138. corerec-0.1.0/engine/torch_nn/utils/__init__.py +39 -0
  139. corerec-0.1.0/engine/torch_nn/utils/_deprecation_utils.py +54 -0
  140. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/__init__.py +10 -0
  141. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/conv_expanded_weights.py +68 -0
  142. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/conv_utils.py +353 -0
  143. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/embedding_expanded_weights.py +83 -0
  144. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/expanded_weights_impl.py +182 -0
  145. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/expanded_weights_utils.py +188 -0
  146. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/group_norm_expanded_weights.py +104 -0
  147. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/instance_norm_expanded_weights.py +100 -0
  148. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/layer_norm_expanded_weights.py +87 -0
  149. corerec-0.1.0/engine/torch_nn/utils/_expanded_weights/linear_expanded_weights.py +62 -0
  150. corerec-0.1.0/engine/torch_nn/utils/_named_member_accessor.py +374 -0
  151. corerec-0.1.0/engine/torch_nn/utils/_per_sample_grad.py +124 -0
  152. corerec-0.1.0/engine/torch_nn/utils/clip_grad.py +187 -0
  153. corerec-0.1.0/engine/torch_nn/utils/convert_parameters.py +90 -0
  154. corerec-0.1.0/engine/torch_nn/utils/fusion.py +189 -0
  155. corerec-0.1.0/engine/torch_nn/utils/init.py +55 -0
  156. corerec-0.1.0/engine/torch_nn/utils/memory_format.py +152 -0
  157. corerec-0.1.0/engine/torch_nn/utils/parametrizations.py +628 -0
  158. corerec-0.1.0/engine/torch_nn/utils/parametrize.py +818 -0
  159. corerec-0.1.0/engine/torch_nn/utils/prune.py +1374 -0
  160. corerec-0.1.0/engine/torch_nn/utils/rnn.py +554 -0
  161. corerec-0.1.0/engine/torch_nn/utils/rnn.pyi +89 -0
  162. corerec-0.1.0/engine/torch_nn/utils/spectral_norm.py +366 -0
  163. corerec-0.1.0/engine/torch_nn/utils/stateless.py +271 -0
  164. corerec-0.1.0/engine/torch_nn/utils/weight_norm.py +164 -0
  165. corerec-0.1.0/engine/train.py +31 -0
  166. corerec-0.1.0/engine/vish_graphs.py +444 -0
  167. corerec-0.1.0/engine/visualization.py +34 -0
  168. corerec-0.1.0/setup.cfg +4 -0
  169. corerec-0.1.0/setup.py +19 -0
corerec-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: corerec
3
+ Version: 0.1.0
4
+ Summary: Graph-based recommendation systems using neural network architectures.
5
+ Author: Vishesh
6
+ Author-email: your-email@example.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Requires-Dist: numpy
@@ -0,0 +1,334 @@
1
+ <div align="center">
2
+ <img src="docs/images/coreRec.svg" style="vertical-align: middle; margin-right: 0px; margin-bottom: 20px;" width="70" height="70">
3
+ <h1>CoreRec & VishGraphs Manual</h1>
4
+ </div>
5
+
6
+ Discover the power of graph analysis and recommendation with CoreRec & VishGraphs. Dive into our comprehensive manual and explore the endless possibilities.
7
+
8
+ <h2>
9
+ <img src="docs/images/intro.png" style="vertical-align: middle; margin-right: 8px;" width="30" height="30">
10
+ Introduction
11
+ </h2>
12
+
13
+ CoreRec is your all-in-one recommendation engine for graph-based algorithms. Seamlessly integrating advanced neural network architectures, CoreRec excels in node recommendations, model training, and graph visualizations, making it the ultimate tool for data scientists and researchers.
14
+ VishGraphs is your ultimate Python library for graph visualization and analysis. Whether you're a data scientist, researcher, or hobbyist, VishGraphs offers intuitive tools to generate, visualize, and analyze graphs effortlessly.
15
+
16
+ <h2>
17
+ <img src="docs/images/feature.png" style="vertical-align: middle; margin-right: 10px;" width="40" height="38">
18
+ Features
19
+ </h2>
20
+
21
+
22
+ #### core_rec.py
23
+
24
+ - **`GraphTransformer(num_layers, d_model, num_heads, d_feedforward, input_dim)`**
25
+ - A Transformer model for graph data with customizable parameters.
26
+
27
+ - **`GraphDataset(adj_matrix)`**
28
+ - A PyTorch dataset for graph data, streamlining model training.
29
+
30
+ - **`train_model(model, data_loader, criterion=False, optimizer=False, num_epochs=False)`**
31
+ - Train your model with ease using our flexible training function.
32
+
33
+ - **`predict(model, graph, node_index, top_k=5)`**
34
+ - Predict similar nodes with precision using trained models.
35
+
36
+ - **`aaj_accuracy(graph, node_index, recommended_indices)`**
37
+ - Measure the accuracy of your recommendations with our robust metrics.
38
+
39
+ #### vish_graphs.py
40
+
41
+ - **`generate_large_random_graph(num_people, file_path="large_random_graph.csv", seed=None)`**
42
+ - Generate and save large random graphs effortlessly.
43
+
44
+ - **`draw_graph(adj_matrix, top_nodes=None, recommended_nodes=None, node_labels=None, transparent_labeled=True, edge_weights=None)`**
45
+ - Create stunning 2D visualizations of your graphs.
46
+
47
+ - **`draw_graph_3d(adj_matrix, top_nodes=None, recommended_nodes=None, node_labels=None, transparent_labeled=True, edge_weights=None)`**
48
+ - Experience your graphs in 3D with customizable features.
49
+
50
+ - **`show_bipartite_relationship(adj_matrix)`**
51
+ - Visualize bipartite relationships with clarity.
52
+
53
+ <h2>
54
+ <img src="docs/images/install.png" style="vertical-align: middle; margin-right: 10px;" width="40" height="38">
55
+ Installation
56
+ </h2>
57
+
58
+ For security reasons, we are not providing the pip install command at this time.
59
+
60
+ Simply copy the files "`vish_graphs.py`", "`core_rec.py`", and "`common_imports.py`" to your project folder and import them.
61
+
62
+ ### Or;
63
+
64
+ ### For Windows Users
65
+ Set the Python path using the `set` command or copy and paste this in the command prompt:
66
+
67
+ ```
68
+ set PATH "%PATH%;C:\path\to\your\CoreRecRepo"
69
+ ```
70
+
71
+ ### For Mac Users
72
+
73
+ Set the Python path using the `export` command or copy and paste this in the terminal:
74
+
75
+ ```
76
+ export PATH="$PATH:/path/to/your/CoreRecRepo"
77
+ ```
78
+
79
+
80
+ <h2>
81
+ <img src="docs/images/coreRec.svg" style="vertical-align: middle; margin-right: 0px;" width="40" height="40">
82
+ CoreRec Manual
83
+ </h2>
84
+
85
+ <h3>
86
+ <img src="docs/images/star.png" style="vertical-align: middle; margin-right: 0px;" width="20" height="20">
87
+ Table of Contents
88
+ </h3>
89
+
90
+ 1. [Introduction](#introduction)
91
+ 2. [Installation](#installation)
92
+ 3. [Usage](#usage)
93
+ - [Generating Random Graphs](#generating-random-graphs)
94
+ - [Drawing Graphs](#drawing-graphs)
95
+ 4. [Directory Structure](#directory-structure)
96
+ 5. [Troubleshooting](#troubleshooting)
97
+ 6. [Contributing](#contributing)
98
+ 7. [License](#license)
99
+
100
+ # Introduction
101
+ - CoreRec:
102
+ CoreRec is a cutting-edge recommendation engine for graph data analysis and visualization. It excels in recommending similar nodes, training machine learning models, and visualizing complex network structures.
103
+ - VishGraphs:
104
+ VishGraphs is a Python library designed for graph visualization and analysis. It offers tools for generating random graphs, drawing graphs in 2D and 3D, and analyzing graph properties.
105
+
106
+ <h3>
107
+ <img src="docs/images/struct.png" style="vertical-align: middle; margin-right: 0px;" width="40" height="40">
108
+ Directory Structure
109
+ </h3>
110
+
111
+ <table>
112
+ <thead>
113
+ <tr>
114
+ <th> Description </th>
115
+ <th> Quick Access </th>
116
+ </tr>
117
+ </thead>
118
+ <tbody>
119
+ <!-- Row boilerplate (copy-paste the following commented snippet for adding a new row to the table.)
120
+ <tr> <td> <h3> title </h3>
121
+ description
122
+ </td> <td> <pre>
123
+ folders
124
+ </pre> </td> </tr>
125
+ -->
126
+ <tr> <td> <h3> engine </h3>
127
+ Contains core engine components and utilities.
128
+ </td> <td> <pre>
129
+ └── engine
130
+ ├── cr_boosters/
131
+ ├── cr_pkg/
132
+ ├── cr_utility/
133
+ ├── torch_nn/
134
+ ├── async_dpp.py
135
+ ├── common_import.py
136
+ ├── core_rec.py
137
+ ├── datasets.py
138
+ ├── metrics.py
139
+ ├── model.py
140
+ ├── predict.py
141
+ ├── timecapsule.py
142
+ ├── Tmodel.py
143
+ ├── train.py
144
+ ├── vish_graphs.py
145
+ └── visulization.py
146
+ </pre> </td> </tr>
147
+
148
+ <tr> <td> <h3> Roadmap </h3>
149
+ Contains documents related to future updates and use cases.
150
+ </td> <td> <pre>
151
+ └── roadmap
152
+ ├── futureupdates.md
153
+ ├── Readme.pdf
154
+ └── usecases.pdf
155
+ </pre> </td> </tr>
156
+
157
+ <tr> <td> <h3> src </h3>
158
+ Contains the main source code and use cases.
159
+ </td> <td> <pre>
160
+ └── src
161
+ ├── backup/
162
+ ├── CoreRec/
163
+ ├── SANDBOX/
164
+ └── USECASES
165
+ ├── custommodel.py
166
+ ├── customthreshold.py
167
+ ├── labels.py
168
+ └── custommodel.py
169
+ </pre> </td> </tr>
170
+
171
+ <tr> <td> <h3> Vish Graphs </h3>
172
+ Contains build and distribution files for Vish Graphs.
173
+ </td> <td> <pre>
174
+ └── vish_graphs
175
+ ├── build/
176
+ ├── dist/
177
+ └── vish_graphs/
178
+ </pre> </td> </tr>
179
+
180
+ </tbody>
181
+ </table>
182
+
183
+
184
+ # Usage
185
+ ### Generating Random Graphs
186
+ Generate random graphs effortlessly with the `generate_random_graph` function:
187
+
188
+ ```python
189
+ import vish_graphs as vg
190
+ graph_file = vg.generate_random_graph(10, "random_graph.csv")
191
+ ```
192
+
193
+ # The use cases are:-
194
+ ## 🔍 Delve into Advanced Graph Analysis and Recommendation with VishGraphs and CoreRec! 🚀
195
+ Welcome to a world of cutting-edge graph analysis and recommendation tools brought to you by VishGraphs and CoreRec. Uncover the potential of data visualization and machine learning in a sophisticated manner.
196
+
197
+ [🔗 Explore Detailed UseCases Here 🔗](https://github.com/vishesh9131/CoreRec/blob/main/USECASES/usecases.md)
198
+
199
+ ## CoreRec
200
+
201
+ ```python
202
+ import core_rec as cs
203
+ ```
204
+ ### 1. `recommend_similar_nodes(adj_matrix, node)`
205
+
206
+ Recommends similar nodes based on cosine similarity scores calculated from the adjacency matrix.
207
+
208
+ **Use case:** Providing recommendations for nodes based on their similarity within a graph.
209
+
210
+ ### 2. `GraphTransformer(num_layers, d_model, num_heads, d_feedforward, input_dim)`
211
+
212
+ Defines a Transformer model for graph data with customizable parameters.
213
+
214
+ **Use case:** Training machine learning models for graph-related tasks, such as node classification or link prediction.
215
+
216
+ ### 3. `GraphDataset(adj_matrix)`
217
+
218
+ Defines a PyTorch dataset for graph data, allowing easy integration with DataLoader for model training.
219
+
220
+ **Use case:** Preparing graph data for training machine learning models.
221
+
222
+ ### 4. `train_model(model, data_loader, criterion, optimizer, num_epochs)`
223
+
224
+ Trains a given model using the provided data loader, loss function, optimizer, and number of epochs.
225
+
226
+ **Use case:** Training machine learning models for graph-related tasks using graph data.
227
+
228
+ In the `test.py` file, various functionalities from `vishgraphs.py` and `core_rec.py` are utilized and demonstrated:
229
+ - Random graph generation (`generate_random_graph`).
230
+ - Identification of top nodes in a graph (`find_top_nodes`).
231
+ - Training a Transformer model for graph data (`GraphTransformer`, `GraphDataset`, `train_model`).
232
+ - Recommending similar nodes using a trained model (`recommend_similar_nodes`).
233
+ - Visualization of a graph in 3D (`draw_graph_3d`).
234
+
235
+ ## vishgraphs
236
+
237
+ ```python
238
+ import vishgraphs as vg
239
+ ```
240
+ ### 1. `generate_random_graph(num_people, file_path="graph_dataset.csv", seed=None)`
241
+
242
+ Generate a random graph with a specified number of people and save the adjacency matrix to a CSV file.
243
+
244
+ **Use case:** Generating synthetic graph data for testing algorithms or simulations.
245
+
246
+ ### 2. `draw_graph(adj_matrix, nodes, top_nodes)`
247
+
248
+ Draw a 2D visualization of a graph based on its adjacency matrix, highlighting top nodes if specified.
249
+
250
+ **Use case:** Visualizing relationships within a graph dataset.
251
+
252
+ ### 3. `find_top_nodes(matrix, num_nodes=10)`
253
+
254
+ Identify the top nodes with the greatest number of strong correlations in a graph.
255
+
256
+ **Use case:** Identifying influential or highly connected nodes in a network.
257
+
258
+ ### 4. `draw_graph_3d(adj_matrix, nodes, top_nodes)`
259
+
260
+ Create a 3D visualization of a graph based on its adjacency matrix, with optional highlighting of top nodes.
261
+
262
+ **Use case:** Visualizing complex network structures in a three-dimensional space.
263
+
264
+ ### 5. `show_bipartite_relationship_with_cosine(adj_matrix)`
265
+
266
+ Visualize bipartite relationships in a graph using cosine similarity and community detection algorithms.
267
+
268
+ **Use case:** Analyzing relationships between different sets of nodes in a bipartite graph.
269
+
270
+ ### 6. `bipartite_matrix_maker(csv_path)`
271
+
272
+ Read a CSV file containing a bipartite adjacency matrix and return it as a list.
273
+
274
+ **Use case:** Preparing data for analyzing bipartite networks.
275
+
276
+ ---
277
+
278
+ Explore the codebase and utilize these functionalities for your graph analysis and recommendation tasks! If you have any questions or need further assistance, don't hesitate to reach out. Happy graph analyzing! 📊🔍
279
+
280
+ ### Drawing Graphs
281
+ VishGraphs supports drawing graphs in both 2D and 3D:
282
+
283
+ ```python
284
+ adj_matrix = vishgraphs.bipartite_matrix_maker(graph_file)
285
+ nodes = list(range(len(adj_matrix)))
286
+ top_nodes = [0, 1, 2] # Example top nodes
287
+ vishgraphs.draw_graph(adj_matrix, nodes, top_nodes)
288
+ ```
289
+
290
+ <h3>
291
+ <img src="docs/images/trouble.png" style="vertical-align: middle; margin-right: 0px;" width="40" height="40">
292
+ Troubleshooting
293
+ </h3>
294
+
295
+ ### Troubleshooting Guide
296
+
297
+ For issues with CoreRec and VishGraphs:
298
+
299
+ 1. **Check Documentation:** Ensure you're following the library's guidelines and examples correctly.
300
+ 2. **GitHub Issues:** Report bugs or seek help by creating an issue on the GitHub repository.
301
+ 3. **Verify Data:** Confirm that your input data is correctly formatted and compatible.
302
+ 4. **Model Parameters:** Double-check model configurations and training parameters.
303
+ 5. **Visualization Inputs:** Ensure correct parameters for graph visualization functions.
304
+ 6. **Community Help:** Utilize community forums for additional support.
305
+
306
+ This streamlined approach should help resolve common issues efficiently.
307
+
308
+ <h3>
309
+ <img src="docs/images/cont.png" style="vertical-align: middle; margin-right: 0px;" width="40" height="40">
310
+ Contributing
311
+ </h3>
312
+
313
+ We welcome contributions to enhance the functionalities of our graph analysis and recommendation tools. If you're interested in contributing, here are a few ways you can help:
314
+
315
+ - **Bug Fixes:** Identify and fix bugs in the existing code.
316
+ - **Feature Enhancements:** Suggest and implement improvements to current features.
317
+ - **New Features:** Propose and develop new features that could benefit users of the libraries.
318
+ - **Documentation:** Help improve the documentation to make the libraries more user-friendly.
319
+
320
+ ### To contribute, please follow these steps:
321
+ 1. Fork the repository.
322
+ 2. Create a new branch for your feature or fix.
323
+ 3. Develop your changes while adhering to the coding standards and guidelines.
324
+ 4. Submit a pull request with a clear description of the changes and any relevant issue numbers.
325
+
326
+ Your contributions are greatly appreciated and will help make these tools more effective and accessible to everyone!
327
+
328
+ <h3>
329
+ <img src="docs/images/lic.png" style="vertical-align: middle; margin-right: 0px;" width="40" height="40">
330
+ License
331
+ </h3>
332
+ VishGraphs is distributed under the following terms:
333
+
334
+ >The library and utilities are only for research purposes. Please do not use it commercially without the author's (@Vishesh9131) consent.
@@ -0,0 +1,11 @@
1
+ Metadata-Version: 2.1
2
+ Name: corerec
3
+ Version: 0.1.0
4
+ Summary: Graph-based recommendation systems using neural network architectures.
5
+ Author: Vishesh
6
+ Author-email: your-email@example.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.6
11
+ Requires-Dist: numpy
@@ -0,0 +1,167 @@
1
+ README.md
2
+ setup.py
3
+ corerec.egg-info/PKG-INFO
4
+ corerec.egg-info/SOURCES.txt
5
+ corerec.egg-info/dependency_links.txt
6
+ corerec.egg-info/requires.txt
7
+ corerec.egg-info/top_level.txt
8
+ engine/Tmodel.py
9
+ engine/__init__.py
10
+ engine/async_ddp.py
11
+ engine/common_import.py
12
+ engine/core_rec.py
13
+ engine/datasets.py
14
+ engine/metrics.py
15
+ engine/models.py
16
+ engine/predict.py
17
+ engine/timecapsule.py
18
+ engine/train.py
19
+ engine/vish_graphs.py
20
+ engine/visualization.py
21
+ engine/cr_boosters/__init__.py
22
+ engine/cr_boosters/_functional.py
23
+ engine/cr_boosters/adadelta.py
24
+ engine/cr_boosters/adagrad.py
25
+ engine/cr_boosters/adam.py
26
+ engine/cr_boosters/adamax.py
27
+ engine/cr_boosters/asgd.py
28
+ engine/cr_boosters/lbfgs.py
29
+ engine/cr_boosters/lr_scheduler.py
30
+ engine/cr_boosters/nadam.py
31
+ engine/cr_boosters/optimizer.py
32
+ engine/cr_boosters/radam.py
33
+ engine/cr_boosters/rmsprop.py
34
+ engine/cr_boosters/sgd.py
35
+ engine/cr_boosters/sparse_adam.py
36
+ engine/cr_boosters/swa_utils.py
37
+ engine/cr_boosters/_multi_tensor/__init__.py
38
+ engine/cr_boosters/_multi_tensor/__init__.pyi
39
+ engine/torch_nn/__init__.py
40
+ engine/torch_nn/_reduction.py
41
+ engine/torch_nn/common_types.py
42
+ engine/torch_nn/cpp.py
43
+ engine/torch_nn/functional.py
44
+ engine/torch_nn/grad.py
45
+ engine/torch_nn/init.py
46
+ engine/torch_nn/parameter.py
47
+ engine/torch_nn/parameter.pyi
48
+ engine/torch_nn/attention/__init__.py
49
+ engine/torch_nn/attention/_flex_attention.py
50
+ engine/torch_nn/attention/_utils.py
51
+ engine/torch_nn/attention/bias.py
52
+ engine/torch_nn/backends/__init__.py
53
+ engine/torch_nn/backends/thnn.py
54
+ engine/torch_nn/intrinsic/__init__.py
55
+ engine/torch_nn/intrinsic/modules/__init__.py
56
+ engine/torch_nn/intrinsic/modules/fused.py
57
+ engine/torch_nn/intrinsic/qat/__init__.py
58
+ engine/torch_nn/intrinsic/qat/modules/__init__.py
59
+ engine/torch_nn/intrinsic/qat/modules/conv_fused.py
60
+ engine/torch_nn/intrinsic/qat/modules/linear_fused.py
61
+ engine/torch_nn/intrinsic/qat/modules/linear_relu.py
62
+ engine/torch_nn/intrinsic/quantized/__init__.py
63
+ engine/torch_nn/intrinsic/quantized/dynamic/__init__.py
64
+ engine/torch_nn/intrinsic/quantized/dynamic/modules/__init__.py
65
+ engine/torch_nn/intrinsic/quantized/dynamic/modules/linear_relu.py
66
+ engine/torch_nn/intrinsic/quantized/modules/__init__.py
67
+ engine/torch_nn/intrinsic/quantized/modules/bn_relu.py
68
+ engine/torch_nn/intrinsic/quantized/modules/conv_relu.py
69
+ engine/torch_nn/intrinsic/quantized/modules/linear_relu.py
70
+ engine/torch_nn/modules/__init__.py
71
+ engine/torch_nn/modules/_functions.py
72
+ engine/torch_nn/modules/activation.py
73
+ engine/torch_nn/modules/adaptive.py
74
+ engine/torch_nn/modules/batchnorm.py
75
+ engine/torch_nn/modules/channelshuffle.py
76
+ engine/torch_nn/modules/container.py
77
+ engine/torch_nn/modules/conv.py
78
+ engine/torch_nn/modules/distance.py
79
+ engine/torch_nn/modules/dropout.py
80
+ engine/torch_nn/modules/flatten.py
81
+ engine/torch_nn/modules/fold.py
82
+ engine/torch_nn/modules/instancenorm.py
83
+ engine/torch_nn/modules/lazy.py
84
+ engine/torch_nn/modules/linear.py
85
+ engine/torch_nn/modules/loss.py
86
+ engine/torch_nn/modules/module.py
87
+ engine/torch_nn/modules/normalization.py
88
+ engine/torch_nn/modules/padding.py
89
+ engine/torch_nn/modules/pixelshuffle.py
90
+ engine/torch_nn/modules/pooling.py
91
+ engine/torch_nn/modules/rnn.py
92
+ engine/torch_nn/modules/sparse.py
93
+ engine/torch_nn/modules/transformer.py
94
+ engine/torch_nn/modules/upsampling.py
95
+ engine/torch_nn/modules/utils.py
96
+ engine/torch_nn/parallel/__init__.py
97
+ engine/torch_nn/parallel/_functions.py
98
+ engine/torch_nn/parallel/comm.py
99
+ engine/torch_nn/parallel/data_parallel.py
100
+ engine/torch_nn/parallel/distributed.py
101
+ engine/torch_nn/parallel/parallel_apply.py
102
+ engine/torch_nn/parallel/replicate.py
103
+ engine/torch_nn/parallel/scatter_gather.py
104
+ engine/torch_nn/qat/__init__.py
105
+ engine/torch_nn/qat/dynamic/__init__.py
106
+ engine/torch_nn/qat/dynamic/modules/__init__.py
107
+ engine/torch_nn/qat/dynamic/modules/linear.py
108
+ engine/torch_nn/qat/modules/__init__.py
109
+ engine/torch_nn/qat/modules/conv.py
110
+ engine/torch_nn/qat/modules/embedding_ops.py
111
+ engine/torch_nn/qat/modules/linear.py
112
+ engine/torch_nn/quantizable/__init__.py
113
+ engine/torch_nn/quantizable/modules/__init__.py
114
+ engine/torch_nn/quantizable/modules/activation.py
115
+ engine/torch_nn/quantizable/modules/rnn.py
116
+ engine/torch_nn/quantized/__init__.py
117
+ engine/torch_nn/quantized/functional.py
118
+ engine/torch_nn/quantized/_reference/__init__.py
119
+ engine/torch_nn/quantized/_reference/modules/__init__.py
120
+ engine/torch_nn/quantized/_reference/modules/conv.py
121
+ engine/torch_nn/quantized/_reference/modules/linear.py
122
+ engine/torch_nn/quantized/_reference/modules/rnn.py
123
+ engine/torch_nn/quantized/_reference/modules/sparse.py
124
+ engine/torch_nn/quantized/_reference/modules/utils.py
125
+ engine/torch_nn/quantized/dynamic/__init__.py
126
+ engine/torch_nn/quantized/dynamic/modules/__init__.py
127
+ engine/torch_nn/quantized/dynamic/modules/conv.py
128
+ engine/torch_nn/quantized/dynamic/modules/linear.py
129
+ engine/torch_nn/quantized/dynamic/modules/rnn.py
130
+ engine/torch_nn/quantized/modules/__init__.py
131
+ engine/torch_nn/quantized/modules/activation.py
132
+ engine/torch_nn/quantized/modules/batchnorm.py
133
+ engine/torch_nn/quantized/modules/conv.py
134
+ engine/torch_nn/quantized/modules/dropout.py
135
+ engine/torch_nn/quantized/modules/embedding_ops.py
136
+ engine/torch_nn/quantized/modules/functional_modules.py
137
+ engine/torch_nn/quantized/modules/linear.py
138
+ engine/torch_nn/quantized/modules/normalization.py
139
+ engine/torch_nn/quantized/modules/rnn.py
140
+ engine/torch_nn/quantized/modules/utils.py
141
+ engine/torch_nn/utils/__init__.py
142
+ engine/torch_nn/utils/_deprecation_utils.py
143
+ engine/torch_nn/utils/_named_member_accessor.py
144
+ engine/torch_nn/utils/_per_sample_grad.py
145
+ engine/torch_nn/utils/clip_grad.py
146
+ engine/torch_nn/utils/convert_parameters.py
147
+ engine/torch_nn/utils/fusion.py
148
+ engine/torch_nn/utils/init.py
149
+ engine/torch_nn/utils/memory_format.py
150
+ engine/torch_nn/utils/parametrizations.py
151
+ engine/torch_nn/utils/parametrize.py
152
+ engine/torch_nn/utils/prune.py
153
+ engine/torch_nn/utils/rnn.py
154
+ engine/torch_nn/utils/rnn.pyi
155
+ engine/torch_nn/utils/spectral_norm.py
156
+ engine/torch_nn/utils/stateless.py
157
+ engine/torch_nn/utils/weight_norm.py
158
+ engine/torch_nn/utils/_expanded_weights/__init__.py
159
+ engine/torch_nn/utils/_expanded_weights/conv_expanded_weights.py
160
+ engine/torch_nn/utils/_expanded_weights/conv_utils.py
161
+ engine/torch_nn/utils/_expanded_weights/embedding_expanded_weights.py
162
+ engine/torch_nn/utils/_expanded_weights/expanded_weights_impl.py
163
+ engine/torch_nn/utils/_expanded_weights/expanded_weights_utils.py
164
+ engine/torch_nn/utils/_expanded_weights/group_norm_expanded_weights.py
165
+ engine/torch_nn/utils/_expanded_weights/instance_norm_expanded_weights.py
166
+ engine/torch_nn/utils/_expanded_weights/layer_norm_expanded_weights.py
167
+ engine/torch_nn/utils/_expanded_weights/linear_expanded_weights.py
@@ -0,0 +1 @@
1
+ numpy
@@ -0,0 +1 @@
1
+ engine
@@ -0,0 +1,35 @@
1
+ from torch.nn import Module, Linear, TransformerEncoderLayer, TransformerEncoder, ModuleList, Dropout, LayerNorm
2
+ import torch
3
+
4
+ class GraphTransformerV2(Module):
5
+ def __init__(self, num_layers, d_model, num_heads, d_feedforward, input_dim, num_weights=10, use_weights=True, dropout=0.1):
6
+ super(GraphTransformerV2, self).__init__()
7
+ self.num_weights = num_weights
8
+ self.use_weights = use_weights
9
+ self.input_linear = Linear(input_dim, d_model)
10
+ self.encoder_layer = TransformerEncoderLayer(d_model=d_model, nhead=num_heads, dim_feedforward=d_feedforward, dropout=dropout, batch_first=True)
11
+ self.transformer_encoder = TransformerEncoder(self.encoder_layer, num_layers=num_layers)
12
+ self.output_linear = Linear(d_model, input_dim)
13
+ self.dropout = Dropout(dropout)
14
+ self.layer_norm = LayerNorm(d_model)
15
+ if self.use_weights:
16
+ self.weight_linears = ModuleList([Linear(input_dim, d_model) for _ in range(num_weights)])
17
+
18
+ def forward(self, x, weights=None):
19
+ x = x.float()
20
+ if self.use_weights:
21
+ if weights is not None:
22
+ weighted_x = torch.zeros_like(x)
23
+ for i, weight in enumerate(weights):
24
+ weighted_x += self.weight_linears[i](x) * weight
25
+ x = weighted_x
26
+ else:
27
+ x = self.input_linear(x)
28
+ else:
29
+ x = self.input_linear(x)
30
+
31
+ x = self.layer_norm(x)
32
+ x = self.transformer_encoder(x)
33
+ x = self.output_linear(x)
34
+ x = self.dropout(x)
35
+ return x
@@ -0,0 +1,106 @@
1
+ """
2
+ Engine
3
+ ======
4
+ Maintainer: Vishesh
5
+
6
+
7
+ TL;DR
8
+ ------
9
+ 1. If you're using this module, then surely you're in a testing phase for corerec.
10
+ 2. This module is not meant to be used by the end user.
11
+ 3. I'll fix the __init__; it's not yet written well. -Vishesh(Admin)
12
+
13
+ Provides
14
+ 1. Graph-based recommendation systems using neural network architectures.
15
+ 2. Various neural network modules and utilities.
16
+ 3. Training and prediction functions for graph data.
17
+
18
+ How to use the documentation
19
+ ----------------------------
20
+ Documentation is available in two forms: docstrings provided
21
+ with the code, and a loose standing reference guide.
22
+
23
+ We recommend exploring the docstrings using
24
+ `IPython <https://ipython.org>`_, an advanced Python shell with
25
+ TAB-completion and introspection capabilities. See below for further
26
+ instructions.
27
+
28
+ The docstring examples assume that `engine` has been imported as ``eng``::
29
+
30
+ >>> import engine as eng
31
+
32
+ Code snippets are indicated by three greater-than signs::
33
+
34
+ >>> x = 42
35
+ >>> x = x + 1
36
+
37
+ Use the built-in ``help`` function to view a function's docstring::
38
+
39
+ >>> help(eng.train_model)
40
+ ... # doctest: +SKIP
41
+
42
+ Available subpackages
43
+ ---------------------
44
+ torch_nn
45
+ Neural network modules and utilities.
46
+ cr_boosters
47
+ Optimizers and boosters for training.
48
+ core_rec
49
+ Core recommendation system components.
50
+ """
51
+
52
+ # import os
53
+ # import sys
54
+ # import warnings
55
+
56
+ # from . import version
57
+ # from .version import __version__
58
+
59
+ # Allow distributors to run custom init code before importing engine._core
60
+ # from . import _distributor_init
61
+
62
+ # try:
63
+ # from engine.__config__ import show as show_config
64
+ # except ImportError as e:
65
+ # msg = """Error importing engine: you should not try to import engine from
66
+ # its source directory; please exit the engine source tree, and relaunch
67
+ # your python interpreter from there."""
68
+ # raise ImportError(msg) from e
69
+
70
+ # # Ensure the submodules are correctly imported
71
+ # from engine.torch_nn import torch_nn
72
+ # from engine.cr_boosters import cr_boosters
73
+ # from engine.core_rec import core_rec
74
+
75
+ # __all__ = [
76
+ # "torch_nn",
77
+ # "cr_boosters",
78
+ # "core_rec",
79
+ # "show_config",
80
+ # "__version__"
81
+ # ]
82
+
83
+ # def __getattr__(attr):
84
+ # if attr == "torch_nn":
85
+ # import engine.torch_nn as torch_nn
86
+ # return torch_nn
87
+ # elif attr == "cr_boosters":
88
+ # import engine.cr_boosters as cr_boosters
89
+ # return cr_boosters
90
+ # elif attr == "core_rec":
91
+ # import engine.core_rec as core_rec
92
+ # return core_rec
93
+
94
+ # raise AttributeError(f"module {__name__!r} has no attribute {attr!r}")
95
+
96
+ # def __dir__():
97
+ # public_symbols = globals().keys()
98
+ # return list(public_symbols)
99
+
100
+ # # Pytest testing
101
+ # from engine._pytesttester import PytestTester
102
+ # test = PytestTester(__name__)
103
+ # del PytestTester
104
+
105
+ # # Remove symbols imported for internal use
106
+ # del os, sys, warnings