<jupyter_start><jupyter_text>running_dcurves_package<jupyter_code>import pandas as pd
import numpy as np
import statsmodels.api as sm
import statsmodels.duration.hazard_regression as coxph
import lifelines
#from lifelines.datasets import load_rossi
import matplotlib.pyplot as plt
import dcurves
pd.set_option('display.max_rows', 500)

df_binary = dcurves.load_test_data.load_binary_df()
df_surv = dcurves.load_test_data.load_survival_df()
df_case_control = dcurves.load_test_data.load_case_control_df()
df_cancer_dx = dcurves.load_test_data.load_cancerdx_df()
binary_output_df = dcurves.dca(
        data = df_binary,
        outcome = 'cancer',
        predictors = ['cancerpredmarker', 'marker'],
        thresh_vals = [0.01, 1.0, 0.01],
        probabilities = [False, True]
)

survival_output_df = dcurves.dca(
    data = df_surv,
    outcome = 'cancer',
    predictors = ['cancerpredmarker'],
    thresh_vals = [0.01, 1.0, 0.01],
    probabilities = [False],
    time = 1,
    time_to_outcome_col = 'ttcancer'
)
dan_test_output_df = dcurves.dca(
    data = df_cancer_dx,
    outcome = 'cancer',
    predictors = ['famhistory'],
    thresh_vals = [0.01, 1.0, 0.01],
    probabilities = [False]
)

dcurves.plot_net_benefit_graphs(binary_output_df, y_limits=[-0.05, 0.2], color_names=['lightgreen', 'blue', 'red'])
dcurves.plot_net_benefit_graphs(output_df=survival_output_df)
dcurves.plot_net_benefit_graphs(dan_test_output_df)

# dan_test_output_df.to_csv('/Users/ShaunPorwal/Desktop/dan_test_python_output.tsv')
# dan_test_output_df
help(dcurves.dca)
a = [1,2,3,4,0.5]
max(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1191806331471136, 'fraction_numerical': 0.024208566108007448, 'mean_word_length': 5.129277566539924, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '173982', 'license': 'Apache-2.0', 'n_tokens_mistral': 669, 'n_tokens_neox': 630, 'n_words': 100, 'path': 'jupyter_notebooks/running_dcurves.ipynb', 'repo_name': 'MSKCC-Epi-Bio/dcurves', 'size': '1611'}