Demos / IoT / Sensors & Machines Predictive Analysis

Predicting Likelihood of Building Exceeding Threshold Temperatures

Your machines know things. From connected cars, to equipment in the field, to machines on the assembly line floor—sensors stream low-cost, always-on data. Hadoop makes it easier for you to store and refine that data and identify meaningful patterns, providing you with the insight to make proactive business decisions using predictive analytics.

In this video, we show how Hadoop can be used to analyze heating, ventilation and air conditioning data to maintain ideal office temperatures and minimize expenses.

Using the data cleansing and transformation mentioned in the tutorial below, we can further our analysis by applying Logistic Regression to the generated data. We will then be able to predict based on features of the building and the heating system, what buildings have a likelihood of exceeding target temperature.

/

  • Click on Image below to recap:

/

Image

%sh

wget http://s3.amazonaws.com/hw-sandbox/tutorial14/SensorFiles.zip
unzip SensorFiles.zip
hadoop fs -mkdir -p /user/zeppelin/SensorDemo
hadoop fs -copyFromLocal -f SensorFiles/HVAC.csv /user/zeppelin/SensorDemo/
hadoop fs -tail /user/zeppelin/SensorDemo/HVAC.csv
--2016-02-03 00:39:29-- http://s3.amazonaws.com/hw-sandbox/tutorial14/SensorFiles.zip Resolving s3.amazonaws.com... 54.231.14.32 Connecting to s3.amazonaws.com|54.231.14.32|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 64777 (63K) [application/zip] Saving to: “SensorFiles.zip” 0K .......... .......... .......... .......... .......... 79% 397K 0s 50K .......... ... 100% 9.23M=0.1s 2016-02-03 00:39:29 (497 KB/s) - “SensorFiles.zip” saved [64777/64777] Archive: SensorFiles.zip inflating: SensorFiles/building.csv inflating: SensorFiles/ExtremeTemps.hiv inflating: SensorFiles/HVAC.csv inflating: SensorFiles/JoinBuildingHVAC.hiv 6/17/13,20:43:51,68,70,8,10,20 6/18/13,21:43:51,70,64,7,8,2 6/19/13,22:43:51,68,76,19,17,20 6/20/13,23:43:51,69,80,20,24,20 6/21/13,0:13:20,66,55,17,25,11 6/22/13,1:13:20,66,66,18,27,15 6/23/13,2:13:20,69,74,17,12,18 6/24/13,3:13:20,68,69,18,9,11 6/25/13,4:13:20,67,69,13,28,7 6/26/13,5:13:20,66,66,7,4,4 6/27/13,6:13:20,69,71,9,24,11 6/28/13,7:13:20,70,80,1,24,20 6/29/13,8:13:20,70,79,17,21,12 6/30/13,9:13:20,70,70,2,29,10 6/1/13,10:13:20,67,77,9,3,5 6/2/13,11:13:20,66,66,18,3,7 6/3/13,12:13:20,68,57,5,7,16 6/4/13,13:13:20,66,66,2,24,11 6/5/13,14:13:20,67,68,4,22,20 6/6/13,15:13:20,67,79,5,8,3 6/7/13,16:13:20,67,62,9,14,2 6/8/13,17:13:20,65,75,13,13,10 6/9/13,18:13:20,67,65,4,17,13 6/10/13,19:13:20,70,55,20,12,4 6/11/13,20:13:20,65,68,15,2,14 6/12/13,21:13:20,68,74,1,30,13 6/13/13,22:13:20,66,61,4,15,20 6/14/13,23:13:20,67,55,3,14,14 6/15/13,0:33:07,70,60,2,9,19 6/16/13,1:33:07,66,58,17,18,20 6/17/13,2:33:07,68,72,17,27,12 6/18/13,3:33:07,68,69,10,4,3 6/19/13,4:33:07,65,63,7,23,20 6/20/13,5:33:07,66,66,9,21,3
/* Let's start by creating a RDD for the data we just imported. Once an RDD is created we can create Temporary Table with Schema that allows us to run SparkSQL. The results of SQL queries are DataFrames and support all the normal RDD operations.*/

val sqlContext = new org.apache.spark.sql.SQLContext(sc)

val eventsFile = sc.textFile("hdfs:///user/zeppelin/SensorDemo/HVAC.csv")

case class Event(Date: String, 
                Time: String, 
                TargetTemp: Float, 
                ActualTemp: Float, 
                System: String, 
                SystemAge: Int, 
                BuildingID: String)



val eventsRDD = eventsFile.mapPartitionsWithIndex { (idx, iter) => if (idx == 0) iter.drop(1) else iter }.map(s=> s.split(",")).map( 
    s => Event(s(0),
            s(1), 
            s(2).toFloat, 
            s(3).toFloat, 
            s(4), 
            s(5).toInt, 
            s(6)
        )
    )

eventsRDD.count

eventsRDD.toDF().registerTempTable("tempSeries")
sqlContext: org.apache.spark.sql.SQLContext = org.apache.spark.sql.SQLContext@762109a9 eventsFile: org.apache.spark.rdd.RDD[String] = MapPartitionsRDD[57] at textFile at <console>:24 defined class Event eventsRDD: org.apache.spark.rdd.RDD[Event] = MapPartitionsRDD[60] at map at <console>:30 res123: Long = 8000
%sql

select * from tempSeries
DateTimeTargetTempActualTempSystemSystemAgeBuildingID
6/1/130:00:0166.058.013204
6/2/131:00:0169.068.032017
6/3/132:00:0170.073.0172018
6/4/133:00:0167.063.022315
6/5/134:00:0168.074.01693
6/6/135:00:0167.056.013284
6/7/136:00:0170.058.012242
6/8/137:00:0170.073.0202616
6/9/138:00:0166.069.01699
6/10/139:00:0165.057.06512
6/11/1310:00:0167.070.0101715
6/12/1311:00:0169.062.02117
6/13/1312:00:0169.073.014215
6/14/1313:00:0165.061.0326
6/15/1314:00:0167.059.0192220
6/16/1315:00:0165.056.019118
6/17/1316:00:0167.057.01576
6/18/1317:00:0166.057.012513
6/19/1318:00:0169.058.08224
6/20/1319:00:0167.055.01757
6/21/1320:00:0169.072.07517
6/22/1321:00:0166.069.06299
6/23/1322:00:0167.065.061820
6/24/1323:00:0167.061.015136
6/25/130:13:1970.071.0191418
6/26/131:13:1967.071.0168
6/27/132:13:1969.068.0161414
6/28/133:13:1965.056.081815
6/29/134:13:1966.077.07613
6/30/135:13:1970.063.07135
6/1/136:13:1968.066.011153
6/2/137:13:1969.060.014118
6/3/138:13:1966.065.0141811
6/4/139:13:1967.069.0159
6/5/1310:13:1970.078.05510
6/6/1311:13:1967.072.016819
6/7/1312:13:1967.073.017302
6/8/1313:13:1965.075.041310
6/9/1314:13:1967.068.02172
6/10/1315:13:1965.077.015176
6/11/1316:13:1966.067.016243
6/12/1317:13:1969.064.018252
6/13/1318:13:1967.068.02141
6/14/1319:13:1968.075.09225
6/15/1320:13:1969.058.0964
6/16/1321:13:1969.077.019209
6/17/1322:13:1967.073.0242
6/18/1323:13:1966.075.011312
6/19/130:43:5170.065.01195
6/20/131:43:5169.065.07302
6/21/132:43:5166.056.0162814
6/22/133:43:5169.067.0349
6/23/134:43:5170.068.02126
6/24/135:43:5170.063.0153020
6/25/136:43:5165.063.0111317
6/26/137:43:5167.078.0132218
6/27/138:43:5168.061.015287
6/28/139:43:5166.065.04242
6/29/1310:43:5169.059.017259
6/30/1311:43:5168.067.08176
6/1/1312:43:5169.079.06157
6/2/1313:43:5165.072.0202612
6/3/1314:43:5165.057.032418
6/4/1315:43:5166.056.020256
6/5/1316:43:5165.071.02149
6/6/1317:43:5167.079.01910
6/7/1318:43:5167.072.0132915
6/8/1319:43:5169.076.0112511
6/9/1320:43:5165.067.062116
6/10/1321:43:5167.074.031914
6/11/1322:43:5168.076.09282
6/12/1323:43:5168.069.072620
6/13/130:13:2067.077.081912
6/14/131:13:2070.068.0611
6/15/132:13:2070.057.07126
6/16/133:13:2067.055.0111612
6/17/134:13:2070.055.0171719
6/18/135:13:2070.058.061719
6/19/136:13:2069.075.09216
6/20/137:13:2069.075.0131416
6/21/138:13:2069.055.01814
6/22/139:13:2065.068.015203
6/23/1310:13:2065.063.052219
6/24/1311:13:2065.065.019242
6/25/1312:13:2068.055.014520
6/26/1313:13:2068.067.018289
6/27/1314:13:2066.075.043014
6/28/1315:13:2065.062.082317
6/29/1316:13:2070.077.07242
6/30/1317:13:2065.057.017912
6/1/1318:13:2068.065.072112
6/2/1319:13:2065.072.04113
6/3/1320:13:2066.067.018206
6/4/1321:13:2068.065.042115
6/5/1322:13:2067.073.018197
6/6/1323:13:2070.070.01335
6/7/130:33:0768.072.01881
6/8/131:33:0770.080.016249
6/9/132:33:0767.076.016239
6/10/133:33:0769.079.0102915
6/11/134:33:0766.070.0181811
6/12/135:33:0765.070.01766
6/13/136:33:0766.078.09117
6/14/137:33:0765.060.0132116
6/15/138:33:0768.065.0102010
6/16/139:33:0769.079.07813
6/17/1310:33:0768.065.042516
6/18/1311:33:0769.064.01913
6/19/1312:33:0769.055.07510
6/20/1313:33:0767.059.02153
6/21/1314:33:0770.064.08173
6/22/1315:33:0767.076.06911
6/23/1316:33:0770.068.07116
6/24/1317:33:0770.080.062817
6/25/1318:33:0770.066.0202012
6/26/1319:33:0768.068.0111219
6/27/1320:33:0765.080.0549
6/28/1321:33:0770.079.042114
6/29/1322:33:0770.064.06126
6/30/1323:33:0769.060.01092
6/1/130:00:0169.060.0587
6/2/131:00:0167.074.031016
6/3/132:00:0168.080.041315
6/4/133:00:0169.071.013287
6/5/134:00:0170.068.02263
6/6/135:00:0168.059.015811
6/7/136:00:0170.063.032713
6/8/137:00:0167.078.017619
6/9/138:00:0166.067.012174
6/10/139:00:0167.067.02817
6/11/1310:00:0169.060.011294
6/12/1311:00:0170.063.01467
6/13/1312:00:0170.060.019166
6/14/1313:00:0169.078.06262
6/15/1314:00:0165.071.0746
6/16/1315:00:0170.055.018514
6/17/1316:00:0169.068.016412
6/18/1317:00:0168.061.010251
6/19/1318:00:0165.057.020510
6/20/1319:00:0166.067.011015
6/21/1320:00:0167.072.014299
6/22/1321:00:0169.070.0974
6/23/1322:00:0168.059.0172417
6/24/1323:00:0166.076.0151619
6/25/130:13:1969.066.04139
6/26/131:13:1969.059.07152
6/27/132:13:1970.067.09817
6/28/133:13:1966.059.0202720
6/29/134:13:1965.070.013520
6/30/135:13:1967.061.010209
6/1/136:13:1969.064.09287
6/2/137:13:1967.071.01527
6/3/138:13:1970.061.04520
6/4/139:13:1965.056.0165
6/5/1310:13:1965.077.0201519
6/6/1311:13:1965.066.082018
6/7/1312:13:1967.060.020104
6/8/1313:13:1968.067.071817
6/9/1314:13:1968.080.0597
6/10/1315:13:1968.057.02117
6/11/1316:13:1967.059.019293
6/12/1317:13:1967.065.02091
6/13/1318:13:1969.077.01184
6/14/1319:13:1969.056.03257
6/15/1320:13:1967.066.08181
6/16/1321:13:1969.064.020275
6/17/1322:13:1970.077.014161
6/18/1323:13:1966.068.020301
6/19/130:43:5170.066.016102
6/20/131:43:5168.060.0162411
6/21/132:43:5165.066.0162516
6/22/133:43:5167.079.0181317
6/23/134:43:5168.063.021019
6/24/135:43:5166.063.014228
6/25/136:43:5167.078.051216
6/26/137:43:5167.078.017154
6/27/138:43:5166.059.0201917
6/28/139:43:5169.063.022511
6/29/1310:43:5167.061.03196
6/30/1311:43:5170.067.022720
6/1/1312:43:5170.059.09123
6/2/1313:43:5170.076.052119
6/3/1314:43:5170.071.0192711
6/4/1315:43:5169.078.0151620
6/5/1316:43:5169.069.0191512
6/6/1317:43:5167.071.09220
6/7/1318:43:5165.071.0182518
6/8/1319:43:5170.071.0191520
6/9/1320:43:5166.057.014151
6/10/1321:43:5169.080.0151610
6/11/1322:43:5165.078.0829
6/12/1323:43:5170.066.01625
6/13/130:13:2065.077.0199
6/14/131:13:2069.067.0192615
6/15/132:13:2069.058.062816
6/16/133:13:2069.080.017225
6/17/134:13:2066.060.01312
6/18/135:13:2066.055.019106
6/19/136:13:2069.074.0191810
6/20/137:13:2065.064.021014
6/21/138:13:2070.062.0192614
6/22/139:13:2070.077.013176
6/23/1310:13:2065.061.01112
6/24/1311:13:2069.060.01125
6/25/1312:13:2069.062.0131
6/26/1313:13:2066.063.072115
6/27/1314:13:2070.060.010234
6/28/1315:13:2065.061.081018
6/29/1316:13:2067.080.012812
6/30/1317:13:2068.057.0178
6/1/1318:13:2066.073.0958
6/2/1319:13:2065.060.0112910
6/3/1320:13:2069.067.02211
6/4/1321:13:2066.072.07112
6/5/1322:13:2065.076.013165
6/6/1323:13:2068.057.014259
6/7/130:33:0770.077.0111917
6/8/131:33:0769.058.03119
6/9/132:33:0767.079.020188
6/10/133:33:0766.068.0151520
6/11/134:33:0769.056.0171119
6/12/135:33:0767.062.031217
6/13/136:33:0766.064.012284
6/14/137:33:0768.072.016212
6/15/138:33:0768.055.0142716
6/16/139:33:0765.077.0141020
6/17/1310:33:0767.072.012817
6/18/1311:33:0767.064.08297
6/19/1312:33:0765.064.013919
6/20/1313:33:0768.080.06141
6/21/1314:33:0768.062.0612
6/22/1315:33:0770.056.0839
6/23/1316:33:0765.069.04269
6/24/1317:33:0765.057.06191
6/25/1318:33:0768.070.014126
6/26/1319:33:0770.068.082120
6/27/1320:33:0769.073.041415
6/28/1321:33:0766.074.019293
6/29/1322:33:0767.076.016516
6/30/1323:33:0767.073.01418
6/1/130:00:0169.055.014617
6/2/131:00:0168.077.05193
6/3/132:00:0169.072.072112
6/4/133:00:0168.069.02614
6/5/134:00:0165.070.0153010
6/6/135:00:0167.078.01153
6/7/136:00:0165.077.018117
6/8/137:00:0165.075.011711
6/9/138:00:0170.071.017244
6/10/139:00:0170.060.071513
6/11/1310:00:0170.065.0259
6/12/1311:00:0165.074.013013
6/13/1312:00:0169.079.0629
6/14/1313:00:0167.057.011313
6/15/1314:00:0170.071.0629
6/16/1315:00:0167.077.042212
6/17/1316:00:0165.059.019101
6/18/1317:00:0165.071.0181713
6/19/1318:00:0168.066.02272
6/20/1319:00:0167.077.0645
6/21/1320:00:0165.074.0219
6/22/1321:00:0170.077.0131212
6/23/1322:00:0167.074.0151719
6/24/1323:00:0169.079.02222
6/25/130:13:1965.069.010516
6/26/131:13:1965.066.04309
6/27/132:13:1969.072.09233
6/28/133:13:1968.078.091519
6/29/134:13:1970.065.011418
6/30/135:13:1968.068.015198
6/1/136:13:1969.072.02316
6/2/137:13:1967.068.032419
6/3/138:13:1970.075.08222
6/4/139:13:1970.064.032815
6/5/1310:13:1965.075.0121011
6/6/1311:13:1966.075.07310
6/7/1312:13:1966.069.021513
6/8/1313:13:1970.072.020191
6/9/1314:13:1969.057.0711
6/10/1315:13:1966.074.012713
6/11/1316:13:1965.063.0162618
6/12/1317:13:1969.066.017314
6/13/1318:13:1970.070.013233
6/14/1319:13:1965.062.0141414
6/15/1320:13:1967.065.010233
6/16/1321:13:1967.058.0172415
6/17/1322:13:1966.069.091511
6/18/1323:13:1967.069.0377
6/19/130:43:5167.066.07315
6/20/131:43:5169.079.08238
6/21/132:43:5167.064.062310
6/22/133:43:5167.064.0153019
6/23/134:43:5170.080.012241
6/24/135:43:5167.061.017710
6/25/136:43:5167.055.092118
6/26/137:43:5165.062.06612
6/27/138:43:5170.062.011117
6/28/139:43:5169.055.022616
6/29/1310:43:5167.060.061415
6/30/1311:43:5169.058.06510
6/1/1312:43:5168.076.012258
6/2/1313:43:5168.074.03317
6/3/1314:43:5170.076.06174
6/4/1315:43:5168.057.014175
6/5/1316:43:5169.066.09305
6/6/1317:43:5170.071.0841
6/7/1318:43:5165.071.072616
6/8/1319:43:5167.073.021615
6/9/1320:43:5169.074.0141816
6/10/1321:43:5167.073.05262
6/11/1322:43:5166.078.092820
6/12/1323:43:5168.066.01175
6/13/130:13:2066.061.03246
6/14/131:13:2069.073.01431
6/15/132:13:2069.071.011214
6/16/133:13:2069.071.04232
6/17/134:13:2068.066.018209
6/18/135:13:2066.067.062018
6/19/136:13:2070.074.06220
6/20/137:13:2069.057.01456
6/21/138:13:2066.071.0865
6/22/139:13:2068.067.0103014
6/23/1310:13:2067.059.0819
6/24/1311:13:2070.080.020175
6/25/1312:13:2069.071.08146
6/26/1313:13:2065.063.020912
6/27/1314:13:2067.069.071310
6/28/1315:13:2065.066.0103017
6/29/1316:13:2070.076.01132
6/30/1317:13:2066.062.0142612
6/1/1318:13:2065.066.011301
6/2/1319:13:2067.063.019219
6/3/1320:13:2067.069.01321
6/4/1321:13:2066.063.0163019
6/5/1322:13:2069.070.05272
6/6/1323:13:2066.055.015114
6/7/130:33:0766.077.09288
6/8/131:33:0767.075.014419
6/9/132:33:0769.078.011518
6/10/133:33:0770.078.05912
6/11/134:33:0765.067.01168
6/12/135:33:0767.071.012134
6/13/136:33:0768.062.01781
6/14/137:33:0770.068.014215
6/15/138:33:0766.072.010293
6/16/139:33:0766.071.032019
6/17/1310:33:0766.066.09410
6/18/1311:33:0769.061.0878
6/19/1312:33:0769.066.081913
6/20/1313:33:0765.069.0152810
6/21/1314:33:0769.061.0141220
6/22/1315:33:0769.067.0871
6/23/1316:33:0767.056.02218
6/24/1317:33:0768.062.03616
6/25/1318:33:0768.071.02023
6/26/1319:33:0769.060.0162416
6/27/1320:33:0767.076.010152
6/28/1321:33:0769.055.04168
6/29/1322:33:0770.058.06913
6/30/1323:33:0767.077.0121416
6/1/130:00:0169.058.018812
6/2/131:00:0170.061.0202613
6/3/132:00:0168.068.012118
6/4/133:00:0169.069.011102
6/5/134:00:0168.072.0201411
6/6/135:00:0166.073.0202617
6/7/136:00:0167.069.0162514
6/8/137:00:0168.069.021717
6/9/138:00:0167.064.018194
6/10/139:00:0169.079.031614
6/11/1310:00:0168.069.032815
6/12/1311:00:0166.069.08225
6/13/1312:00:0167.071.08513
6/14/1313:00:0168.062.014301
6/15/1314:00:0165.057.061317
6/16/1315:00:0165.074.06149
6/17/1316:00:0169.069.0142817
6/18/1317:00:0165.064.01144
6/19/1318:00:0167.064.06308
6/20/1319:00:0165.078.0141019
6/21/1320:00:0167.075.02228
6/22/1321:00:0166.056.011217
6/23/1322:00:0165.077.01323
6/24/1323:00:0165.071.017145
6/25/130:13:1969.056.018513
6/26/131:13:1968.079.01229
6/27/132:13:1968.059.02229
6/28/133:13:1967.075.0152615
6/29/134:13:1970.057.0113014
6/30/135:13:1965.075.018136
6/1/136:13:1970.056.02183
6/2/137:13:1966.070.0131215
6/3/138:13:1968.067.09308
6/4/139:13:1968.055.012133
6/5/1310:13:1967.058.0171216
6/6/1311:13:1968.060.091713
6/7/1312:13:1966.056.082113
6/8/1313:13:1968.071.016228
6/9/1314:13:1968.060.018719
6/10/1315:13:1966.059.0111413
6/11/1316:13:1968.061.08211
6/12/1317:13:1970.057.051017
6/13/1318:13:1969.072.04718
6/14/1319:13:1965.057.0102514
6/15/1320:13:1969.080.0191311
6/16/1321:13:1967.078.013274
6/17/1322:13:1966.065.0151911
6/18/1323:13:1970.059.011610
6/19/130:43:5165.058.03201
6/20/131:43:5169.060.019168
6/21/132:43:5168.078.01868
6/22/133:43:5168.065.0122517
6/23/134:43:5167.074.091417
6/24/135:43:5169.065.0152710
6/25/136:43:5168.068.02712
6/26/137:43:5170.059.0192311
6/27/138:43:5169.057.0192312
6/28/139:43:5165.068.0857
6/29/1310:43:5165.072.0162513
6/30/1311:43:5166.059.04115
6/1/1312:43:5170.074.0566
6/2/1313:43:5166.064.012168
6/3/1314:43:5170.062.03295
6/4/1315:43:5169.060.0162110
6/5/1316:43:5165.067.015163
6/6/1317:43:5167.055.08201
6/7/1318:43:5165.059.0192719
6/8/1319:43:5170.074.01237
6/9/1320:43:5168.058.0141318
6/10/1321:43:5166.060.06216
6/11/1322:43:5170.070.071014
6/12/1323:43:5170.079.082215
6/13/130:13:2070.055.0102813
6/14/131:13:2065.061.07220
6/15/132:13:2069.067.0172116
6/16/133:13:2066.079.018246
6/17/134:13:2068.069.09291
6/18/135:13:2070.062.012917
6/19/136:13:2066.061.01596
6/20/137:13:2070.067.032713
6/21/138:13:2065.059.0191514
6/22/139:13:2069.068.011219
6/23/1310:13:2067.056.020179
6/24/1311:13:2069.059.0111716
6/25/1312:13:2069.058.01349
6/26/1313:13:2068.072.0659
6/27/1314:13:2068.060.06294
6/28/1315:13:2066.061.08613
6/29/1316:13:2065.068.09286
6/30/1317:13:2065.076.031114
6/1/1318:13:2068.064.013101
6/2/1319:13:2066.058.019119
6/3/1320:13:2065.056.0142418
6/4/1321:13:2070.058.082114
6/5/1322:13:2066.064.07139
6/6/1323:13:2065.057.08512
6/7/130:33:0769.071.0191812
6/8/131:33:0767.064.0202210
6/9/132:33:0766.072.0172613
6/10/133:33:0770.065.07818
6/11/134:33:0766.073.013224
6/12/135:33:0768.066.021519
6/13/136:33:0768.076.017711
6/14/137:33:0770.065.0494
6/15/138:33:0769.067.091418
6/16/139:33:0767.071.05254
6/17/1310:33:0766.059.042610
6/18/1311:33:0765.077.052811
6/19/1312:33:0770.059.0111410
6/20/1313:33:0770.078.09142
6/21/1314:33:0765.076.019910
6/22/1315:33:0769.073.071213
6/23/1316:33:0765.059.0162919
6/24/1317:33:0767.077.017199
6/25/1318:33:0767.055.0152815
6/26/1319:33:0769.072.062011
6/27/1320:33:0770.064.017711
6/28/1321:33:0767.061.013196
6/29/1322:33:0767.057.0161915
6/30/1323:33:0769.064.019185
6/1/130:45:5670.066.020919
6/2/131:45:5670.062.032016
6/3/132:45:5669.060.072616
6/4/133:45:5669.077.04105
6/5/134:45:5665.078.01355
6/6/135:45:5666.056.0202615
6/7/136:45:5666.078.03811
6/8/137:45:5667.074.04276
6/9/138:45:5669.055.0131517
6/10/139:45:5666.059.08295
6/11/1310:45:5665.069.09212
6/12/1311:45:5665.078.017224
6/13/1312:45:5666.068.041513
6/14/1313:45:5665.069.07133
6/15/1314:45:5668.067.011185
6/16/1315:45:5669.068.071720
6/17/1316:45:5665.074.052520
6/18/1317:45:5669.078.0887
6/19/1318:45:5668.056.082010
6/20/1319:45:5669.070.092819
6/21/1320:45:5668.064.01065
6/22/1321:45:5666.060.02512
6/23/1322:45:5665.075.01633
6/24/1323:45:5670.077.013281
6/25/130:45:5668.074.09111
6/26/131:45:5665.077.016202
6/27/132:45:5667.067.020320
6/28/133:45:5667.073.031620
6/29/134:45:5665.060.018213
6/30/135:45:5667.073.01783
6/1/136:45:5669.057.012619
6/2/137:45:5667.066.0184
6/3/138:45:5669.080.062216
6/4/139:45:5665.067.016235
6/5/1310:45:5670.057.0191818
6/6/1311:45:5668.064.0192714
6/7/1312:45:5667.065.019182
6/8/1313:45:5665.078.02213
6/9/1314:45:5668.080.081416
6/10/1315:45:5665.076.0142014
6/11/1316:45:5668.058.031210
6/12/1317:45:5669.064.0121312
6/13/1318:45:5670.055.03294
6/14/1319:45:5667.055.013305
6/15/1320:45:5665.080.012159
6/16/1321:45:5669.070.082213
6/17/1322:45:5669.068.013617
6/18/1323:45:5669.078.09302
6/19/130:45:5665.075.092212
6/20/131:45:5670.060.021715
6/21/132:45:5667.070.0191315
6/22/133:45:5669.078.013292
6/23/134:45:5669.070.05320
6/24/135:45:5668.072.06516
6/25/136:45:5667.062.09717
6/26/137:45:5665.071.020145
6/27/138:45:5667.076.0182910
6/28/139:45:5670.068.071420
6/29/1310:45:5665.080.0102216
6/30/1311:45:5668.057.041110
6/1/1312:45:5665.074.02279
6/2/1313:45:5670.062.014165
6/3/1314:45:5669.057.07220
6/4/1315:45:5666.070.0152516
6/5/1316:45:5670.061.018205
6/6/1317:45:5665.063.04287
6/7/1318:45:5666.062.0182117
6/8/130:00:0170.068.0112610
6/9/131:00:0170.056.0151510
6/10/132:00:0166.073.05917
6/11/133:00:0168.062.092219
6/12/134:00:0166.070.0172519
6/13/135:00:0169.063.011516
6/14/136:00:0165.075.013129
6/15/137:00:0165.066.051417
6/16/138:00:0167.058.031211
6/17/139:00:0168.063.017188
6/18/1310:00:0167.058.014116
6/19/1311:00:0170.074.04193
6/20/1312:00:0165.074.018298
6/21/1313:00:0170.063.062218
6/22/1314:00:0166.077.01485
6/23/1315:00:0168.066.0102918
6/24/1316:00:0168.063.081917
6/25/1317:00:0165.069.03918
6/26/1318:00:0167.056.012812
6/27/1319:00:0166.062.016617
6/28/1320:00:0168.077.031515
6/29/1321:00:0170.057.0112719
6/30/1322:00:0169.068.04203
6/1/1323:00:0169.079.051015
6/2/130:13:1970.074.02277
6/3/131:13:1969.066.031517
6/4/132:13:1965.062.081218
6/5/133:13:1966.066.013246
6/6/134:13:1967.077.014117
6/7/135:13:1968.064.0661
6/8/136:13:1965.079.0342
6/9/137:13:1967.080.0101020
6/10/138:13:1970.077.014284
6/11/139:13:1969.076.0172411
6/12/1310:13:1965.068.061812
6/13/1311:13:1966.062.013179
6/14/1312:13:1968.080.04147
6/15/1313:13:1967.075.011233
6/16/1314:13:1969.073.05235
6/17/1315:13:1966.062.06820
6/18/1316:13:1970.071.01216
6/19/1317:13:1967.069.0122318
6/20/1318:13:1970.056.01169
6/21/1319:13:1968.080.0915
6/22/1320:13:1969.062.041418
6/23/1321:13:1969.063.09127
6/24/1322:13:1970.075.015913
6/25/1323:13:1967.055.01062
6/26/130:43:5168.080.015717
6/27/131:43:5170.058.032816
6/28/132:43:5167.071.01215
6/29/133:43:5170.079.051318
6/30/134:43:5167.061.013226
6/1/135:43:5167.075.0102215
6/2/136:43:5168.057.0121415
6/3/137:43:5169.069.06156
6/4/138:43:5167.061.0143010
6/5/139:43:5170.059.0122218
6/6/1310:43:5165.078.0202412
6/7/1311:43:5165.065.07285
6/8/1312:43:5168.076.0121716
6/9/1313:43:5165.073.0172418
6/10/1314:43:5169.059.092413
6/11/1315:43:5169.067.015293
6/12/1316:43:5168.067.051711
6/13/1317:43:5165.077.011414
6/14/1318:43:5167.067.0201117
6/15/1319:43:5170.075.0495
6/16/1320:43:5168.067.062416
6/17/1321:43:5167.071.03318
6/18/1322:43:5168.078.0246
6/19/1323:43:5168.061.06176
6/20/130:13:2070.080.013247
6/21/131:13:2068.066.092120
6/22/132:13:2067.063.03413
6/23/133:13:2069.066.072012
6/24/134:13:2067.077.0152416
6/25/135:13:2067.069.015122
6/26/136:13:2069.069.01138
6/27/137:13:2065.067.031010
6/28/138:13:2067.073.03197
6/29/139:13:2070.077.06302
6/30/1310:13:2069.077.0573
6/1/1311:13:2065.065.06812
6/2/1312:13:2066.066.0171512
6/3/1313:13:2066.063.041816
6/4/1314:13:2065.064.072313
6/5/1315:13:2066.072.01219
6/6/1316:13:2065.076.012281
6/7/1317:13:2065.072.016104
6/8/1318:13:2068.061.019227
6/9/1319:13:2066.062.09115
6/10/1320:13:2068.065.01111
6/11/1321:13:2067.075.0459
6/12/1322:13:2065.076.0197
6/13/1323:13:2065.061.0121410
6/14/130:33:0769.064.012910
6/15/131:33:0765.055.062115
6/16/132:33:0769.072.082714
6/17/133:33:0767.075.01382
6/18/134:33:0767.070.0141119
6/19/135:33:0766.057.02215
6/20/136:33:0769.063.082319
6/21/137:33:0768.055.06610
6/22/138:33:0768.071.015418
6/23/139:33:0767.066.018287
6/24/1310:33:0766.059.0132115
6/25/1311:33:0769.058.0202716
6/26/1312:33:0769.064.081810
6/27/1313:33:0769.056.01839
6/28/1314:33:0766.065.062613
6/29/1315:33:0765.056.0181916
6/30/1316:33:0768.069.012712
6/1/1317:33:0770.065.011199
6/2/1318:33:0768.061.0162310
6/3/1319:33:0765.058.01645
6/4/1320:33:0765.079.0171720
6/5/1321:33:0769.064.0141511
6/6/1322:33:0766.065.0162914
6/7/1323:33:0767.069.03216
6/8/130:00:0169.070.01779
6/9/131:00:0169.080.02039
6/10/132:00:0166.068.017109
6/11/133:00:0170.068.03299
6/12/134:00:0167.066.031219
6/13/135:00:0165.066.011273
6/14/136:00:0166.069.0111012
6/15/137:00:0169.057.0121811
6/16/138:00:0169.057.015226
6/17/139:00:0169.064.0966
6/18/1310:00:0167.064.0531
6/19/1311:00:0166.067.01178
6/20/1312:00:0168.072.011109
6/21/1313:00:0169.068.0161113
6/22/1314:00:0167.055.010199
6/23/1315:00:0169.066.08137
6/24/1316:00:0167.067.04911
6/25/1317:00:0168.074.022218
6/26/1318:00:0168.058.019277
6/27/1319:00:0167.080.07720
6/28/1320:00:0166.060.015213
6/29/1321:00:0169.055.0629
6/30/1322:00:0169.058.08237
6/1/1323:00:0167.056.02132
6/2/130:13:1970.073.0202712
6/3/131:13:1965.068.011219
6/4/132:13:1966.059.010233
6/5/133:13:1966.065.019308
6/6/134:13:1966.074.019108
6/7/135:13:1970.073.0102511
6/8/136:13:1970.068.071210
6/9/137:13:1969.056.013127
6/10/138:13:1967.056.0151310
6/11/139:13:1965.063.0112311
6/12/1310:13:1966.061.033020
6/13/1311:13:1969.057.020611
6/14/1312:13:1967.062.0141310
6/15/1313:13:1969.070.04204
6/16/1314:13:1967.069.02171
6/17/1315:13:1969.078.031516
6/18/1316:13:1966.079.05141
6/19/1317:13:1967.060.05211
6/20/1318:13:1969.073.019712
6/21/1319:13:1968.055.032315
6/22/1320:13:1965.067.061119
6/23/1321:13:1966.055.0193010
6/24/1322:13:1968.079.0999
6/25/1323:13:1967.075.019910
6/26/130:43:5167.080.051115
6/27/131:43:5166.078.011298
6/28/132:43:5167.073.01216
6/29/133:43:5167.069.02092
6/30/134:43:5168.065.0182010
6/1/135:43:5166.062.06218
6/2/136:43:5169.058.015116
6/3/137:43:5165.064.081810
6/4/138:43:5168.066.0172020
6/5/139:43:5168.070.0844
6/6/1310:43:5165.060.0102719
6/7/1311:43:5165.070.0142811
6/8/1312:43:5165.074.06236
6/9/1313:43:5168.069.013120
6/10/1314:43:5167.056.0121719
6/11/1315:43:5166.080.011612
6/12/1316:43:5167.071.017720
6/13/1317:43:5168.062.01328
6/14/1318:43:5166.073.04182
6/15/1319:43:5169.060.010310
6/16/1320:43:5167.077.01333
6/17/1321:43:5170.073.06303
6/18/1322:43:5169.061.014304
6/19/1323:43:5167.058.01303
6/20/130:13:2065.079.014285
6/21/131:13:2069.063.018288
6/22/132:13:2069.074.018716
6/23/133:13:2069.056.08314
6/24/134:13:2065.068.010168
6/25/135:13:2066.075.011510
6/26/136:13:2065.067.081814
6/27/137:13:2070.078.015292
6/28/138:13:2069.070.061310
6/29/139:13:2068.073.06289
6/30/1310:13:2067.062.05109
6/1/1311:13:2068.057.0476
6/2/1312:13:2070.059.04247
6/3/1313:13:2068.064.04187
6/4/1314:13:2070.077.01123
6/5/1315:13:2068.055.019165
6/6/1316:13:2067.062.062614
6/7/1317:13:2066.061.010520
6/8/1318:13:2065.073.081416
6/9/1319:13:2067.059.016414
6/10/1320:13:2068.076.011302
6/11/1321:13:2067.073.019618
6/12/1322:13:2066.062.04262
6/13/1323:13:2065.068.07192
6/14/130:33:0769.055.012314
6/15/131:33:0765.079.08255
6/16/132:33:0767.076.0122
6/17/133:33:0770.060.03511
6/18/134:33:0765.068.0943
6/19/135:33:0768.061.052518
6/20/136:33:0766.064.06308
6/21/137:33:0770.067.04811
6/22/138:33:0766.076.09116
6/23/139:33:0769.063.016316
6/24/1310:33:0770.065.019205
6/25/1311:33:0770.069.052719
6/26/1312:33:0769.071.072013
6/27/1313:33:0766.066.052718
6/28/1314:33:0770.078.0242
6/29/1315:33:0770.068.05716
6/30/1316:33:0765.065.0203014
6/1/1317:33:0769.069.0133
6/2/1318:33:0768.056.08262
6/3/1319:33:0765.066.01619
6/4/1320:33:0769.057.0191818
6/5/1321:33:0765.066.01107
6/6/1322:33:0767.056.01516
6/7/1323:33:0767.076.015175
6/8/130:00:0165.079.018224
6/9/131:00:0170.080.010266
6/10/132:00:0169.070.016916
6/11/133:00:0165.064.016516
6/12/134:00:0169.061.062012
6/13/135:00:0168.068.012237
6/14/136:00:0166.056.015119
6/15/137:00:0168.063.09246
6/16/138:00:0167.056.0101112
6/17/139:00:0169.066.0583
6/18/1310:00:0165.068.013191
6/19/1311:00:0170.063.011288
6/20/1312:00:0166.079.01783
6/21/1313:00:0165.080.061617
6/22/1314:00:0166.071.06137
6/23/1315:00:0167.071.0102318
6/24/1316:00:0166.074.0113013
6/25/1317:00:0166.063.042620
6/26/1318:00:0165.057.020182
6/27/1319:00:0167.056.0172718
6/28/1320:00:0166.062.012315
6/29/1321:00:0168.067.01379
6/30/1322:00:0165.065.011131
6/1/1323:00:0167.080.0181414
6/2/130:13:1966.076.04164
6/3/131:13:1969.070.07241
6/4/132:13:1970.068.020815
6/5/133:13:1967.077.041019
6/6/134:13:1967.058.061318
6/7/135:13:1970.060.05302
6/8/136:13:1967.064.092016
6/9/137:13:1967.065.02718
6/10/138:13:1970.063.03284
6/11/139:13:1968.073.051813
6/12/1310:13:1968.065.019149
6/13/1311:13:1966.063.082610
6/14/1312:13:1970.076.01992
6/15/1313:13:1965.068.08226
6/16/1314:13:1965.077.06197
6/17/1315:13:1967.079.01399
6/18/1316:13:1965.056.01194
6/19/1317:13:1969.067.03291
6/20/1318:13:1966.057.016513
6/21/1319:13:1966.075.0132410
6/22/1320:13:1969.077.02153
6/23/1321:13:1968.076.01056
6/24/1322:13:1965.062.0201219
6/25/1323:13:1966.073.042218
6/26/130:43:5170.066.0152811
6/27/131:43:5165.079.0172115
6/28/132:43:5168.067.0161812
6/29/133:43:5166.073.032220
6/30/134:43:5166.074.01518
6/1/135:43:5167.058.07711
6/2/136:43:5166.065.0201415
6/3/137:43:5167.076.0173016
6/4/138:43:5169.066.061318
6/5/139:43:5168.078.0201718
6/6/1310:43:5168.074.01525
6/7/1311:43:5167.076.0201310
6/8/1312:43:5168.065.020196
6/9/1313:43:5169.073.0131111
6/10/1314:43:5168.078.03311
6/11/1315:43:5166.065.08245
6/12/1316:43:5169.067.06216
6/13/1317:43:5169.062.031516
6/14/1318:43:5166.071.0192016
6/15/1319:43:5166.066.01163
6/16/1320:43:5169.077.02311
6/17/1321:43:5167.080.010137
6/18/1322:43:5170.073.03169
6/19/1323:43:5165.060.0321
6/20/130:13:2068.063.011184
6/21/131:13:2065.071.012711
6/22/132:13:2070.059.0131820
6/23/133:13:2067.069.015284
6/24/134:13:2070.071.01211
6/25/135:13:2067.073.011279
6/26/136:13:2069.075.07182
6/27/137:13:2068.065.014102
6/28/138:13:2068.078.04125
6/29/139:13:2066.071.018211
6/30/1310:13:2068.061.0684
6/1/1311:13:2070.058.04510
6/2/1312:13:2066.073.062912
6/3/1313:13:2065.070.03174
6/4/1314:13:2070.076.012304
6/5/1315:13:2066.056.01098
6/6/1316:13:2066.075.08911
6/7/1317:13:2069.076.010112
6/8/1318:13:2065.066.05120
6/9/1319:13:2065.072.01367
6/10/1320:13:2069.075.017418
6/11/1321:13:2065.072.042619
6/12/1322:13:2065.080.016312
6/13/1323:13:2070.063.01646
6/14/130:33:0766.077.014262
6/15/131:33:0768.066.041320
6/16/132:33:0769.059.0102311
6/17/133:33:0770.059.011302
6/18/134:33:0769.075.014283
6/19/135:33:0765.080.018262
6/20/136:33:0768.068.012136
6/21/137:33:0768.059.012919
6/22/138:33:0770.055.0112410
6/23/139:33:0767.068.019417
6/24/1310:33:0765.064.0151117
6/25/1311:33:0768.061.011120
6/26/1312:33:0766.071.091910
6/27/1313:33:0769.059.015514
6/28/1314:33:0766.080.032813
6/29/1315:33:0767.076.016320
6/30/1316:33:0770.061.0152717
6/1/1317:33:0766.077.0581
6/2/1318:33:0768.072.0152411
6/3/1319:33:0766.055.07131
6/4/1320:33:0769.065.011244
6/5/1321:33:0766.060.017236
6/6/1322:33:0768.065.02227
6/7/1323:33:0770.077.01447
6/8/130:00:0170.065.016219
6/9/131:00:0165.057.01724
6/10/132:00:0166.055.071418
6/11/133:00:0169.056.08273
6/12/134:00:0167.055.02611
6/13/135:00:0166.063.032911
6/14/136:00:0167.066.0162612
6/15/137:00:0168.075.0182318
6/16/138:00:0166.060.04228
6/17/139:00:0166.080.08211
6/18/1310:00:0170.068.014254
6/19/1311:00:0168.074.018199
6/20/1312:00:0167.066.01617
6/21/1313:00:0168.066.0122816
6/22/1314:00:0168.068.0192813
6/23/1315:00:0168.075.011224
6/24/1316:00:0168.069.01444
6/25/1317:00:0170.075.02144
6/26/1318:00:0166.066.020138
6/27/1319:00:0170.058.061510
6/28/1320:00:0165.056.011114
6/29/1321:00:0169.058.0352
6/30/1322:00:0167.072.0783
6/1/1323:00:0170.060.0202515
6/2/130:13:1969.061.04613
6/3/131:13:1968.072.0122410
6/4/132:13:1965.063.01343
6/5/133:13:1965.060.06817
6/6/134:13:1969.078.011213
6/7/135:13:1969.073.0534
6/8/136:13:1969.060.04813
6/9/137:13:1969.077.020111
6/10/138:13:1965.062.018233
6/11/139:13:1967.062.0131712
6/12/1310:13:1966.058.01918
6/13/1311:13:1965.079.0172519
6/14/1312:13:1969.075.0112218
6/15/1313:13:1969.060.017131
6/16/1314:13:1967.074.020205
6/17/1315:13:1970.070.018309
6/18/1316:13:1967.069.082813
6/19/1317:13:1969.069.06111
6/20/1318:13:1968.067.071216
6/21/1319:13:1969.064.062914
6/22/1320:13:1970.058.01654
6/23/1321:13:1965.067.041116
6/24/1322:13:1965.064.03279
6/25/1323:13:1970.074.0728
6/26/130:43:5170.078.0101618
6/27/131:43:5165.063.0111710
6/28/132:43:5165.057.012620
6/29/133:43:5169.070.01242
6/30/134:43:5165.074.014267
6/1/135:43:5168.056.016286
6/2/136:43:5169.068.04196
6/3/137:43:5166.072.03131
6/4/138:43:5168.066.05511
6/5/139:43:5166.055.011813
6/6/1310:43:5167.056.05214
6/7/1311:43:5165.056.071720
6/8/1312:43:5167.059.06316
6/9/1313:43:5170.061.081110
6/10/1314:43:5168.063.031220
6/11/1315:43:5168.068.061712
6/12/1316:43:5166.069.01636
6/13/1317:43:5169.074.01671
6/14/1318:43:5166.068.07512
6/15/1319:43:5170.061.019157
6/16/1320:43:5166.077.022316
6/17/1321:43:5170.059.0193012
6/18/1322:43:5168.068.017276
6/19/1323:43:5170.074.03912
6/20/130:13:2070.077.051110
6/21/131:13:2066.063.04172
6/22/132:13:2066.075.011198
6/23/133:13:2070.074.0141
6/24/134:13:2069.057.0191014
6/25/135:13:2070.072.03228
6/26/136:13:2066.075.081218
6/27/137:13:2067.069.0141116
6/28/138:13:2067.076.01376
6/29/139:13:2069.059.042118
6/30/1310:13:2065.066.01657
6/1/1311:13:2068.062.021419
6/2/1312:13:2067.069.08318
6/3/1313:13:2068.078.05417
6/4/1314:13:2069.080.0111910
6/5/1315:13:2068.059.018166
6/6/1316:13:2068.060.02515
6/7/1317:13:2065.066.019246
6/8/1318:13:2070.057.05235
6/9/1319:13:2066.073.02278
6/10/1320:13:2069.067.0637
%sql

select BuildingId, Date, (ActualTemp-TargetTemp) AS TempDIFF from tempSeries order by BuildingId 
BuildingIdDateTempDIFF
16/29/13-5.0
16/27/1310.0
16/18/13-7.0
16/22/13-12.0
16/23/132.0
16/10/134.0
16/3/13-6.0
16/4/13-7.0
16/28/137.0
16/10/134.0
16/17/13-4.0
16/27/13-9.0
16/2/1310.0
16/30/138.0
16/3/13-5.0
16/2/13-6.0
16/13/1312.0
16/10/13-4.0
16/20/1311.0
16/15/13-4.0
16/15/13-3.0
16/14/1311.0
16/30/13-10.0
16/11/13-9.0
16/12/13-2.0
16/17/13-12.0
16/18/13-5.0
16/23/139.0
16/16/131.0
16/9/137.0
16/25/13-9.0
16/27/13-1.0
16/16/130.0
16/26/132.0
16/8/1312.0
16/27/13-8.0
16/21/13-7.0
16/2/13-9.0
16/5/137.0
16/3/1314.0
16/6/134.0
16/16/130.0
16/20/13-11.0
16/30/13-6.0
16/20/13-1.0
16/1/13-10.0
16/9/134.0
16/24/13-8.0
16/18/13-3.0
16/2/13-4.0
16/21/131.0
16/3/137.0
16/18/132.0
16/23/1310.0
16/18/131.0
16/14/13-2.0
16/16/131.0
16/29/13-8.0
16/2/13-12.0
16/1/13-12.0
16/7/132.0
16/16/132.0
16/30/13-2.0
16/17/13-12.0
16/26/13-12.0
16/16/13-12.0
16/5/1314.0
16/24/13-10.0
16/24/13-3.0
16/2/13-5.0
16/25/13-1.0
16/24/132.0
16/14/139.0
16/19/131.0
16/26/13-4.0
16/18/1313.0
16/15/13-4.0
16/24/1312.0
16/8/13-7.0
16/28/136.0
16/6/131.0
16/5/13-14.0
16/24/1313.0
16/22/13-1.0
16/18/134.0
16/17/13-4.0
16/1/134.0
16/1/1311.0
16/18/130.0
16/7/132.0
16/19/13-7.0
16/28/1311.0
16/20/13-12.0
16/27/13-2.0
16/8/13-7.0
16/1/134.0
16/8/1310.0
16/8/132.0
16/13/13-1.0
16/17/13-13.0
16/23/138.0
16/6/13-11.0
16/23/13-4.0
16/18/133.0
16/16/131.0
16/6/13-1.0
16/6/13-6.0
16/9/13-9.0
16/14/134.0
16/26/13-4.0
16/12/133.0
16/27/134.0
16/5/137.0
16/27/13-3.0
16/1/130.0
16/19/136.0
16/30/130.0
16/6/13-6.0
16/29/130.0
16/24/13-8.0
16/23/13-5.0
16/6/132.0
16/7/13-4.0
16/11/13-8.0
16/9/132.0
16/1/131.0
16/16/13-4.0
16/1/135.0
16/7/1314.0
16/3/131.0
16/21/13-10.0
16/28/136.0
16/3/13-8.0
16/1/131.0
16/11/137.0
16/20/13-11.0
16/24/134.0
16/14/13-4.0
16/14/13-9.0
16/17/137.0
16/27/13-5.0
16/19/13-2.0
16/25/137.0
16/4/13-5.0
16/24/13-5.0
16/13/13-2.0
16/3/13-4.0
16/22/135.0
16/22/13-7.0
16/21/139.0
16/26/1311.0
16/19/13-5.0
16/16/1311.0
16/14/133.0
16/7/133.0
16/25/13-7.0
16/3/132.0
16/8/13-10.0
16/13/13-4.0
16/11/13-7.0
16/30/13-10.0
16/24/13-2.0
16/29/135.0
16/17/1313.0
16/28/1314.0
16/11/13-4.0
16/24/13-10.0
16/22/132.0
16/28/13-1.0
16/2/13-10.0
16/1/1311.0
16/19/13-11.0
16/4/13-9.0
16/13/13-6.0
16/24/13-1.0
16/23/13-3.0
16/30/131.0
16/6/13-10.0
16/3/13-11.0
16/4/13-2.0
16/7/13-13.0
16/13/139.0
16/8/13-11.0
16/27/13-7.0
16/13/138.0
16/17/1314.0
16/11/136.0
16/22/136.0
16/20/1312.0
16/22/13-2.0
16/7/13-11.0
16/12/1313.0
16/12/132.0
16/29/13-10.0
16/6/13-8.0
16/9/138.0
16/13/13-8.0
16/9/1312.0
16/17/13-10.0
16/24/13-13.0
16/11/136.0
16/25/1311.0
16/21/130.0
16/5/13-5.0
16/3/1310.0
16/24/1315.0
16/18/13-5.0
16/12/13-1.0
16/15/13-9.0
16/16/13-8.0
16/19/134.0
16/15/13-3.0
16/14/13-6.0
16/24/13-3.0
16/22/13-6.0
16/28/13-3.0
16/1/13-5.0
16/11/1312.0
16/6/13-12.0
16/15/1313.0
16/28/131.0
16/26/13-11.0
16/3/136.0
16/8/133.0
16/14/13-3.0
16/9/133.0
16/18/139.0
16/21/13-11.0
16/12/1312.0
16/10/133.0
16/11/13-7.0
16/9/13-1.0
16/22/1310.0
16/4/136.0
16/5/1310.0
16/13/135.0
16/28/13-13.0
16/10/131.0
16/27/134.0
16/24/13-8.0
16/11/13-9.0
16/11/13-9.0
16/5/1310.0
16/7/13-4.0
16/2/13-1.0
16/1/13-6.0
16/29/134.0
16/7/1311.0
16/29/139.0
16/10/13-3.0
16/19/13-7.0
16/20/1314.0
16/20/131.0
16/13/130.0
16/25/133.0
16/9/13-4.0
16/23/134.0
16/20/13-4.0
16/29/13-1.0
16/27/139.0
16/1/134.0
16/10/131.0
16/5/13-7.0
16/13/131.0
16/6/13-12.0
16/30/1315.0
16/1/13-12.0
16/24/13-9.0
16/19/13-4.0
16/8/13-6.0
16/27/133.0
16/7/134.0
16/15/13-1.0
16/20/139.0
16/11/138.0
16/28/13-2.0
16/17/137.0
16/26/134.0
16/5/131.0
16/27/1310.0
16/30/13-8.0
16/24/138.0
16/18/1310.0
16/2/13-11.0
16/28/13-6.0
16/28/13-4.0
16/25/13-6.0
16/20/134.0
16/17/131.0
16/24/1310.0
16/11/138.0
16/5/138.0
16/4/13-1.0
16/29/137.0
16/19/13-1.0
16/17/13-6.0
16/27/13-8.0
16/12/13-2.0
16/4/13-12.0
16/21/136.0
16/15/13-10.0
16/25/136.0
16/30/134.0
16/25/13-5.0
16/11/13-2.0
16/8/136.0
16/2/13-7.0
16/19/138.0
16/26/13-10.0
16/6/13-9.0
16/9/135.0
16/19/13-11.0
16/1/13-4.0
16/27/136.0
16/11/13-2.0
16/23/136.0
16/8/1310.0
16/25/1310.0
16/18/135.0
16/13/131.0
16/16/132.0
16/15/134.0
16/25/136.0
16/25/13-12.0
16/24/13-5.0
16/7/13-3.0
16/18/136.0
16/24/130.0
16/24/137.0
16/16/13-10.0
16/1/13-3.0
16/14/13-2.0
16/30/13-9.0
16/17/137.0
16/16/13-2.0
16/8/132.0
16/25/13-6.0
16/24/134.0
16/5/134.0
16/15/130.0
16/7/132.0
16/13/1315.0
16/18/130.0
16/30/13-9.0
16/11/13-10.0
16/21/137.0
16/19/130.0
16/7/13-4.0
16/7/134.0
16/17/134.0
16/24/13-3.0
16/29/1311.0
16/25/139.0
16/13/1310.0
16/30/131.0
16/25/13-11.0
16/26/131.0
16/30/13-6.0
16/2/13-1.0
16/10/138.0
16/29/13-7.0
16/21/13-3.0
16/21/132.0
16/26/13-3.0
16/22/13-11.0
16/8/1312.0
16/16/1310.0
16/6/1311.0
16/2/132.0
16/25/13-8.0
16/30/13-1.0
16/23/137.0
16/6/13-8.0
16/21/137.0
16/9/13-12.0
16/23/13-9.0
16/24/1313.0
16/2/13-13.0
16/27/1311.0
16/12/137.0
16/13/1313.0
16/7/1315.0
16/15/130.0
16/1/133.0
16/21/1310.0
16/22/1311.0
16/13/13-8.0
16/14/13-5.0
16/10/13-3.0
16/29/130.0
16/11/134.0
16/18/13-6.0
16/29/132.0
106/17/13-6.0
106/8/1313.0
106/3/13-6.0
106/17/134.0
106/16/138.0
106/10/13-12.0
106/29/132.0
106/11/13-6.0
106/8/1310.0
106/29/13-2.0
106/30/139.0
106/6/137.0
106/5/135.0
106/13/13-2.0
106/21/13-2.0
106/13/1314.0
106/4/138.0
106/6/13-5.0
106/15/13-7.0
106/25/132.0
106/12/1311.0
106/30/130.0
106/19/134.0
106/12/137.0
106/8/133.0
106/24/130.0
106/27/137.0
106/10/1310.0
106/20/13-7.0
106/15/133.0
106/7/137.0
106/17/133.0
106/14/13-4.0
106/14/13-8.0
106/30/136.0
106/11/13-10.0
106/3/1313.0
106/22/13-7.0
106/21/139.0
106/9/13-3.0
106/24/138.0
106/13/13-13.0
106/13/13-11.0
106/15/13-3.0
106/11/13-10.0
106/22/131.0
106/18/138.0
106/10/1311.0
106/15/139.0
106/2/13-10.0
106/20/1311.0
106/14/13-3.0
106/12/13-11.0
106/1/1312.0
106/2/13-6.0
106/18/133.0
106/27/130.0
106/17/134.0
106/21/13-1.0
106/21/132.0
106/25/1312.0
106/11/13-11.0
106/22/130.0
106/10/1311.0
106/19/13-10.0
106/15/13-9.0
106/15/13-8.0
106/16/13-1.0
106/1/13-6.0
106/9/13-3.0
106/2/13-2.0
106/9/13-9.0
106/29/131.0
106/27/138.0
106/19/13-5.0
106/25/133.0
106/19/13-4.0
106/24/13-5.0
106/24/13-1.0
106/1/1311.0
106/20/133.0
106/15/13-5.0
106/10/13-12.0
106/15/135.0
106/9/13-4.0
106/1/133.0
106/28/13-9.0
106/11/13-4.0
106/16/1310.0
106/29/136.0
106/17/13-4.0
106/8/13-9.0
106/23/13-7.0
106/14/130.0
106/14/134.0
106/14/1314.0
106/14/132.0
106/22/13-5.0
106/19/1311.0
106/15/131.0
106/19/139.0
106/4/13-3.0
106/7/13-3.0
106/12/133.0
106/3/135.0
106/7/13-4.0
106/25/13-12.0
106/6/13-9.0
106/19/13-10.0
106/12/137.0
106/16/137.0
106/16/1310.0
106/24/131.0
106/19/13-14.0
106/24/139.0
106/16/13-1.0
106/4/13-3.0
106/30/139.0
106/4/139.0
106/3/132.0
106/2/131.0
106/8/134.0
106/24/134.0
106/11/1310.0
106/15/138.0
106/27/132.0
106/28/13-5.0
106/8/1310.0
106/16/1314.0
106/25/13-13.0
106/24/13-4.0
106/8/13-14.0
106/27/13-12.0
106/4/1311.0
106/12/133.0
106/10/135.0
106/20/133.0
106/9/132.0
106/23/13-1.0
106/22/133.0
106/26/13-3.0
106/29/13-5.0
106/9/13-8.0
106/25/134.0
106/16/135.0
106/26/13-8.0
106/25/13-6.0
106/11/132.0
106/26/13-12.0
106/5/13-10.0
106/14/13-5.0
106/4/13-11.0
106/29/13-6.0
106/21/1311.0
106/16/1312.0
106/13/138.0
106/6/134.0
106/26/137.0
106/1/13-13.0
106/28/13-4.0
106/21/134.0
106/30/1313.0
106/1/13-2.0
106/14/1314.0
106/26/13-8.0
106/23/13-3.0
106/25/13-11.0
106/6/137.0
106/21/13-2.0
106/11/1313.0
106/13/139.0
106/6/135.0
106/21/13-3.0
106/10/13-9.0
106/14/13-1.0
106/17/13-4.0
106/21/132.0
106/10/136.0
106/18/13-6.0
106/28/130.0
106/29/13-3.0
106/13/138.0
106/8/13-8.0
106/19/136.0
106/21/13-7.0
106/18/13-10.0
106/24/13-13.0
106/1/133.0
106/16/13-1.0
106/4/13-13.0
106/18/13-4.0
106/7/138.0
106/4/133.0
106/30/138.0
106/19/13-6.0
106/6/13-2.0
106/5/13-3.0
106/4/132.0
106/24/1313.0
106/13/13-4.0
106/10/13-10.0
106/4/13-12.0
106/11/1310.0
106/30/13-1.0
106/7/135.0
106/11/13-1.0
106/14/13-5.0
106/4/13-2.0
106/8/13-5.0
106/16/1314.0
106/20/135.0
106/8/1312.0
106/11/1310.0
106/4/138.0
106/8/139.0
106/20/1310.0
106/10/13-7.0
106/23/13-6.0
106/6/132.0
106/22/139.0
106/2/1312.0
106/20/130.0
106/21/13-3.0
106/15/131.0
106/10/138.0
106/24/139.0
106/11/13-2.0
106/27/134.0
106/14/131.0
106/9/13-9.0
106/25/136.0
106/8/138.0
106/16/1311.0
106/12/13-2.0
106/3/13-1.0
106/8/1312.0
106/20/13-6.0
106/6/1310.0
106/23/136.0
106/29/133.0
106/19/135.0
106/25/13-10.0
106/2/13-5.0
106/11/13-5.0
106/19/13-3.0
106/5/135.0
106/3/1311.0
106/20/139.0
106/24/13-6.0
106/3/130.0
106/27/135.0
106/8/1312.0
106/9/13-6.0
106/1/13-9.0
106/23/13-9.0
106/30/13-11.0
106/2/13-7.0
106/15/13-11.0
106/20/134.0
106/24/13-4.0
106/6/1312.0
106/18/13-11.0
106/14/136.0
106/8/13-3.0
106/17/13-7.0
106/17/134.0
106/11/13-10.0
106/25/13-11.0
106/27/139.0
106/22/136.0
106/25/139.0
106/12/13-11.0
106/21/13-8.0
106/11/134.0
106/12/13-11.0
106/21/13-13.0
106/28/13-3.0
106/8/13-2.0
106/14/1313.0
106/17/13-7.0
106/23/1312.0
106/23/13-11.0
106/3/13-1.0
106/11/131.0
106/5/1314.0
106/30/13-3.0
106/17/133.0
106/3/13-6.0
106/25/139.0
106/28/131.0
106/13/13-10.0
106/24/137.0
106/25/13-1.0
106/17/13-9.0
106/22/13-15.0
106/26/135.0
106/3/134.0
106/27/13-2.0
106/9/13-9.0
106/20/137.0
106/3/13-11.0
106/3/13-8.0
106/22/134.0
106/9/13-1.0
106/9/13-7.0
106/13/13-3.0
106/4/13-6.0
106/15/13-2.0
106/28/13-5.0
106/24/13-10.0
106/18/132.0
106/23/132.0
106/19/13-4.0
106/30/131.0
106/27/13-4.0
106/12/13-5.0
106/20/13-8.0
106/10/13-2.0
106/26/1315.0
106/27/130.0
106/29/131.0
106/16/136.0
106/20/135.0
106/2/1310.0
106/27/13-13.0
106/2/13-6.0
106/16/13-2.0
106/21/1315.0
106/27/13-7.0
106/2/13-4.0
106/2/1311.0
106/15/13-3.0
106/3/13-1.0
106/19/139.0
106/10/13-8.0
106/24/13-11.0
106/26/138.0
106/19/13-12.0
106/11/139.0
106/5/13-14.0
106/14/13-12.0
106/11/132.0
106/20/131.0
106/11/13-3.0
106/21/1310.0
106/8/137.0
106/13/13-11.0
106/17/13-8.0
106/18/136.0
106/4/1313.0
106/1/13-5.0
106/27/13-5.0
106/16/133.0
106/2/137.0
106/4/13-2.0
106/13/13-9.0
106/13/13-7.0
106/1/13-7.0
106/2/13-5.0
106/10/130.0
106/22/139.0
106/18/133.0
106/24/137.0
106/26/139.0
106/12/137.0
106/21/131.0
106/14/1310.0
106/1/13-8.0
106/16/131.0
106/12/137.0
106/19/13-8.0
106/29/1311.0
106/21/13-14.0
106/3/1310.0
106/13/13-5.0
106/21/13-3.0
106/23/139.0
106/1/138.0
106/2/13-10.0
106/6/139.0
106/24/132.0
106/6/139.0
106/17/130.0
106/10/1310.0
106/5/138.0
106/4/13-9.0
106/26/13-9.0
106/17/13-11.0
106/12/13-3.0
106/19/13-11.0
106/4/132.0
106/30/134.0
106/21/1311.0
106/19/13-12.0
106/8/13-2.0
106/30/13-11.0
106/1/13-2.0
106/7/131.0
106/9/13-14.0
106/4/13-6.0
106/27/13-1.0
106/22/1314.0
106/27/132.0
106/13/13-4.0
106/14/13-5.0
106/5/13-6.0
106/26/13-5.0
106/2/13-7.0
106/10/13-11.0
106/7/134.0
106/14/13-5.0
106/12/1315.0
106/4/13-13.0
106/25/138.0
106/15/13-9.0
106/4/13-6.0
106/8/1315.0
106/29/137.0
106/5/1311.0
106/13/13-3.0
106/21/139.0
106/1/13-12.0
106/7/138.0
106/4/13-4.0
106/7/139.0
116/24/131.0
116/21/13-11.0
116/10/135.0
116/1/138.0
116/11/134.0
116/18/1312.0
116/24/139.0
116/24/13-4.0
116/13/13-5.0
116/22/139.0
116/26/133.0
116/13/136.0
116/4/130.0
116/25/13-4.0
116/18/13-14.0
116/6/13-13.0
116/8/137.0
116/1/13-7.0
116/23/13-5.0
116/30/13-6.0
116/27/13-6.0
116/27/13-4.0
116/22/13-4.0
116/16/13-9.0
116/17/1311.0
116/21/138.0
116/24/13-11.0
116/28/13-12.0
116/15/13-3.0
116/1/138.0
116/6/139.0
116/3/13-4.0
116/9/137.0
116/6/13-9.0
116/5/1310.0
116/13/138.0
116/5/13-5.0
116/14/133.0
116/6/139.0
116/8/13-4.0
116/23/13-1.0
116/3/13-7.0
116/2/1312.0
116/3/131.0
116/10/132.0
116/30/13-9.0
116/25/1310.0
116/16/13-3.0
116/28/1314.0
116/19/137.0
116/15/13-5.0
116/15/136.0
116/16/1311.0
116/27/132.0
116/30/13-8.0
116/20/13-8.0
116/28/13-6.0
116/20/13-10.0
116/14/136.0
116/28/13-6.0
116/7/1312.0
116/16/13-9.0
116/15/13-1.0
116/26/13-4.0
116/9/134.0
116/24/131.0
116/12/13-12.0
116/9/1311.0
116/28/139.0
116/16/139.0
116/28/131.0
116/24/13-13.0
116/18/131.0
116/5/13-14.0
116/30/13-9.0
116/4/13-4.0
116/15/13-6.0
116/17/13-11.0
116/4/1310.0
116/1/13-13.0
116/8/13-5.0
116/1/13-2.0
116/26/13-9.0
116/9/1310.0
116/4/131.0
116/6/13-3.0
116/12/139.0
116/6/13-6.0
116/3/131.0
116/8/1310.0
116/1/135.0
116/11/13-7.0
116/2/13-5.0
116/25/136.0
116/16/13-9.0
116/12/13-1.0
116/15/13-12.0
116/7/133.0
116/13/132.0
116/17/13-10.0
116/10/131.0
116/10/1310.0
116/12/13-3.0
116/16/13-10.0
116/13/13-3.0
116/19/130.0
116/8/13-11.0
116/3/135.0
116/6/131.0
116/20/130.0
116/3/13-6.0
116/1/13-4.0
116/4/134.0
116/29/13-1.0
116/20/13-14.0
116/16/13-9.0
116/18/13-6.0
116/13/137.0
116/24/13-3.0
116/1/130.0
116/19/136.0
116/11/13-11.0
116/22/13-7.0
116/16/13-9.0
116/23/134.0
116/29/1310.0
116/30/13-8.0
116/8/1310.0
116/6/13-4.0
116/5/130.0
116/29/13-9.0
116/2/139.0
116/7/13-2.0
116/3/13-2.0
116/17/133.0
116/5/134.0
116/15/1311.0
116/6/13-1.0
116/17/139.0
116/18/131.0
116/11/137.0
116/24/130.0
116/11/13-2.0
116/18/13-11.0
116/29/13-5.0
116/28/133.0
116/21/13-3.0
116/2/130.0
116/2/132.0
116/7/133.0
116/16/138.0
116/21/136.0
116/2/134.0
116/4/13-2.0
116/16/13-10.0
116/15/131.0
116/25/13-6.0
116/9/137.0
116/25/135.0
116/18/13-5.0
116/29/132.0
116/22/13-5.0
116/23/13-9.0
116/23/136.0
116/9/131.0
116/22/13-12.0
116/8/133.0
116/7/13-14.0
116/18/136.0
116/9/135.0
116/4/13-8.0
116/17/13-1.0
116/26/13-11.0
116/24/13-8.0
116/26/138.0
116/13/13-12.0
116/7/135.0
116/17/131.0
116/1/13-9.0
116/26/132.0
116/25/13-12.0
116/16/13-4.0
%sql 

select a.BuildingId, count(a.TempDIFF) from (
    select BuildingId, (ActualTemp-TargetTemp) as TempDIFF from tempSeries LIMIT 1000) a
    WHERE a.TempDIFF > 0 GROUP BY BuildingId 
BuildingId_c1
821
937
1918
1717
1825
1413
1321
1630
2020
1519
1021
1223
1124
125
326
235
522
424
724
623
%pyspark

#You must now load the data (hvac.csv), parse it, and use it to train the model. For this, you define a function that checks whether the actual temperature of the building is greater than the target temperature. If the actual temperature is greater, the building is hot, denoted by the value 1.0. If the actual temperature is lesser, the building is cold, denoted by the value 0.0.

# List the structure of data for better understanding. Because the data will be
# loaded as an array, this structure makes it easy to understand what each element
# in the array corresponds to

# 0 Date
# 1 Time
# 2 TargetTemp
# 3 ActualTemp
# 4 System
# 5 SystemAge
# 6 BuildingID


from pyspark.ml import Pipeline
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.feature import HashingTF, Tokenizer
from pyspark.sql import Row, SQLContext

import os
import sys
from pyspark import SparkConf
from pyspark import SparkContext
from pyspark.sql import SQLContext
from pyspark.sql.types import *

from pyspark.mllib.classification import LogisticRegressionWithSGD
from pyspark.mllib.regression import LabeledPoint
from numpy import array

LabeledDocument = Row("BuildingID", "SystemInfo", "label")

# Define a function that parses the raw CSV file and returns an object of type LabeledDocument

def parseDocument(line):
    values = [str(x) for x in line.split(',')]
    if (values[3] > values[2]):
        hot = 1.0
    else:
        hot = 0.0        

    textValue = str(values[4]) + " " + str(values[5])

    return LabeledDocument((values[6]), textValue, hot)

# Load the raw HVAC.csv file, parse it using the function
data = sc.textFile("hdfs:///user/zeppelin/SensorDemo/HVAC.csv")

documents = data.filter(lambda s: "Date" not in s).map(parseDocument)
training = documents.toDF()
%pyspark

#Prepare a data set to run the trained model against. To do so, we would pass on a system ID and system age (denoted as SystemInfo in the training output), and the model would predict whether the building with that system ID and system age would be hotter (denoted by 1.0) or cooler (denoted by 0.0).

tokenizer = Tokenizer(inputCol="SystemInfo", outputCol="words")
hashingTF = HashingTF(inputCol=tokenizer.getOutputCol(), outputCol="features")
lr = LogisticRegression(maxIter=10, regParam=0.01)
pipeline = Pipeline(stages=[tokenizer, hashingTF, lr])
%pyspark

model = pipeline.fit(training)
#training.show()
training.registerTempTable("eventStaging")
%sql

select * from eventStaging
BuildingIDSystemInfolabel
413 200.0
173 200.0
1817 201.0
152 230.0
316 91.0
413 280.0
212 240.0
1620 261.0
916 91.0
126 50.0
1510 171.0
72 110.0
1514 21.0
63 20.0
2019 220.0
819 110.0
615 70.0
1312 50.0
48 220.0
717 50.0
177 51.0
96 291.0
206 180.0
615 130.0
1819 141.0
81 61.0
1416 140.0
158 180.0
137 61.0
57 130.0
311 150.0
1814 10.0
1114 180.0
91 51.0
105 51.0
1916 81.0
217 301.0
104 131.0
22 171.0
615 171.0
316 241.0
218 250.0
12 141.0
59 221.0
49 60.0
919 201.0
22 41.0
121 131.0
511 90.0
27 300.0
1416 280.0
93 40.0
62 120.0
2015 300.0
1711 130.0
1813 221.0
715 280.0
24 240.0
917 250.0
68 170.0
76 151.0
1220 261.0
183 240.0
620 250.0
92 141.0
101 91.0
1513 291.0
1111 251.0
166 211.0
143 191.0
29 281.0
207 261.0
128 191.0
16 10.0
67 120.0
1211 160.0
1917 170.0
196 170.0
69 211.0
1613 141.0
141 80.0
315 201.0
195 220.0
219 240.0
2014 50.0
918 280.0
144 301.0
178 230.0
27 241.0
1217 90.0
127 210.0
134 11.0
618 201.0
154 210.0
718 191.0
513 30.0
118 81.0
916 241.0
916 231.0
1510 291.0
1118 181.0
617 61.0
79 111.0
1613 210.0
1010 200.0
137 81.0
164 250.0
131 90.0
107 50.0
32 150.0
38 170.0
116 91.0
167 10.0
176 281.0
1220 200.0
1911 120.0
95 41.0
144 211.0
66 120.0
210 90.0
75 80.0
163 101.0
154 131.0
713 281.0
32 260.0
1115 80.0
133 270.0
1917 61.0
412 171.0
172 80.0
411 290.0
714 60.0
619 160.0
26 261.0
67 41.0
1418 50.0
1216 40.0
110 250.0
1020 50.0
151 101.0
914 291.0
49 71.0
1717 240.0
1915 161.0
94 130.0
27 150.0
179 80.0
2020 270.0
2013 51.0
910 200.0
79 280.0
715 21.0
204 50.0
51 60.0
1920 151.0
188 201.0
420 100.0
177 180.0
75 91.0
172 10.0
319 290.0
120 90.0
41 181.0
73 250.0
18 180.0
520 270.0
114 161.0
120 301.0
216 100.0
1116 240.0
1616 251.0
1718 131.0
192 100.0
814 220.0
165 121.0
417 151.0
1720 190.0
112 250.0
63 190.0
202 270.0
39 120.0
195 211.0
1119 271.0
2015 161.0
1219 150.0
209 21.0
1818 251.0
2019 151.0
114 150.0
1015 161.0
98 21.0
516 20.0
91 91.0
1519 260.0
166 280.0
517 221.0
213 10.0
619 100.0
1019 181.0
142 100.0
1419 260.0
613 171.0
121 10.0
51 120.0
11 30.0
157 210.0
410 230.0
188 100.0
1212 81.0
81 70.0
89 51.0
1011 290.0
112 20.0
127 11.0
513 161.0
914 250.0
1711 191.0
93 110.0
820 181.0
2015 151.0
1917 110.0
173 120.0
412 280.0
216 211.0
1614 270.0
2014 101.0
1712 81.0
78 290.0
1913 90.0
16 141.0
26 10.0
98 30.0
94 261.0
16 190.0
614 121.0
208 210.0
154 141.0
319 291.0
1616 51.0
814 11.0
1714 60.0
35 191.0
127 211.0
142 61.0
1015 301.0
311 51.0
1718 11.0
1111 71.0
417 241.0
137 150.0
92 50.0
131 301.0
96 21.0
131 130.0
96 21.0
124 221.0
119 100.0
1318 171.0
22 270.0
56 41.0
92 11.0
1213 121.0
1915 171.0
22 221.0
1610 51.0
94 301.0
39 231.0
199 151.0
181 140.0
815 190.0
162 31.0
193 241.0
28 221.0
153 280.0
1112 101.0
107 31.0
132 151.0
120 191.0
17 10.0
1312 71.0
1816 260.0
1417 30.0
313 230.0
1414 140.0
310 230.0
1517 240.0
119 151.0
73 71.0
157 30.0
88 231.0
106 230.0
1915 300.0
112 241.0
1017 70.0
189 210.0
126 60.0
1711 10.0
162 260.0
156 140.0
106 50.0
812 251.0
173 31.0
46 171.0
514 170.0
59 300.0
18 41.0
167 261.0
152 161.0
1614 181.0
25 261.0
209 281.0
511 70.0
63 240.0
114 31.0
1411 21.0
24 231.0
918 200.0
186 201.0
206 21.0
614 50.0
58 61.0
1410 300.0
98 10.0
520 171.0
68 141.0
1220 90.0
107 131.0
1710 301.0
211 31.0
1214 260.0
111 301.0
919 210.0
113 21.0
1916 300.0
25 271.0
415 110.0
89 281.0
1914 41.0
181 151.0
125 91.0
811 61.0
412 131.0
117 80.0
514 210.0
310 291.0
193 201.0
109 40.0
88 70.0
138 190.0
1015 281.0
2014 120.0
18 70.0
182 20.0
163 60.0
320 21.0
1616 240.0
210 151.0
84 160.0
136 90.0
1612 141.0
1218 80.0
1320 260.0
1812 10.0
211 100.0
1120 141.0
1720 261.0
1416 251.0
172 171.0
418 190.0
143 161.0
153 281.0
58 221.0
138 51.0
114 300.0
176 130.0
96 141.0
1714 280.0
411 40.0
86 300.0
1914 101.0
82 221.0
171 120.0
313 21.0
517 141.0
1318 50.0
912 21.0
92 220.0
1515 261.0
1411 300.0
618 131.0
32 180.0
1513 121.0
89 300.0
312 130.0
1617 120.0
139 170.0
138 210.0
816 221.0
1918 70.0
1311 140.0
118 20.0
175 100.0
184 71.0
1410 250.0
1119 131.0
413 271.0
1115 190.0
101 160.0
13 200.0
819 160.0
818 61.0
1712 250.0
179 141.0
1015 270.0
122 70.0
1119 230.0
1219 230.0
78 51.0
1316 251.0
154 10.0
65 61.0
812 160.0
53 290.0
1016 210.0
315 161.0
18 200.0
1919 270.0
712 31.0
1814 130.0
166 20.0
147 100.0
158 221.0
1310 280.0
207 20.0
1617 210.0
618 241.0
19 291.0
171 290.0
615 90.0
133 270.0
1419 150.0
911 210.0
920 170.0
1611 170.0
913 40.0
96 51.0
46 290.0
138 60.0
69 281.0
143 111.0
113 100.0
919 110.0
1814 240.0
148 210.0
97 130.0
128 50.0
1219 181.0
1020 220.0
1317 261.0
187 80.0
413 221.0
192 150.0
1117 71.0
44 90.0
189 140.0
45 251.0
104 260.0
115 281.0
1011 140.0
29 141.0
1019 91.0
137 121.0
1916 290.0
917 191.0
1515 280.0
116 201.0
1117 70.0
613 190.0
1516 190.0
519 180.0
1920 90.0
163 200.0
167 260.0
54 101.0
513 51.0
1520 260.0
113 81.0
64 271.0
1713 150.0
58 290.0
29 211.0
417 221.0
134 151.0
37 131.0
511 180.0
207 170.0
205 251.0
78 81.0
108 200.0
199 281.0
510 60.0
122 50.0
316 31.0
113 281.0
119 11.0
216 201.0
2020 30.0
203 161.0
318 210.0
317 81.0
1912 60.0
41 80.0
166 221.0
516 231.0
1819 180.0
1419 270.0
219 180.0
132 21.0
168 141.0
1414 201.0
103 120.0
1212 130.0
43 290.0
513 300.0
912 151.0
138 221.0
1713 60.0
29 301.0
129 221.0
152 170.0
1519 131.0
213 291.0
205 31.0
166 51.0
179 70.0
520 141.0
1018 291.0
207 140.0
1610 221.0
104 110.0
92 271.0
514 160.0
207 20.0
1615 251.0
518 200.0
74 280.0
1718 210.0
1011 260.0
1015 150.0
175 91.0
199 220.0
1917 251.0
161 150.0
913 121.0
175 141.0
113 120.0
817 180.0
614 110.0
34 191.0
818 291.0
186 220.0
514 81.0
1810 290.0
178 190.0
183 91.0
121 280.0
1716 60.0
153 151.0
1911 270.0
34 200.0
155 101.0
72 271.0
173 150.0
188 120.0
613 240.0
714 111.0
16 60.0
23 41.0
2010 101.0
414 281.0
1117 241.0
126 181.0
913 170.0
74 141.0
311 231.0
55 231.0
206 80.0
612 11.0
1812 231.0
911 60.0
59 11.0
184 140.0
79 120.0
1315 91.0
210 60.0
1715 71.0
163 280.0
151 21.0
185 131.0
613 220.0
1510 221.0
1512 140.0
66 150.0
1014 300.0
1812 220.0
1220 241.0
57 280.0
1612 171.0
1817 241.0
139 240.0
315 290.0
115 170.0
141 141.0
1720 110.0
54 91.0
166 240.0
183 31.0
62 41.0
66 170.0
713 241.0
209 210.0
133 40.0
127 200.0
1615 241.0
215 121.0
81 130.0
103 101.0
73 191.0
26 301.0
35 71.0
126 80.0
1217 150.0
164 180.0
137 230.0
912 11.0
112 281.0
416 101.0
719 220.0
159 10.0
111 10.0
94 51.0
71 91.0
1012 140.0
1012 90.0
156 210.0
148 271.0
213 81.0
1914 111.0
52 210.0
198 230.0
106 60.0
1815 41.0
718 280.0
1513 210.0
1620 270.0
108 180.0
918 30.0
136 260.0
1618 190.0
121 271.0
911 190.0
1016 230.0
516 40.0
2017 171.0
1114 150.0
1416 290.0
163 21.0
917 71.0
920 31.0
917 101.0
93 290.0
193 120.0
311 271.0
1211 101.0
1112 180.0
615 220.0
69 60.0
15 30.0
811 71.0
911 101.0
1316 110.0
910 190.0
78 130.0
114 90.0
182 221.0
719 270.0
207 71.0
315 210.0
96 20.0
78 230.0
22 130.0
1220 271.0
911 211.0
310 230.0
819 300.0
819 101.0
1110 251.0
107 120.0
713 120.0
1015 130.0
1111 230.0
203 300.0
1120 60.0
1014 130.0
44 201.0
12 171.0
163 151.0
15 141.0
15 210.0
1219 71.0
153 230.0
196 111.0
1019 300.0
99 91.0
1019 91.0
155 111.0
811 291.0
61 211.0
220 91.0
1018 200.0
86 210.0
1615 10.0
108 180.0
2017 200.0
48 41.0
1910 270.0
1114 281.0
66 231.0
2013 11.0
1912 170.0
1211 61.0
2017 71.0
813 20.0
24 181.0
1010 30.0
313 31.0
36 301.0
414 300.0
31 300.0
514 281.0
818 280.0
1618 71.0
148 30.0
810 161.0
101 151.0
148 181.0
215 291.0
106 131.0
96 281.0
95 100.0
64 70.0
74 240.0
74 180.0
31 121.0
519 160.0
146 260.0
2010 50.0
168 141.0
1416 40.0
211 301.0
1819 61.0
24 260.0
27 191.0
141 230.0
58 251.0
21 21.0
113 50.0
39 41.0
185 250.0
86 300.0
114 80.0
169 11.0
1616 30.0
519 200.0
195 270.0
137 201.0
185 270.0
22 41.0
165 70.0
1420 300.0
31 30.0
28 260.0
916 11.0
1819 180.0
71 101.0
615 10.0
515 171.0
418 221.0
610 261.0
1616 91.0
1616 50.0
126 200.0
712 230.0
915 110.0
69 240.0
1210 110.0
35 80.0
113 191.0
811 280.0
317 81.0
176 161.0
76 131.0
1810 231.0
1311 301.0
204 260.0
220 180.0
1817 270.0
151 230.0
913 70.0
111 130.0
1418 141.0
44 161.0
17 241.0
1520 80.0
194 101.0
186 130.0
25 300.0
169 200.0
182 70.0
43 280.0
135 181.0
919 140.0
108 260.0
219 91.0
68 221.0
76 191.0
913 91.0
41 190.0
13 290.0
1316 50.0
1013 241.0
32 151.0
610 51.0
1920 120.0
184 221.0
1115 280.0
1517 211.0
1216 180.0
203 221.0
815 11.0
117 70.0
1520 140.0
1617 301.0
186 130.0
1820 171.0
515 21.0
1020 131.0
620 190.0
1113 111.0
113 31.0
58 240.0
166 20.0
163 150.0
1619 201.0
311 60.0
112 31.0
710 131.0
93 161.0
13 20.0
411 180.0
111 271.0
2013 180.0
415 281.0
111 21.0
911 271.0
27 181.0
214 100.0
54 121.0
118 211.0
46 80.0
104 50.0
126 291.0
43 171.0
412 301.0
810 90.0
118 91.0
1210 11.0
205 11.0
713 61.0
1817 41.0
194 261.0
1216 31.0
616 40.0
214 261.0
204 130.0
1110 230.0
211 300.0
314 281.0
218 261.0
612 130.0
1912 90.0
1011 240.0
1719 41.0
1715 110.0
2011 10.0
109 191.0
1415 50.0
133 281.0
2016 31.0
1715 270.0
15 81.0
1115 241.0
17 130.0
411 240.0
617 230.0
72 220.0
714 41.0
1916 20.0
417 20.0
187 140.0
38 270.0
112 60.0
113 290.0
1216 260.0
1818 231.0
84 220.0
18 211.0
414 250.0
918 191.0
171 60.0
1612 280.0
1319 280.0
411 221.0
414 41.0
42 141.0
820 130.0
106 150.0
1411 10.0
23 50.0
37 81.0
1520 250.0
134 60.0
1012 241.0
313 40.0
176 80.0
131 121.0
45 31.0
134 80.0
120 111.0
318 230.0
1213 170.0
181 90.0
1917 251.0
1811 221.0
117 130.0
520 201.0
918 300.0
138 281.0
116 10.0
167 120.0
146 290.0
416 50.0
164 111.0
93 270.0
87 21.0
1810 161.0
1011 170.0
201 260.0
212 41.0
714 261.0
616 280.0
64 190.0
13 131.0
115 50.0
131 180.0
145 20.0
207 170.0
166 30.0
108 110.0
203 120.0
126 170.0
616 31.0
116 71.0
127 51.0
719 150.0
162 231.0
1219 300.0
617 270.0
123 91.0
105 111.0
24 170.0
811 191.0
11 41.0
1419 100.0
83 221.0
188 121.0
1614 111.0
613 71.0
184 210.0
716 51.0
192 140.0
188 31.0
175 41.0
1011 191.0
618 160.0
152 50.0
619 241.0
55 230.0
82 271.0
76 30.0
%pyspark

# SystemInfo here is a combination of system ID followed by system age
Document = Row("id", "SystemInfo")
test = sc.parallelize([(1L, "20 25"),
              (2L, "4 15"),
              (3L, "16 9"),
              (4L, "9 22"),
              (5L, "17 10"),
              (6L, "7 22")]) \
    .map(lambda x: Document(*x)).toDF() 
    
%pyspark

#Prepare a data set to run the trained model against. To do so, we would pass on a system ID and system age (denoted as SystemInfo in the training output), and the model would predict whether the building with that system ID and system age would be hotter (denoted by 1.0) or cooler (denoted by 0.0).


# Make predictions on test documents and print columns of interest
prediction = model.transform(test)
selected = prediction.select("SystemInfo", "prediction", "probability")
for row in selected.collect():
    print row
Row(SystemInfo=u'20 25', prediction=0.0, probability=DenseVector([0.5001, 0.4999])) Row(SystemInfo=u'4 15', prediction=0.0, probability=DenseVector([0.5018, 0.4982])) Row(SystemInfo=u'16 9', prediction=1.0, probability=DenseVector([0.4787, 0.5213])) Row(SystemInfo=u'9 22', prediction=1.0, probability=DenseVector([0.455, 0.545])) Row(SystemInfo=u'17 10', prediction=1.0, probability=DenseVector([0.4927, 0.5073])) Row(SystemInfo=u'7 22', prediction=0.0, probability=DenseVector([0.5017, 0.4983]))
%pyspark

selected.registerTempTable("predictedEvents")
%sql

select * from predictedEvents
SystemInfopredictionprobability
20 250.0[0.5001380589015282,0.4998619410984719]
4 150.0[0.5018468263478701,0.4981531736521298]
16 91.0[0.4786709532413958,0.5213290467586043]
9 221.0[0.45504802607218514,0.5449519739278149]
17 101.0[0.49270080242078623,0.5072991975792137]
7 220.0[0.5017017284633886,0.49829827153661155]