python/methylnet/interpretation_classes.py
def add_global_importance(self, global_importance_shaps, cpgs, n_top_cpgs):
        """Add overall feature importances, globally across all samples.

        Parameters
        ----------
        global_importance_shaps : type
            Overall SHAP values to be saved, aggregated across all samples.
        cpgs : type
            All CpGs.
        n_top_cpgs : type
            Number of top CpGs to rank and save as well.

        """

        self.shapley_values['overall']=pd.DataFrame(global_importance_shaps[:,np.newaxis],columns=['shapley_values'],index=cpgs)
        top_ft_idx=np.argsort(global_importance_shaps*-1)[:n_top_cpgs]
        self.top_cpgs['overall']=pd.DataFrame(np.hstack([cpgs[top_ft_idx][:,np.newaxis],global_importance_shaps[top_ft_idx][:,np.newaxis]]),columns=['cpg','shapley_value'])
Add overall feature importances, globally across all samples.

        Parameters
        ----------
        global_importance_shaps : type
            Overall SHAP values to be saved, aggregated across all samples.
        cpgs : type
            All CpGs.
        n_top_cpgs : type
            Number of top CpGs to rank and save as well.

        
Add overall feature importances, globally across all samples.
Parameters

global_importance_shaps : type
Overall SHAP values to be saved, aggregated across all samples.
cpgs : type
All CpGs.
n_top_cpgs : type
Number of top CpGs to rank and save as well.
Add overall feature importances globally across all samples . Parameters global_importance_shaps : type Overall SHAP values to be saved aggregated across all samples . cpgs : type All CpGs . n_top_cpgs : type Number of top CpGs to rank and save as well .
def add_global_importance(self, global_importance_shaps, cpgs, n_top_cpgs):
        self.shapley_values['overall']=pd.DataFrame(global_importance_shaps[:,np.newaxis],columns=['shapley_values'],index=cpgs)
        top_ft_idx=np.argsort(global_importance_shaps*-1)[:n_top_cpgs]
        self.top_cpgs['overall']=pd.DataFrame(np.hstack([cpgs[top_ft_idx][:,np.newaxis],global_importance_shaps[top_ft_idx][:,np.newaxis]]),columns=['cpg','shapley_value'])
def add_global_importance ( self , global_importance_shaps , cpgs , n_top_cpgs ) : self . shapley_values [ 'overall' ] = pd . DataFrame ( global_importance_shaps [ : , np . newaxis ] , columns = [ 'shapley_values' ] , index = cpgs ) top_ft_idx = np . argsort ( global_importance_shaps * - 1 ) [ : n_top_cpgs ] self . top_cpgs [ 'overall' ] = pd . DataFrame ( np . hstack ( [ cpgs [ top_ft_idx ] [ : , np . newaxis ] , global_importance_shaps [ top_ft_idx ] [ : , np . newaxis ] ] ) , columns = [ 'cpg' , 'shapley_value' ] )
Add overall feature importances, globally across all samples.
Add overall feature importances globally across all samples .
"""Add overall feature importances, globally across all samples.

        Parameters
        ----------
        global_importance_shaps : type
            Overall SHAP values to be saved, aggregated across all samples.
        cpgs : type
            All CpGs.
        n_top_cpgs : type
            Number of top CpGs to rank and save as well.

        """
self
global_importance_shaps
cpgs
n_top_cpgs