<jupyter_start><jupyter_text>Load Demo DatasetA preprocessed data list is used.<jupyter_code>with open("../data/example.pkl", "rb") as f:
    datalist = pickle.load(f)
numstates = 9<jupyter_output><empty_output><jupyter_text>Correct Data Errors<jupyter_code>newlist = ctmc.datacorrection(datalist, toltime=1e-8)<jupyter_output><empty_output><jupyter_text>Fit<jupyter_code>model = ctmc.Ctmc(numstates, transintv=1.0, toltime=1e-8, debug=False)
model = model.fit(newlist)
model.transmat.round(2)<jupyter_output><empty_output><jupyter_text>Predict<jupyter_code>s0 = np.zeros(shape=(numstates,))
s0[0] = 1
out = model.predict(s0)
out
#sum(out)<jupyter_output><empty_output><jupyter_text>Multi-Step Simulation<jupyter_code>out = model.predict(s0, steps=500)
out[:10].round(2)
fig, ax = plt.subplots(dpi=150, facecolor='white')
ax.stackplot(list(range(len(out))), out.T * 100, labels=list(range(numstates)));
ax.legend(loc='upper right');
ax.set_xlabel('step');
ax.set_ylabel('percentage');
ax.set_xlim(0, len(out));
ax.set_ylim(0, 100);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16870876531573986, 'fraction_numerical': 0.029217719132893498, 'mean_word_length': 9.948453608247423, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '102209', 'license': 'MIT', 'n_tokens_mistral': 469, 'n_tokens_neox': 445, 'n_words': 54, 'path': 'examples/demo Ctmc sklearn API.ipynb', 'repo_name': 'kmedian/ctmc', 'size': '1061'}