<jupyter_start><jupyter_text>Parkinson's Disease Classification<jupyter_code>!pip install patool
import pandas as pd
import ehrapy as ep
import numpy as np
import warnings
import patoolib
import os
warnings.filterwarnings("ignore")
pd.set_option("display.max_columns", None)<jupyter_output><empty_output><jupyter_text>Getting the dataset<jupyter_code>!wget -nc http://archive.ics.uci.edu/ml/machine-learning-databases/00470/pd_speech_features.rar
base_directory = os.getcwd()
patoolib.extract_archive("pd_speech_features.rar", outdir=base_directory, interactive = False)<jupyter_output>patool: Extracting pd_speech_features.rar ...
patool: running /usr/local/bin/rar x -p- -y -- /Users/xinyuezhang/ehrapy-datasets/parkinson's_disease_classification/pd_speech_features.rar
patool:     with cwd='/Users/xinyuezhang/ehrapy-datasets/parkinson'\''s_disease_classification'
patool: ... pd_speech_features.rar extracted to `/Users/xinyuezhang/ehrapy-datasets/parkinson's_disease_classification'.<jupyter_text>Data Wrangling<jupyter_code>data = pd.read_csv("pd_speech_features.csv", sep=",", header=1)<jupyter_output><empty_output><jupyter_text>Since the dataset does not have a measurement ID we add one.<jupyter_code>data["measurement_id"] = range(1, len(data) + 1)
data.set_index("measurement_id", inplace=True)
data.to_csv("parkinson's_disease_classification_prepared.csv")<jupyter_output><empty_output><jupyter_text>ehrapy sanity check<jupyter_code>columns_obs_only=["id"]
adata = ep.io.read_csv("parkinson's_disease_classification_prepared.csv",
                   index_column="measurement_id",
                   columns_obs_only=columns_obs_only)
adata=ep.pp.encode(adata,autodetect=True)
ep.pp.norm_scale(adata)
ep.pp.pca(adata)
ep.pp.neighbors(adata)
ep.tl.umap(adata)
ep.tl.leiden(adata, resolution=0.5, key_added="leiden_0_5")
ep.pl.umap(adata, color=["leiden_0_5"], title="Leiden 0.5")
ep.pl.umap(adata, color=["ehrapycat_class"], ncols=1, wspace=0.75)
ep.pl.umap(adata, color=["ehrapycat_gender"], ncols=1, wspace=0.75)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13229571984435798, 'fraction_numerical': 0.011673151750972763, 'mean_word_length': 7.679324894514768, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '588731', 'license': 'Apache-2.0', 'n_tokens_mistral': 802, 'n_tokens_neox': 745, 'n_words': 100, 'path': "parkinson's_disease_classification/parkinson's_disease_classification.ipynb", 'repo_name': 'theislab/ehrapy-datasets', 'size': '2056'}