<jupyter_start><jupyter_text>Cyclum: hESC treated by nicotine<jupyter_code># Add ../../ to path
import os,sys,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir) 
%matplotlib inline
%load_ext autoreload
%autoreload 1
import pandas as pd
import numpy as np
import sklearn as skl

import cyclum.tuning
import cyclum.models
from cyclum import writer

from cyclum.hdfrw import hdf2mat, mat2hdf
df = hdf2mat('/home/shaoheng/Documents/data/hESC-droplet/GSE125416/GSM357650-regular.h5')
model = cyclum.tuning.CyclumAutoTune(df.values, max_linear_dims=3, 
                                     epochs=100, rate=2e-4, verbose=20,
                                     encoder_width=[30, 20])
model.show_elbow()
model.train(df.values, epochs=300, rate=1e-4, verbose=30)

pseudotime = model.predict_pseudotime(df.values)
import pickle as pkl
with open('hESC.pkl', 'wb') as file:
    pkl.dump(pseudotime, file)
from cyclum.hdfrw import hdf2mat, mat2hdf
import pickle as pkl
with open('hESC.pkl', 'rb') as file:
    pseudotime = pkl.load(file)

mat2hdf(pseudotime, "/home/shaoheng/Documents/data/hESC-droplet/GSE125416/GSM357650-pseudotime.h5")
mat2hdf(model.get_weight(), "/home/shaoheng/Documents/data/hESC-droplet/GSE125416/GSM357650-weight.h5")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12101449275362319, 'fraction_numerical': 0.04855072463768116, 'mean_word_length': 4.415686274509804, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '471950', 'license': 'MIT', 'n_tokens_mistral': 580, 'n_tokens_neox': 531, 'n_words': 95, 'path': 'tests/notebooks/hESC-treated-regular.ipynb', 'repo_name': 'lshh125/cyclum', 'size': '1380'}