PredictionFolder = '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/Revision/PredictionAnalysis' AtlasLoading_Folder = PredictionFolder + '/AtlasLoading_Validation' # Import data AtlasLoading_Mat = sio.loadmat(AtlasLoading_Folder + '/AtlasLoading_All_VisualMotor_RemoveZero.mat') Behavior_Mat = sio.loadmat(PredictionFolder + '/Behavior_693.mat') SubjectsData = AtlasLoading_Mat['AtlasLoading_All_VisualMotor_RemoveZero'] AgeYears = Behavior_Mat['AgeYears'] AgeYears = np.transpose(AgeYears) # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) FoldQuantity = 2 ResultantFolder = AtlasLoading_Folder + '/2Fold_Sort_Age_VisualMotor' Ridge_CZ_Sort.Ridge_KFold_Sort(SubjectsData, AgeYears, FoldQuantity, Alpha_Range, ResultantFolder, 1, 0) # Permutation test, 1,000 times Permutation_Times = 1000 Times_IDRange = np.arange(Permutation_Times) Permutation_RandIndex_File_List = [''] * Permutation_Times for i in np.arange(Permutation_Times): Permutation_RandIndex_File_List[i] = PredictionFolder + \ '/AtlasLoading/2Fold_Sort_Permutation_Age/' + 'Time_' + str(i) + '/RandIndex.mat' ResultantFolder = AtlasLoading_Folder + '/2Fold_Sort_Permutation_Age_VisualMotor' Ridge_CZ_Sort.Ridge_KFold_Sort_Permutation(SubjectsData, AgeYears, Times_IDRange, FoldQuantity, Alpha_Range, ResultantFolder, 1, 1000, 'all.q,basic.q', Permutation_RandIndex_File_List)
import sys sys.path.append( '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/scripts_Final/Functions' ) import Ridge_CZ_Sort PredictionFolder = '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/results/PredictionAnalysis' AtlasLoading_Folder = PredictionFolder + '/AtlasLoading' # Import data AtlasLoading_Mat = sio.loadmat(AtlasLoading_Folder + '/AtlasLoading_All_RemoveZero.mat') Behavior_Mat = sio.loadmat(PredictionFolder + '/Behavior_693.mat') SubjectsData = AtlasLoading_Mat['AtlasLoading_All_RemoveZero'] # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) FoldQuantity = 2 Behavior = Behavior_Mat['F2_Social_Cog_Accuracy'] Behavior = np.transpose(Behavior) ResultantFolder = AtlasLoading_Folder + '/2Fold_Sort_SocialCogAccuracy' Ridge_CZ_Sort.Ridge_KFold_Sort(SubjectsData, Behavior, FoldQuantity, Alpha_Range, ResultantFolder, 1, 0) # Permutation test, 1,000 times Times_IDRange = np.arange(1000) ResultantFolder = AtlasLoading_Folder + '/2Fold_Sort_Permutation_SocialCogAccuracy' Ridge_CZ_Sort.Ridge_KFold_Sort_Permutation(SubjectsData, Behavior, Times_IDRange, FoldQuantity, Alpha_Range, ResultantFolder, 1, 1000, 'all.q,basic.q')
import scipy.io as sio import numpy as np import os import sys sys.path.append( '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/scripts_Final/Functions' ) import Ridge_CZ_Sort PredictionFolder = '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/results/PredictionAnalysis' AtlasLoading_Folder = PredictionFolder + '/AtlasLoading' # Import data AtlasLoading_Mat = sio.loadmat(AtlasLoading_Folder + '/AtlasLoading_All_RemoveZero.mat') Behavior_Mat = sio.loadmat(PredictionFolder + '/Behavior_693.mat') Subjects_Data = AtlasLoading_Mat['AtlasLoading_All_RemoveZero'] F1_Exec_Comp_Res_Accuracy = Behavior_Mat['F1_Exec_Comp_Res_Accuracy'] F1_Exec_Comp_Res_Accuracy = np.transpose(F1_Exec_Comp_Res_Accuracy) # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) ResultantFolder = AtlasLoading_Folder + '/Weight_EFAccuracy' Ridge_CZ_Sort.Ridge_Weight(Subjects_Data, F1_Exec_Comp_Res_Accuracy, 1, 2, Alpha_Range, ResultantFolder, 1)
import scipy.io as sio import numpy as np import os import sys sys.path.append( '/data/jux/BBL/projects/pncControlEnergy/scripts/Replication/10th_PredictAge' ) import Ridge_CZ_Sort ReplicationFolder = '/data/jux/BBL/projects/pncControlEnergy/results/Replication' DataFolder = ReplicationFolder + '/data/Age_Prediction' # Import all samples Data_Mat = sio.loadmat(DataFolder + '/Energy_Behavior_AllSubjects.mat') Energy = Data_Mat['Energy'] Age = Data_Mat['Age'] Age = np.transpose(Age) # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) ResultantFolder = ReplicationFolder + '/results/Age_Prediction/Weight' Ridge_CZ_Sort.Ridge_Weight(Energy, Age, 1, 2, Alpha_Range, ResultantFolder, 1)
import os import sys sys.path.append( '/data/jux/BBL/projects/pncControlEnergy/scripts/Replication/9th_PredictAge' ) import Ridge_CZ_Sort ReplicationFolder = '/data/jux/BBL/projects/pncControlEnergy/results/Replication' DataFolder = ReplicationFolder + '/data/Age_Prediction' # Import data Data_Mat = sio.loadmat(DataFolder + '/Energy_Behavior_AllSubjects.mat') Energy = Data_Mat['Energy'] Age = Data_Mat['Age'] Age = np.transpose(Age) # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) FoldQuantity = 2 ResultantFolder = ReplicationFolder + '/results/Age_Prediction/2Fold_Sort' Ridge_CZ_Sort.Ridge_KFold_Sort(Energy, Age, FoldQuantity, Alpha_Range, ResultantFolder, 1, 0) # Permutation test, 1,000 times Times_IDRange = np.arange(1000) ResultantFolder = ReplicationFolder + '/results/Age_Prediction/2Fold_Sort_Permutation' Ridge_CZ_Sort.Ridge_KFold_Sort_Permutation(Energy, Age, Times_IDRange, FoldQuantity, Alpha_Range, ResultantFolder, 1, 1000, '-q all.q,basic.q')
import ElasticNet_CZ_LOOCV import LinearRegression_CZ_LOOCV Subjects_Data = np.random.rand(20, 5) Subjects_Score = np.random.rand(20, 1) Subjects_Score = np.transpose(Subjects_Score) Subjects_Score = Subjects_Score[0] # Range of parameters Alpha_Range = np.exp2(np.arange(5) - 10) L1_ratio_Range = np.linspace(0.2, 1, 5) Fold_Quantity = 2 Parallel_Quantity = 1 Permutation_Flag = 0 ResultantFolder = '/Users/zaixucui/Dropbox/Pattern_Regression_Clean/res' Ridge_CZ_Sort.Ridge_KFold_Sort(Subjects_Data, Subjects_Score, Fold_Quantity, Alpha_Range, ResultantFolder, Parallel_Quantity, Permutation_Flag) Lasso_CZ_Sort.Lasso_KFold_Sort(Subjects_Data, Subjects_Score, Fold_Quantity, Alpha_Range, ResultantFolder, Parallel_Quantity, Permutation_Flag) LinearRegression_CZ_Sort.LinearRegression_KFold_Sort(Subjects_Data, Subjects_Score, Fold_Quantity, ResultantFolder, Permutation_Flag) ElasticNet_CZ_Sort.ElasticNet_KFold_Sort(Subjects_Data, Subjects_Score, Fold_Quantity, Alpha_Range, L1_ratio_Range, ResultantFolder, Parallel_Quantity, Permutation_Flag) CVRepeatTimes_ForInner = 5 Ridge_CZ_RandomCV.Ridge_KFold_RandomCV_MultiTimes(
import scipy.io as sio import numpy as np import os import sys sys.path.append( '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/scripts_Final/Functions' ) import Ridge_CZ_Sort PredictionFolder = '/data/jux/BBL/projects/pncSingleFuncParcel/Replication/results/PredictionAnalysis' AtlasLoading_Folder = PredictionFolder + '/AtlasLoading' # Import data AtlasLoading_Mat = sio.loadmat(AtlasLoading_Folder + '/AtlasLoading_All_RemoveZero.mat') Behavior_Mat = sio.loadmat(PredictionFolder + '/Behavior_693.mat') Subjects_Data = AtlasLoading_Mat['AtlasLoading_All_RemoveZero'] AgeYears = Behavior_Mat['AgeYears'] AgeYears = np.transpose(AgeYears) # Range of parameters Alpha_Range = np.exp2(np.arange(16) - 10) ResultantFolder = AtlasLoading_Folder + '/Weight_Age' Ridge_CZ_Sort.Ridge_Weight(Subjects_Data, AgeYears, 1, 2, Alpha_Range, ResultantFolder, 1)