本文整理汇总了Python中NN.setup方法的典型用法代码示例。如果您正苦于以下问题:Python NN.setup方法的具体用法?Python NN.setup怎么用?Python NN.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NN
的用法示例。
在下文中一共展示了NN.setup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: predictPollution
# 需要导入模块: import NN [as 别名]
# 或者: from NN import setup [as 别名]
import weather
import NN as nn
get_pm5_prediction = nn.setup()
# SAMPLE usage, Delete before using it as library
def predictPollution(precipitation_prob, relative_humidity, temp, wind_direction, wind_speed):
O3PreictedVal = 5.03704930e+01 + (precipitation_prob * 9.66895471e-02) + (relative_humidity * -2.99780572e-03) + (temp * -2.26017118e-01) + (wind_direction * -8.96663780e-03) + (wind_speed * 9.98339351e+00)
PM25PredictedVal = 1.36006991e+01 + (temp * -9.32461073e-02) + (wind_direction * -3.35510810e-04) + (wind_speed * -7.50369156e-01)
nnPrediction = get_pm5_prediction(TMP = temp,WDIR = wind_direction,WSPD = wind_speed)
#3.6 is average
if abs(nnPrediction - PM25PredictedVal) > 7.2:
if abs(nnPrediction - 3.6) > abs(PM25PredictedVal - 3.6):
return O3PreictedVal, PM25PredictedVal
else:
return O3PreictedVal, nnPrediction
return O3PreictedVal, (nnPrediction + PM25PredictedVal)/2
def pollutionAPi(lat, lon, offset):
return predictPollution(*weather.get_weather(lat, lon, offset))
#offset -> [0,2], 0 means now, 1 means one hour from now, and 2 means 2 hour from now
print pollutionAPi(51.0123, 0.3, 0)