Created
June 7, 2020 07:35
-
-
Save findtharun/ca6dee226453d01ba1fcf4c7f6ce555f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train_data, validation_data, test_data = np.split(dataset.sample(frac=1, random_state=1729), [int(0.7 * len(dataset)), int(0.9 * len(dataset))]) | |
train_data.to_csv('train.csv', header=False, index=False) | |
validation_data.to_csv('validation.csv', header=False, index=False) | |
#UPLOADING AND TRAINING AND VALIDATION TO DATA TO S3 BUCKET | |
s3_input_train = boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'train/train.csv')).upload_file('train.csv') | |
s3_input_validation = boto3.Session().resource('s3').Bucket(bucket).Object(os.path.join(prefix, 'validation/validation.csv')).upload_file('validation.csv') | |
#MAKING DATA AS LIBSVM or CSV FORMAT | |
s3_input_train = sagemaker.s3_input(s3_data='s3://{}/{}/train'.format(bucket, prefix), content_type='csv') | |
s3_input_validation = sagemaker.s3_input(s3_data='s3://{}/{}/validation/'.format(bucket, prefix), content_type='csv') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment