Skip to content

Commit

Permalink
jupyter and some documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
edytafraszczak committed Jul 5, 2024
1 parent eca13e6 commit fee7f51
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,42 @@ result, evaluation = source_detector.detect_sources_and_evaluate(G=G,
print(evaluation)


```

For performing ensemble source detection, use 'EnsembleSourceDetector' class and configure it with 'EnsembleSourceDetectionConfig' object. This approach allows for seamless source detection and result evaluation.

```python

import networkx as nx

from nsdlib.common.models import SourceDetectionConfig, \
EnsembleSourceDetectionConfig
from nsdlib.source_detection import SourceDetector, EnsembleSourceDetector
from nsdlib.taxonomies import NodeEvaluationAlgorithm, EnsembleVotingType

G = nx.karate_club_graph()

config_netsleuth = SourceDetectionConfig(
node_evaluation_algorithm=NodeEvaluationAlgorithm.NETSLEUTH,
)

config_degree = SourceDetectionConfig(
node_evaluation_algorithm=NodeEvaluationAlgorithm.CENTRALITY_DEGREE,
)

ensemble_config = EnsembleSourceDetectionConfig(
detection_configs=[config_netsleuth, config_degree],
voting_type=EnsembleVotingType.HARD,
classifier_weights=[0.5, 0.5],
)

source_detector = EnsembleSourceDetector(ensemble_config)

result, evaluation = source_detector.detect_sources_and_evaluate(G=G,
IG=G, real_sources=[0,33])
print(evaluation)


```

- by importing and using specific method, each method has appropriate prefix to understand what is the purpose of it:
Expand Down
29 changes: 0 additions & 29 deletions src/aa.py

This file was deleted.

0 comments on commit fee7f51

Please sign in to comment.