Пример #1
0
import socialsim as ss

# Load the configuration file
config = 'data/cp4_configuration.json'
config = ss.load_config(config)

# Get metadata
metadata = ss.MetaData()

# Instantiate the task runner with the specified ground truth
ground_truth_filepath = 'data/test_dataset.json'
ground_truth = ss.load_data(ground_truth_filepath,
                            ignore_first_line=True,
                            verbose=False)
eval_runner = ss.EvaluationRunner(ground_truth, config, metadata=metadata)

# Evaluate a series of submissions that contain submission metadata as the first line of the submission file\
submission_filepaths = ['data/test_dataset.json']
for simulation_filepath in submission_filepaths:
    # Run measurements and metrics on the simulation data
    results, logs = eval_runner(simulation_filepath,
                                verbose=True,
                                submission_meta=True)
Пример #2
0
import socialsim as ss

# Load the simulation data
simulation = 'data/test_dataset.txt'
simulation = ss.load_data(simulation)

# Load the ground truth data
ground_truth = 'data/test_dataset.txt'
ground_truth = ss.load_data(ground_truth)

# Load the configuration file
config = 'data/cp2_configuration.json'
config = ss.load_config(config)

# Get metadata
metadata = ss.MetaData(community_directory='data/communities/')

# Instantiate the task runner
task_runner = ss.TaskRunner(ground_truth, config, metadata=metadata, test=True)

# Run measurements and metrics on the simulation data
results = task_runner(simulation, verbose=True)
Пример #3
0
import socialsim as ss

# Load the example dataset
dataset = 'data/test_dataset.txt'
dataset = ss.load_data(dataset)

# Load the configuration file
config = 'data/recurrence_configuration.json'
config = ss.load_config(config)

# Subset the configuration for the given task
config = config
config = config['recurrence']

# load metadata
metadata = ss.MetaData(community_directory='data/communities',
                       content_data=True)

# Define the measurement object
# recurrence_measurements = ss.RecurrenceMeasurements(dataset, config['recurrence'], id_col='nodeID', userid_col='nodeUserID', timestamp_col='nodeTime', content_col='informationID')
recurrence_measurements = ss.RecurrenceMeasurements(dataset,
                                                    config['recurrence'],
                                                    metadata=metadata,
                                                    id_col='nodeID',
                                                    userid_col='nodeUserID',
                                                    timestamp_col='nodeTime',
                                                    content_col='platform',
                                                    time_granularity='H')

# Run all measurements in the config file
results = recurrence_measurements.run(verbose=True)
Пример #4
0
from pprint import pprint
import socialsim as ss

# Load the simulation data
simulation = 'data/test_dataset.txt'
simulation = ss.load_data(simulation, ignore_first_line=True, verbose=False)

# Load the ground truth data
ground_truth = 'data/test_dataset.txt'
ground_truth = ss.load_data(ground_truth, ignore_first_line=True, verbose=False)

# Load the configuration file 
config = 'data/cp2_configuration.json'
config = ss.load_config(config)

# Get metadata
metadata = ss.MetaData(community_directory='data/communities/',
                       node_file='data/node_list.txt')

# Instantiate the task runner 
task_runner = ss.TaskRunner(ground_truth, config, metadata=metadata, test=True)

# Run measurements and metrics on the simulation data
results, logs = task_runner(simulation, verbose=True)

# Print metrics
pprint(results['metrics'])