import pickle # General python libraries import scipy.signal as sig import numpy as np # Plotting Libraries import matplotlib.pyplot as plt import seaborn as sns #Do some cleanup of the plotting space plt.close('all') sns.set_context('paper') sns.set_style('white') sns.set(font_scale=4) # Misc libraries import copy import itertools import scipy.stats as stats import ipdb #%% Initial # Now we set up our DBSpace environment ClinFrame = ClinVect.CFrame(norm_scales=True) #BRFrame = BRDF.BR_Data_Tree(preFrame='Chronic_Frame_2019.pickle') BRFrame = pickle.load( open('/home/virati/Dropbox/Data/Chronic_Frame_2019.pickle', "rb")) readout = DSV.DMD_RO(BRFrame, ClinFrame) readout.default_run()
import itertools import pickle from DBSpace.readout import DSV #%% #This sets up our clinical frame for the regression print('Loading Clinical and BrainRadio Frames...') ClinFrame = ClinVect.CFrame(norm_scales=True) BRFrame = pickle.load(open('/home/virati/Chronic_Frame.pickle',"rb")) print('Starting the readout analysis...') analysis = DSV.ORegress(BRFrame,ClinFrame) #%% analysis.split_validation_set(do_split = True) analysis.O_feat_extract() all_pts = ['901','903','905','906','907','908'] #%% regr_type = 'RIDGE' test_scale = 'HDRS17' do_detrend='Block' ranson = True if regr_type == 'OLSnite':
import numpy as np #%% ClinFrame = ClinVect.CFrame(norm_scales=True) #ClinFrame.plot_scale(pts='all',scale='HDRS17') #ClinFrame.plot_scale(pts=['901'],scale='MADRS') #%% #BRFrame = BR_Data_Tree() #BRFrame.full_sequence(data_path='/home/virati/Chronic_Frame_july.npy') #BRFrame.check_empty_phases() #BRFrame = pickle.load(open('/home/virati/Chronic_Frame.pickle',"rb")) BRFrame = pickle.load(open('/home/virati/Dropbox/Data/Chronic_FrameMay2020.pickle',"rb")) #%% analysis = DSV.DSV(BRFrame,ClinFrame,lim_freq=30,use_scale='HDRS17') ENet_params = {'Alpha':(5,6),'Lambda':(0.9)} #%% analysis.run_EN(alpha_list= np.linspace(40,60,100)) #%% analysis.plot_EN_coeffs() #%% #aanalysis.plot_dsgn_matrix() analysis.plot_tests() #%% analysis.plot_performance(ranson=True)
#%% ## MAJOR PARAMETERS for our partial biometric analysis do_pts = ['901', '903', '905', '906', '907', '908' ] # Which patients do we want to include in this entire analysis? #do_pts = ['901'] test_scale = 'HDRS17' # Which scale are we using as the measurement of the depression state? ''' DETRENDING Which detrending scheme are we doing This is important. Block goes into each patient and does zero-mean and linear detrend across time None does not do this All does a linear detrend across all concatenated observations. This is dumb and should not be done. Will eliminate this since it makes no sense ''' do_detrend = 'Block' rmethod = 'ENR_Osc' #%% # Now we set up our DBSpace environment ClinFrame = ClinVect.CFrame(norm_scales=True) BRFrame = BRDF.BR_Data_Tree() # Run our main sequence for populating the BRFrame BRFrame.full_sequence( data_path= '/home/virati/Dropbox/projects/Research/MDD-DBS/Data/Chronic_Frame_july.npy' ) BRFrame.check_empty_phases( ) # Check to see if there are any empty phases. This should be folded into full_sequence soon TODO readout = DSV.on_demand(BRFrame, ClinFrame, validation=0.3)
# Plotting Libraries import matplotlib.pyplot as plt import seaborn as sns #Do some cleanup of the plotting space plt.close('all') sns.set_context('paper') sns.set_style('white') sns.set(font_scale=4) # Misc libraries import copy import itertools import scipy.stats as stats #%% ClinFrame = ClinVect.CFrame(norm_scales=True) BRFrame = BRDF.BR_Data_Tree() BRFrame.full_sequence(data_path='/home/virati/Chronic_Frame_july.npy') BRFrame.check_empty_phases() local_ro = DSV.ORegress(BRFrame, ClinFrame, trials=1, rmethod='RIDGE') #%% #Need to have a method that inserts models in #need to have a method that zeros out coefficients, like right delta #%% # Now we want to just VIEW the coefficients, ensemble stuff, etc. Everything else from Partial_Biometric needs to be folded into ORegress class