预览截图
应用介绍
使用各种人工智能算法来尝试预测电力负荷,从图中可以看出预测的负荷数据,与实际数据的差距,
from sklearn.linear_model import LinearRegression
import numpy as np
import nn_models
# NOTE: All algorithms must follow this function header to work in the runner
# def fun(X_train, Y_train, X_test,Y_test)
def linear_regression(X_train, Y_train, X_test, Y_test):
lm = LinearRegression()
lm.fit(X_train, Y_train)
predictions = lm.predict(X_test)
coefficients = lm.coef_
return (predictions, coefficients)
# Note that NN regression reshapes the input arrays to make them easier to batch
def NN_regression(X_train, Y_train, X_test, Y_test, batch_size=100, epochs=50, filepath="nn_models/best_basicE2E.nn"):
nn = nn_models.BasicE2ENN()
nn.build_model(X_train, Y_train, tuple(np.asarray(X_train).shape[1:]))
nn.train(X_train, Y_train, X_test, Y_test, batch_size, epochs, filepath)
predictions = nn.predict(X_test)
loss = nn.evaluate(X_test,Y_test)
return (predictions,loss)
def svr(X_train, Y_train, X_test, Y_test):
clf = SVR(gamma='scale', C=1.0, epsilon=0.2,verbose=True)
clf.fit(X_train, Y_train)
predictions = clf.predict(X_test)
score = sklearn.metrics.mean_squared_error(Y_test, predictions)
return (predictions, score)
####################################################################################
# HELPER FUNCTIONS
©版权声明:本文内容由互联网用户自发贡献,版权归原创作者所有,本站不拥有所有权,也不承担相关法律责任。如果您发现本站中有涉嫌抄袭的内容,欢迎发送邮件至: [email protected] 进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。
转载请注明出处: apollocode » 人工智能算法电力负荷
文件列表(部分)
名称 | 大小 | 修改日期 |
---|---|---|
algorithms.py | 0.54 KB | 2019-11-30 |
baseline.jpg | 61.30 KB | 2019-11-30 |
data.py | 1.00 KB | 2019-11-30 |
features.py | 0.51 KB | 2019-11-30 |
neural_net.jpg | 62.38 KB | 2019-11-30 |
best_AutoEncoder.ae | 91.19 KB | 2019-11-30 |
best_basicE2E.nn | 65.38 KB | 2019-11-30 |
nn_models.py | 0.88 KB | 2019-11-30 |
runner.py | 0.68 KB | 2019-11-30 |
test.pickle | 244.96 KB | 2019-11-30 |
train.pickle | 2,198.48 KB | 2019-11-30 |
visualizer.py | 0.79 KB | 2019-11-30 |
nn_models | 0.00 KB | 2019-11-30 |
Load-Forcasting | 0.00 KB | 2020-07-08 |
发表评论 取消回复