本文整理汇总了Python中Control.previous_date方法的典型用法代码示例。如果您正苦于以下问题:Python Control.previous_date方法的具体用法?Python Control.previous_date怎么用?Python Control.previous_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Control
的用法示例。
在下文中一共展示了Control.previous_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup
# 需要导入模块: import Control [as 别名]
# 或者: from Control import previous_date [as 别名]
def setup():
###############################################################################
#import Data
import Prediction
import warnings
import Control
warnings.filterwarnings("ignore")
Prediction_horizon = 60 # in minutes
#Data.data_acquisition()
DATA_LIST={}
wb = openpyxl.load_workbook('DATA_LIST.xlsx')
sheet = wb.get_sheet_by_name('Sheet1')
for key in range(1, sheet.max_column+1):
DATA_LIST[sheet.cell(row=1, column=key).value]=[]
for v in range(2, sheet.max_row+1):
DATA_LIST[sheet.cell(row=1, column=key).value].append(sheet.cell(row=v, column=key).value)
# Model generation
#SVR_model = Prediction.Support_Vector_Regression(DATA_LIST, Prediction_horizon)
KNN_model = Prediction.kNN_Regression(DATA_LIST, Prediction_horizon)
BRR_model = Prediction.Bayesian_Ridge_Regression(DATA_LIST, Prediction_horizon)
# workbook = xlsxwriter.Workbook(os.path.dirname(os.path.abspath(__file__))+'\Control.xlsx')
# workbook.add_worksheet()
# workbook.close()
alpha = 0.7 # Higher alpha means slower adaptation
T_history={}
try:
for i in range(1,8):
T_history[str(i)] = Control.max_T_history(Control.previous_date(i))
Mean_Running_Average = (1.0 - alpha) * sum( (alpha** (i-1) ) * int(T_history [str(i)]) for i in range(1,8) )
except Exception:
Mean_Running_Average = 20
return DATA_LIST, KNN_model, BRR_model, Mean_Running_Average