#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 3 13:09:18 2017
@author: lu
"""
import numpy as np
import pandas as pd
from keras.layers.core import Activation, Dense
from keras.models import Sequential
"""
programmer_1-->簡單的數據篩選,劃分數據
programmer_2-->阈值尋優???不懂。。
programmer_3-->建立訓練神經網絡,並進行模型的檢驗
programmer_4-->根據幾個特征推算出是否滿足某項條件
event_num-->相鄰時間的差分,比較是否大於阈值
"""
def programmer_1():
# 阈值
threshold = pd.Timedelta("4 min")
inputfile = "data/water_heater.xls"
outputfile = "tmp/dividsequence.xls"
data = pd.read_excel(inputfile)
# dataframe處理
data[u"發生時間"] = pd.to_datetime(data[u"發生時間"], format="%Y%m%d%H%M%S")
data = data[data[u"水流量"] > 0] # 流量大於0
d = data[u"發生時間"].diff() > threshold # 相鄰