data/loader.py
def load_custom_dataset(normalize=False, batch_size=1024, rand_seed=0, test_ratio=0.2):
    """
    The function to load the Particle dataset
    :param: normalize (default False): whether normalize or not 
    """
    # Load the Customize dataset
    print("Loading Customize")

    # Check if there is customize dataset
    data_x_file = os.path.join('Customize_data', 'data_g.csv')
    data_y_file = os.path.join('Customize_data', 'data_s.csv')
    if not os.path.isfile(data_x_file) or not os.path.isfile(data_y_file):
        print('Make sure your customize dataset is placed under Customize_data \
            which is under the Data folder which has been added to path AND your\
                 input is named data_g.csv and output named data_s.csv')
        exit()
    # Read the training/validation data
    data_x = pd.read_csv(data_x_file, header=None).astype('float32').values
    data_y = pd.read_csv(data_y_file, header=None).astype('float32').values

    # Read the test data
    test_x_file = os.path.join('Customize_data', 'testset', 'test_g.csv')
    test_y_file = os.path.join('Customize_data', 'testset', 'test_s.csv')
    if not os.path.isfile(test_x_file) or not os.path.isfile(test_y_file):
        print('Make sure your customize test is placed under Customize_data/testset \
            which is under the Data folder which has been added to path AND your\
                 input is named test_g.csv and output named test_s.csv')
        exit()
    test_x = pd.read_csv(test_x_file, header=None).astype('float32').values
    test_y = pd.read_csv(test_y_file, header=None).astype('float32').values

    # Normalize the dataset (with the same normalization with training and testing)
    if normalize:
        data_x, x_max, x_min = normalize_np(data_x)
        test_x, _, _, = normalize_np(test_x, x_max, x_min)

    # Print the shapes 
    print("shape of data_x", np.shape(data_x))
    print("shape of data_y", np.shape(data_y))
    print("shape of test_x", np.shape(test_x))
    print("shape of test_y", np.shape(test_y))
    
    # Put the training and testing 
    if np.shape(data_x)[1] == 1 or np.shape(data_y)[1] == 1 or len(np.shape(data_x)) != 2:
        print('Your customize dataset does not satisfy requirement, \
            either your input or output is 1 dimension, which is not currently supported')
    train_loader, test_loader = get_data_into_loaders(data_x, data_y, batch_size, 
                        SimulatedDataSet_regress, rand_seed=rand_seed, test_ratio=test_ratio)

    print("Finish loading Custom dataset")
    return train_loader, test_loader, test_x, test_y

    The function to load the Particle dataset
    :param: normalize (default False): whether normalize or not 
    
The function to load the Particle dataset
:param: normalize (default False): whether normalize or not
The function to load the Particle dataset : param : normalize ( default False ) : whether normalize or not
def load_custom_dataset(normalize=False, batch_size=1024, rand_seed=0, test_ratio=0.2):
    print("Loading Customize")
    data_x_file = os.path.join('Customize_data', 'data_g.csv')
    data_y_file = os.path.join('Customize_data', 'data_s.csv')
    if not os.path.isfile(data_x_file) or not os.path.isfile(data_y_file):
        print('Make sure your customize dataset is placed under Customize_data \
            which is under the Data folder which has been added to path AND your\
                 input is named data_g.csv and output named data_s.csv')
        exit()
    data_x = pd.read_csv(data_x_file, header=None).astype('float32').values
    data_y = pd.read_csv(data_y_file, header=None).astype('float32').values
    test_x_file = os.path.join('Customize_data', 'testset', 'test_g.csv')
    test_y_file = os.path.join('Customize_data', 'testset', 'test_s.csv')
    if not os.path.isfile(test_x_file) or not os.path.isfile(test_y_file):
        print('Make sure your customize test is placed under Customize_data/testset \
            which is under the Data folder which has been added to path AND your\
                 input is named test_g.csv and output named test_s.csv')
        exit()
    test_x = pd.read_csv(test_x_file, header=None).astype('float32').values
    test_y = pd.read_csv(test_y_file, header=None).astype('float32').values
    if normalize:
        data_x, x_max, x_min = normalize_np(data_x)
        test_x, _, _, = normalize_np(test_x, x_max, x_min)
    print("shape of data_x", np.shape(data_x))
    print("shape of data_y", np.shape(data_y))
    print("shape of test_x", np.shape(test_x))
    print("shape of test_y", np.shape(test_y))
    if np.shape(data_x)[1] == 1 or np.shape(data_y)[1] == 1 or len(np.shape(data_x)) != 2:
        print('Your customize dataset does not satisfy requirement, \
            either your input or output is 1 dimension, which is not currently supported')
    train_loader, test_loader = get_data_into_loaders(data_x, data_y, batch_size, 
                        SimulatedDataSet_regress, rand_seed=rand_seed, test_ratio=test_ratio)
    print("Finish loading Custom dataset")
    return train_loader, test_loader, test_x, test_y
def load_custom_dataset ( normalize = False , batch_size = 1024 , rand_seed = 0 , test_ratio = 0.2 ) : print ( "Loading Customize" ) data_x_file = os . path . join ( 'Customize_data' , 'data_g.csv' ) data_y_file = os . path . join ( 'Customize_data' , 'data_s.csv' ) if not os . path . isfile ( data_x_file ) or not os . path . isfile ( data_y_file ) : print ( 'Make sure your customize dataset is placed under Customize_data \
            which is under the Data folder which has been added to path AND your\
                 input is named data_g.csv and output named data_s.csv' ) exit ( ) data_x = pd . read_csv ( data_x_file , header = None ) . astype ( 'float32' ) . values data_y = pd . read_csv ( data_y_file , header = None ) . astype ( 'float32' ) . values test_x_file = os . path . join ( 'Customize_data' , 'testset' , 'test_g.csv' ) test_y_file = os . path . join ( 'Customize_data' , 'testset' , 'test_s.csv' ) if not os . path . isfile ( test_x_file ) or not os . path . isfile ( test_y_file ) : print ( 'Make sure your customize test is placed under Customize_data/testset \
            which is under the Data folder which has been added to path AND your\
                 input is named test_g.csv and output named test_s.csv' ) exit ( ) test_x = pd . read_csv ( test_x_file , header = None ) . astype ( 'float32' ) . values test_y = pd . read_csv ( test_y_file , header = None ) . astype ( 'float32' ) . values if normalize : data_x , x_max , x_min = normalize_np ( data_x ) test_x , _ , _ , = normalize_np ( test_x , x_max , x_min ) print ( "shape of data_x" , np . shape ( data_x ) ) print ( "shape of data_y" , np . shape ( data_y ) ) print ( "shape of test_x" , np . shape ( test_x ) ) print ( "shape of test_y" , np . shape ( test_y ) ) if np . shape ( data_x ) [ 1 ] == 1 or np . shape ( data_y ) [ 1 ] == 1 or len ( np . shape ( data_x ) ) != 2 : print ( 'Your customize dataset does not satisfy requirement, \
            either your input or output is 1 dimension, which is not currently supported' ) train_loader , test_loader = get_data_into_loaders ( data_x , data_y , batch_size , SimulatedDataSet_regress , rand_seed = rand_seed , test_ratio = test_ratio ) print ( "Finish loading Custom dataset" ) return train_loader , test_loader , test_x , test_y
The function to load the Particle dataset
:param: normalize (default False): whether normalize or not
The function to load the Particle dataset : param : normalize ( default False ) : whether normalize or not
"""
    The function to load the Particle dataset
    :param: normalize (default False): whether normalize or not 
    """ # Load the Customize dataset
 # Check if there is customize dataset
 # Read the training/validation data
 # Read the test data
 # Normalize the dataset (with the same normalization with training and testing)
 # Print the shapes 
 # Put the training and testing 

normalize
batch_size
rand_seed
test_ratio