Alphabet DistributionΒΆ

An example plot of digitaldna.TwitterDDNASequencer

../_images/sphx_glr_plot_sequence_alphabet_distribution_001.png
from digitaldna import TwitterDDNASequencer
from digitaldna import SequencePlots
import numpy as np

# Generate DDNA from Twitter
model = TwitterDDNASequencer(input_file='timelines.json', alphabet='b3_type')
arr = model.fit_transform()

# Simulate bots by repeating 10 times the first timeline
nrep_arr = [10 if i == 0 else 1 for i in range(len(arr))]
arr = np.repeat(arr, nrep_arr, axis=0)
arr[:, 0] = np.random.randint(0, high=10100, size=len(arr))

# Plot results
plotter = SequencePlots(alphabet='b3_type')
plotter.plot_alphabet_distribution(arr[:, 1])

Total running time of the script: ( 0 minutes 3.246 seconds)

Gallery generated by Sphinx-Gallery