-
Notifications
You must be signed in to change notification settings - Fork 0
/
Energy.py
58 lines (43 loc) · 1.32 KB
/
Energy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Creating aws machine learning model
# This program uploads the finalData.csv file to S3, and used it as a data source to train a binary
# classification model
import time,sys,random
import boto3
import S3
sys.path.append('utils')
import aws
client = aws.getClient('machinelearning','us-east-1')
TIMESTAMP = time.strftime('%Y-%m-%d-%H-%M-%S')
S3_BUCKET_NAME = "finalBaochan"
S3_FILE_NAME = 'training_energy.csv'
S3_URI = "s3://{0}/{1}".format(S3_BUCKET_NAME, S3_FILE_NAME)
DATA_SCHEMA =open("Energy.csv.schema").read()
DATA_SOURCE_ID = 'Energy0'
ML_MODEL_ID = 'Energy0'
#EVALUATION_ID = 'lab5Evaluation_13'
testvariable = S3.S3(S3_FILE_NAME)
#testvariable.uploadData()
response = client.create_data_source_from_s3(
DataSourceId=DATA_SOURCE_ID,
DataSourceName='finaldataEnergy',
DataSpec={
'DataLocationS3': S3_URI,
'DataSchema': DATA_SCHEMA
},
ComputeStatistics=True
)
response1 = client.create_ml_model(
MLModelId= ML_MODEL_ID,
MLModelName='finalmodelEnergy',
MLModelType='REGRESSION',
TrainingDataSourceId= DATA_SOURCE_ID
)
#response = client.create_evaluation(
# EvaluationId= EVALUATION_ID,
# EvaluationName='lab5Evaluation',
# MLModelId= ML_MODEL_ID,
# EvaluationDataSourceId= DATA_SOURCE_ID
#)
#response = client.get_evaluation(
# EvaluationId= EVALUATION_ID
#)