當前位置: 首頁>>代碼示例>>Python>>正文


Python NN.setup方法代碼示例

本文整理匯總了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)
開發者ID:davidbuniat,項目名稱:luftwagen-ml,代碼行數:24,代碼來源:pollutionApi.py


注:本文中的NN.setup方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。