InfluenceDiffusion 0.0.8__tar.gz → 0.0.10__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 (21) hide show
  1. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/__init__.py +2 -0
  2. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/weight_samplers.py +3 -0
  3. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion.egg-info/PKG-INFO +7 -1
  4. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion.egg-info/SOURCES.txt +3 -0
  5. influencediffusion-0.0.10/LICENSE.txt +21 -0
  6. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/PKG-INFO +7 -1
  7. influencediffusion-0.0.10/README.md +56 -0
  8. influencediffusion-0.0.10/setup.cfg +7 -0
  9. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/setup.py +1 -1
  10. InfluenceDiffusion-0.0.8/setup.cfg +0 -4
  11. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/Graph.py +0 -0
  12. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/Trace.py +0 -0
  13. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/estimation_models/BaseWeightEstimator.py +0 -0
  14. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/estimation_models/EMEstimation.py +0 -0
  15. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/estimation_models/OptimEstimation.py +0 -0
  16. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/estimation_models/__init__.py +0 -0
  17. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/influence_models.py +0 -0
  18. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion/utils.py +0 -0
  19. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion.egg-info/dependency_links.txt +0 -0
  20. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion.egg-info/requires.txt +0 -0
  21. {InfluenceDiffusion-0.0.8 → influencediffusion-0.0.10}/InfluenceDiffusion.egg-info/top_level.txt +0 -0
@@ -2,3 +2,5 @@ from .Graph import Graph
2
2
  from .influence_models import InfluenceModel, ICM, LTM, GLTM
3
3
  from .Trace import Trace, Traces, PseudoTraces
4
4
  from .utils import invert_non_zeros, multiple_union, random_vector_inside_simplex, random_vector_on_simplex
5
+ from .weight_samplers import make_weighted_cascade_weights, make_random_weights_with_fixed_indeg, \
6
+ make_random_weights_with_indeg_constraint
@@ -3,6 +3,9 @@ import numpy as np
3
3
  from .Graph import Graph
4
4
  from .utils import random_vector_inside_simplex, random_vector_on_simplex
5
5
 
6
+ __all__ = ["make_weighted_cascade_weights", "make_random_weights_with_indeg_constraint",
7
+ "make_random_weights_with_fixed_indeg"]
8
+
6
9
 
7
10
  def make_weighted_cascade_weights(g: Graph):
8
11
  vertex_2_indegree = g.get_vertex_2_indegree_dict(weighted=False)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: InfluenceDiffusion
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: InfluenceDiffusion package
5
5
  Author: Alexander Kagan
6
6
  Author-email: <amkagan@umich.edu>
@@ -11,5 +11,11 @@ Classifier: Programming Language :: Python :: 2
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: MacOS :: MacOS X
13
13
  Classifier: Operating System :: Microsoft :: Windows
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: numpy
16
+ Requires-Dist: scipy
17
+ Requires-Dist: networkx
18
+ Requires-Dist: typing
19
+ Requires-Dist: joblib
14
20
 
15
21
  in this package, we implement popular network diffusion models and methods for their estimation.
@@ -1,3 +1,6 @@
1
+ LICENSE.txt
2
+ README.md
3
+ setup.cfg
1
4
  setup.py
2
5
  InfluenceDiffusion/Graph.py
3
6
  InfluenceDiffusion/Trace.py
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Alexander Kagan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: InfluenceDiffusion
3
- Version: 0.0.8
3
+ Version: 0.0.10
4
4
  Summary: InfluenceDiffusion package
5
5
  Author: Alexander Kagan
6
6
  Author-email: <amkagan@umich.edu>
@@ -11,5 +11,11 @@ Classifier: Programming Language :: Python :: 2
11
11
  Classifier: Programming Language :: Python :: 3
12
12
  Classifier: Operating System :: MacOS :: MacOS X
13
13
  Classifier: Operating System :: Microsoft :: Windows
14
+ License-File: LICENSE.txt
15
+ Requires-Dist: numpy
16
+ Requires-Dist: scipy
17
+ Requires-Dist: networkx
18
+ Requires-Dist: typing
19
+ Requires-Dist: joblib
14
20
 
15
21
  in this package, we implement popular network diffusion models and methods for their estimation.
@@ -0,0 +1,56 @@
1
+ 
2
+ # InfluenceDiffusion
3
+
4
+ InfluenceDiffusion is a Python library that provides instruments for working with influence diffusion models on graphs. In particualr, it contains implementations of
5
+ - Popular diffusion models such as Independent Cascade, (General) Linear Threshold, etc.
6
+ - Methods for estimating parameters of these models
7
+
8
+
9
+ ## Installation
10
+
11
+ Use the package manager [pip](https://pip.pypa.io/en/stable/) to install InfluenceDiffusion.
12
+
13
+ ```bash
14
+ pip install InfluenceDiffusion
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```python
20
+ # Imports
21
+ import matplotlib.pyplot as plt
22
+ from networkx import erdos_renyi_graph
23
+
24
+ from InfluenceDiffusion.Graph import Graph # class inheriting from nx.DiGraph
25
+ from InfluenceDiffusion.influence_models import LTM
26
+ from InfluenceDiffusion.estimation_models.EMEstimation import LTWeightEstimatorEM
27
+ from InfluenceDiffusion.weight_samplers import make_random_weights_with_indeg_constraint
28
+
29
+ # Sample an Erdos-Renyi graph
30
+ g_nx = erdos_renyi_graph(50, p=0.1, directed=True)
31
+ g = Graph(edge_list=g_nx.edges)
32
+
33
+ # Set ground-truth LT model edge weights (in-degree of each node is at most 1)
34
+ weights = make_random_weights_with_indeg_constraint(g, indeg_ub=1)
35
+ g.set_weights(weights)
36
+
37
+ # Sample traces from an LT model on this graph
38
+ ltm = LTM(g)
39
+ traces = ltm.sample_traces(1000)
40
+
41
+ # Estimate the weights using the traces
42
+ ltm_estimator = LTWeightEstimatorEM(g)
43
+ pred_weights = ltm_estimator.fit(traces)
44
+
45
+ # Compare with the ground-truth weights
46
+ plt.scatter(weights, pred_weights)
47
+ plt.plot([0, 1], [0, 1], linestyle='--', c='black')
48
+ plt.xlabel("True weights")
49
+ plt.ylabel("Predicted weights")
50
+ plt.show()
51
+ ```
52
+
53
+
54
+ ## License
55
+
56
+ [MIT](https://choosealicense.com/licenses/mit/)
@@ -0,0 +1,7 @@
1
+ [metadata]
2
+ description-file = README.md
3
+
4
+ [egg_info]
5
+ tag_build =
6
+ tag_date = 0
7
+
@@ -1,6 +1,6 @@
1
1
  from setuptools import setup, find_packages
2
2
 
3
- VERSION = '0.0.8'
3
+ VERSION = '0.0.10'
4
4
  DESCRIPTION = 'InfluenceDiffusion package'
5
5
  LONG_DESCRIPTION = 'in this package, we implement popular network diffusion models and methods for their estimation.'
6
6
 
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-