python/methylnet/model_interpretability.py
def bin_regression_shaps(shapley_data, test_pkl,col,n_bins,output_test_pkl,output_shap_pkl):
    """Take aggregate individual scores from regression results, that normally are not categorized, and aggregate across new category created from continuous data."""
    os.makedirs(output_test_pkl[:output_test_pkl.rfind('/')],exist_ok=True)
    os.makedirs(output_shap_pkl[:output_shap_pkl.rfind('/')],exist_ok=True)
    shapley_data=ShapleyData.from_pickle(shapley_data)
    shapley_data_explorer=ShapleyDataExplorer(shapley_data)
    test_methyl_array=MethylationArray.from_pickle(test_pkl)
    new_col_name = test_methyl_array.bin_column(col,n_bins)
    print(test_methyl_array.categorical_breakdown(new_col_name))
    shapley_data = shapley_data_explorer.return_binned_shapley_data(col, test_methyl_array.pheno[new_col_name], add_top_negative=False)
    print(ShapleyDataExplorer(shapley_data).list_classes())
    test_methyl_array.write_pickle(output_test_pkl)
    shapley_data.to_pickle(output_shap_pkl)
Take aggregate individual scores from regression results, that normally are not categorized, and aggregate across new category created from continuous data.
Take aggregate individual scores from regression results, that normally are not categorized, and aggregate across new category created from continuous data.
Take aggregate individual scores from regression results that normally are not categorized and aggregate across new category created from continuous data .
def bin_regression_shaps(shapley_data, test_pkl,col,n_bins,output_test_pkl,output_shap_pkl):
    os.makedirs(output_test_pkl[:output_test_pkl.rfind('/')],exist_ok=True)
    os.makedirs(output_shap_pkl[:output_shap_pkl.rfind('/')],exist_ok=True)
    shapley_data=ShapleyData.from_pickle(shapley_data)
    shapley_data_explorer=ShapleyDataExplorer(shapley_data)
    test_methyl_array=MethylationArray.from_pickle(test_pkl)
    new_col_name = test_methyl_array.bin_column(col,n_bins)
    print(test_methyl_array.categorical_breakdown(new_col_name))
    shapley_data = shapley_data_explorer.return_binned_shapley_data(col, test_methyl_array.pheno[new_col_name], add_top_negative=False)
    print(ShapleyDataExplorer(shapley_data).list_classes())
    test_methyl_array.write_pickle(output_test_pkl)
    shapley_data.to_pickle(output_shap_pkl)
def bin_regression_shaps ( shapley_data , test_pkl , col , n_bins , output_test_pkl , output_shap_pkl ) : os . makedirs ( output_test_pkl [ : output_test_pkl . rfind ( '/' ) ] , exist_ok = True ) os . makedirs ( output_shap_pkl [ : output_shap_pkl . rfind ( '/' ) ] , exist_ok = True ) shapley_data = ShapleyData . from_pickle ( shapley_data ) shapley_data_explorer = ShapleyDataExplorer ( shapley_data ) test_methyl_array = MethylationArray . from_pickle ( test_pkl ) new_col_name = test_methyl_array . bin_column ( col , n_bins ) print ( test_methyl_array . categorical_breakdown ( new_col_name ) ) shapley_data = shapley_data_explorer . return_binned_shapley_data ( col , test_methyl_array . pheno [ new_col_name ] , add_top_negative = False ) print ( ShapleyDataExplorer ( shapley_data ) . list_classes ( ) ) test_methyl_array . write_pickle ( output_test_pkl ) shapley_data . to_pickle ( output_shap_pkl )
Take aggregate individual scores from regression results, that normally are not categorized, and aggregate across new category created from continuous data.
Take aggregate individual scores from regression results that normally are not categorized and aggregate across new category created from continuous data .
"""Take aggregate individual scores from regression results, that normally are not categorized, and aggregate across new category created from continuous data."""
shapley_data
test_pkl
col
n_bins
output_test_pkl
output_shap_pkl