コード例 #1
0
def algo1Handler():
    if request.method == 'POST':
        f = request.files['datafile']
        f.save(secure_filename(f.filename))
        arima(f.filename)

        return send_file("sent.xlsx", as_attachment=True)
コード例 #2
0
    def arguments_convey(self):
        # print("hello")
        self.circle = self.select_circle.currentText()
        self.sensor_list = []
        for item in self.checkBox_list:
            if item.isChecked():
                self.sensor_list.append(int(
                    re.findall(r"\d+", item.text())[0]))
        # print(self.circle)
        # print(self.sensor_list)
        if (self.sensor_list == []):
            self.error_output2.clear()
            self.output_widget2.clear()
            self.show_message2("请先选择传感器")

        else:
            self.error_output2.clear()
            self.output_widget2.clear()
            self.show_message2("predicting...")
            ari = arima.arima()
            output, error, predict, available = ari.predict(
                self.sensor_list, int(self.circle[-1]), self.path)
            ari.draw_image(self.name, available, predict, int(self.circle[-1]))
            self.output_widget2.clear()
            self.show_message2(output)
            self.show_error2(error)
            self.output_figure2.setPixmap(QPixmap("./result_img/arima.png"))
コード例 #3
0
ファイル: arimaTemp.py プロジェクト: kurucan/IRDM2016
def arimaTemp(filename):
    
    processTemp()
    predictions = []

    r = pr.R(RCMD="C:\\Program Files\\R\\R-3.1.2\\bin\\R", use_numpy=True, use_pandas=True)
    
    datetimes = np.arange('2008-07-01 00:00:00','2008-07-08 00:00:00',dtype='datetime64[h]')

    for j in range(1,12):

        data = pd.read_csv('../data/outputs/temp_history_processed_station_%s.csv'%j, parse_dates='datetime')  
     
        subts = data["value"]
        print 'Predictions for zone %s'%j    
        results = arima(subts,r)       
       
        results = pd.DataFrame(results, columns=['value'])
        
        results['datetime'] = datetimes
        results['station_id'] = j
      predictions.append(results)
        
    concatPredictions = pd.concat(predictions) 
    
    concatPredictions.to_csv(filename, index=False, date_format='%Y-%m-%d %H:%M:%S', mode='a')  
コード例 #4
0
ファイル: api.py プロジェクト: PAgty/FinanceApi
 def predict(self, algorithm, params, data, time):
     alg_name = algorithm.lower()
     if alg_name == 'arima':
         arima_model = arima(params)
         arima_model.fit(data)
         result = arima_model.predict(time)
         return result
     if alg_name == 'prophet':
         prophet_model = Prophet(params)
         prophet_model.fit(data)
         result = prophet_model.predict(time)
         print(result)
         return result
コード例 #5
0
 def arguments_convey(self):
     self.circle = self.select_circle.currentText()
     self.sensor_list = []
     for item in self.checkBox_list:
         if item.isChecked():
             self.sensor_list.append(int(item.text()[-2:]))
     # print(self.sensor_list)
     self.error_output.clear()
     self.output_widget.clear()
     self.show_message("predicting...")
     ari = arima.arima()
     output, error = ari.predict(self.sensor_list, int(self.circle[-1]),
                                 self.path)
     self.output_widget.clear()
     self.show_message(output)
     self.show_error(error)