草庐IT

predictions

全部标签

python - 使用 ARMAResult.predict() 函数的正确方法

根据这个问题HowtogetconstantterminARModelwithstatsmodelsandPython?.我现在正尝试使用ARMA模型来拟合数据,但我还是找不到解释模型结果的方法。这是我根据ARMAout-of-samplepredictionwithstatsmodels所做的和ARMAResults.predictAPIdocument.#ParameterINPUT_DATA_POINT=200P=5Q=0#ReadDatadata=[]f=open('stock_all.csv','r')forlineinf:data.append(float(line.spl

Python 统计模型 : Using SARIMAX with exogenous regressors to get predicted mean and confidence intervals

我正在使用statsmodels.tsa.SARIMAX()来训练具有外生变量的模型。当使用外生变量训练模型以便返回的对象包含预测均值和置信区间而不仅仅是一组预测均值结果时,是否存在get_prediction()的等价物?predict()和forecast()方法采用外生变量,但只返回预测平均值。SARIMA_model=sm.tsa.SARIMAX(endog=y_train.astype('float64'),exog=ExogenousFeature_train.values.astype('float64'),order=(1,0,0),seasonal_order=(2,

python - TensorFlow estimator.predict() 给出警告 :tensorflow:Input graph does not contain a QueueRunner

我正在尝试使用带有estimator.predict的自定义输入函数进行预测,但它给了我这个:警告:tensorflow:输入图不包含QueueRunner。这意味着永远预测yield。这可能是一个错误。它没有给我一个错误,但是predict只是说它恢复参数并且不返回实际的预测。这是我的代码:test_data=[0.03,0.91,0.95,0.10,0.56,0.93]test_data_in={k:test_data[index]forindex,kinenumerate(FEATURES)}print(test_data_in)defpredict_input_fn(data_

python - Statsmodels ARIMA - 使用 predict() 和 forecast() 的不同结果

我使用(Statsmodels)ARIMA来预测一系列的值:plt.plot(ind,final_results.predict(start=0,end=26))plt.plot(ind,forecast.values)plt.show()我以为我会从这两种方法中得到相同的结果,但我却得到了这个:我想知道是使用predict()还是forecast()。 最佳答案 从图表上看,您似乎是在使用forecast()进行样本外预测,而在使用predict进行样本内预测。基于ARIMA方程的性质,对于较长的预测周期,样本外预测往往会收敛到样

python - 如何使用 tf.estimator 返回预测和标签(使用 predict 或 eval 方法)?

我正在使用Tensorflow1.4。我创建了一个自定义的tf.estimator来进行分类,如下所示:defmodel_fn():#Someoperationshere[...]returntf.estimator.EstimatorSpec(mode=mode,predictions={"Preds":predictions},loss=cost,train_op=loss,eval_metric_ops=eval_metric_ops,training_hooks=[summary_hook])my_estimator=tf.estimator.Estimator(model_f

python - 值错误 : feature_names mismatch: in xgboost in the predict() function

我训练了一个XGBoostRegressor模型。当我必须使用这个经过训练的模型来预测新输入时,predict()函数会抛出feature_names不匹配错误,尽管输入特征向量与训练数据具有相同的结构。此外,为了构建与训练数据具有相同结构的特征向量,我做了很多低效的处理,例如添加新的空列(如果数据不存在),然后重新排列数据列,以便它与培训结构相匹配。是否有更好、更简洁的方式来格式化输入以使其与训练结构相匹配? 最佳答案 在这种情况下,模型构建时列名的顺序与模型评分时列名的顺序不同。我已经使用以下步骤来克服这个错误先加载pickle

python - 如何知道 Scikit-learn 中 predict_proba 的返回数组中表示哪些类

我从Scikit-learn开始......>>>importsklearn>>>sklearn.__version__'0.13.1'>>>fromsklearnimportsvm>>>model=svm.SVC(probability=True)>>>X=[[1,2,3],[2,3,4]]#featurevectors>>>Y=['apple','orange']#classes>>>model.fit(X,Y)>>>model.predict_proba([1,2,3])array([[0.39097541,0.60902459]])我怎么知道哪个类应该是哪个?

python - 如何将 predict_generator 与 ImageDataGenerator 一起使用?

我是Keras的新手。我训练了一个模型并想预测存储在子文件夹中的一些图像(例如用于训练)。为了进行测试,我想预测7个类(子文件夹)中的2个图像。下面的test_generator看到了14张图像,但我得到了196个预测。错误在哪里?非常感谢!test_datagen=ImageDataGenerator(rescale=1./255)test_generator=test_datagen.flow_from_directory(test_dir,target_size=(200,200),color_mode="rgb",shuffle="false",class_mode='cate

python - cross_val_score 和 cross_val_predict 的区别

我想评估一个使用交叉验证的scikitlearn构建的回归模型,我很困惑,我应该使用cross_val_score和cross_val_predict这两个函数中的哪一个。一种选择是:cvs=DecisionTreeRegressor(max_depth=depth)scores=cross_val_score(cvs,predictors,target,cv=cvfolds,scoring='r2')print("R2-Score:%0.2f(+/-%0.2f)"%(scores.mean(),scores.std()*2))另一个,使用标准r2_score的cv预测:cvp=Dec

python - Keras 模型的 predict 和 predict_on_batch 方法有什么区别?

根据kerasdocumentation:predict_on_batch(self,x)Returnspredictionsforasinglebatchofsamples.但是,在批处理上调用标准predict方法似乎没有任何区别,无论它是一个元素还是多个元素。model.predict_on_batch(np.zeros((n,d_in)))与相同model.predict(np.zeros((n,d_in)))(形状为(n,d_out)的numpy.ndarray 最佳答案 不同之处在于当您传递大于一批的x数据时。predi