tests.system.providers.amazon.aws.example_sagemaker
¶
Module Contents¶
Functions¶
generates a very simple csv dataset with headers |
|
|
|
|
|
|
|
|
|
|
Attributes¶
- tests.system.providers.amazon.aws.example_sagemaker.PREPROCESS_SCRIPT_TEMPLATE = Multiline-String[source]¶
Show Value
""" import boto3 import numpy as np import pandas as pd def main(): # Load the dataset from {input_path}/input.csv, split it into train/test # subsets, and write them to {output_path}/ for the Processing Operator. data = pd.read_csv('{input_path}/input.csv') # Split into test and train data data_train, data_test = np.split( data.sample(frac=1, random_state=np.random.RandomState()), [int(0.7 * len(data))] ) # Remove the "answers" from the test set data_test.drop(['class'], axis=1, inplace=True) # Write the splits to disk data_train.to_csv('{output_path}/train.csv', index=False, header=False) data_test.to_csv('{output_path}/test.csv', index=False, header=False) print('Preprocessing Done.') if __name__ == "__main__": main() """
- tests.system.providers.amazon.aws.example_sagemaker.generate_data()[source]¶
generates a very simple csv dataset with headers