prediction

R multivariate one step ahead forecasts and accuracy

让人想犯罪 __ 提交于 2021-02-07 07:55:58
问题 Using R I would like to compare the RMSE (root mean square error) from two prediction models. The first model uses estimates from 1966 to 2000 to predict 2001 and then uses estimates from 1966 to 2001 to predict 2002 and so on up to 2015. The second model uses estimates from 1991 to 2000 to predict 2001 and then uses estimates from 1992 to 2001 to predict 2002 and so on up to 2015. This problem has me really stumped and I truly appreciate any help. DF <- data.frame(YEAR=1966:2015, TEMP=rnorm

r - loess prediction returns NA

浪子不回头ぞ 提交于 2020-04-09 17:55:25
问题 I am struggling with "out-of-sample" prediction using loess . I get NA values for new x that are outside the original sample. Can I get these predictions? x <- c(24,36,48,60,84,120,180) y <- c(3.94,4.03,4.29,4.30,4.63,4.86,5.02) lo <- loess(y~x) x.all <- seq(3,200,3) predict(object = lo,newdata = x.all) I need to model full yield curve, i.e. interest rates for different maturities. 回答1: From the manual page of predict.loess : When the fit was made using surface = "interpolate" (the default),

tensorflow模型保存和使用08

↘锁芯ラ 提交于 2020-03-22 16:56:21
我们先定义一个简单的神经网络,用来训练模型,然后将模型保存下来,最后加载保存下来的模型进行检测,查看输出结果。 #模型训练和保存 import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data #载入数据集 mnist = input_data.read_data_sets("MNIST_data", one_hot=True) #每个批次100张照片 batch_size=100 #计算一共有多少个批次 n_batch=mnist.train.num_examples // batch_size #定义两个placeholder x=tf.placeholder(tf.float32, [None, 784]) y=tf.placeholder(tf.float32, [None, 10]) #创建一个简单的神经网络,输入层784个神经元,输出层10个神经元 W=tf.Variable(tf.zeros([784, 10])) b=tf.Variable(tf.zeros([10])) prediction=tf.nn.softmax(tf.matmul(x,W)+b) #二次代价函数 loss=tf.reduce_mean(tf.nn.softmax_cross_entropy

AttributeError: 'list' object has no attribute 'argmax' and numpy.AxisError: axis 2 is out of bounds for array of dimension 1

让人想犯罪 __ 提交于 2020-03-21 07:00:40
问题 i have a function for predicting keras NMT model and it works fine but its reading the file and then save the prediction to another file but i want user input and make a prediction full code from keras.preprocessing.sequence import pad_sequences from keras.models import load_model import sys import warnings import argparse from seq2seq_utils import * ap = argparse.ArgumentParser() ap.add_argument('-max_len', type=int, default=95) ap.add_argument('-vocab_size', type=int, default=31500) args =

Why are there discrepancies in xgboost regression prediction from individual trees?

主宰稳场 提交于 2020-03-19 06:22:31
问题 First I run a very simple xgb regression model which contains only 2 trees with 1 leaf each. Data available here. (I understand this is a classification dataset but I just force the regression to demonstrate the question here): import numpy as np from numpy import loadtxt from xgboost import XGBClassifier,XGBRegressor from xgboost import plot_tree import matplotlib.pyplot as plt plt.rc('figure', figsize=[10,7]) # load data dataset = loadtxt('pima-indians-diabetes.csv', delimiter=",") # split

Error in eval(predvars, data, env) : object 'Rm' not found

风格不统一 提交于 2020-03-19 04:01:08
问题 dataset = read.csv('dataset/housing.header.binary.txt') dataset1 = dataset[6] #higest positive correlation dataset2 = dataset[13] #lowest negative correlation dependentVal= dataset[14] #dependent value new_dataset = cbind(dataset1,dataset2, dependentVal) # new matrix #split dataset #install.packages('caTools') library(caTools) set.seed(123) #this is needed to garantee that every run will produce the same output split = sample.split(new_dataset, SplitRatio = 0.75) train_set = subset(new

Traffic Prediction Based on Surrogate Model in Satellite Constellation Networks

本秂侑毒 提交于 2020-03-11 16:22:13
引用:Chen Q, Zhang Y, Guo J, et al. Traffic Prediction Based on Surrogate Model in Satellite Constellation Networks[C]//2019 12th IFIP Wireless and Mobile Networking Conference (WMNC). IEEE, 2019: 126-130. 基于代理模型的卫星星座网络流量预测 摘要 卫星运动使得卫星覆盖范围内的流量变化比较大,流量预测很重要。预测模型包括上升节点的地理经度和通过上升节点的时间。卫星星座所有卫星都可以被这两个变量定义。文章提出一个事件无关的基于代理的预测方式 概述 预测流量对动态资源分配有很大作用:功耗、频谱利用率和带宽分配。 卫星流量来自于邻居卫星和地面流量,大部分时候后者占了多数,本文只考虑后者 卫星覆盖流量模型 认为:地面历史流量数据已知、时间无关;可根据卫星位置和波束宽度得知卫星覆盖。为得到流量信息,通常地面根据预先计算的几个轨道周期的地面轨迹逐点计算覆盖流量,然后将流量数据库上传到在轨卫星。当数据库过期时,需要定期更新。为了降低计算成本,我们使用部分样本建立近似模型,预测整个模型空间内的交通流量变化 基于代理的预测模型 代理模型是一种有效的预测方法,它通过建立近似模型来拟合真实模型

sklearn Logistic Regression ValueError: X has 42 features per sample; expecting 1423

谁说我不能喝 提交于 2020-03-03 10:03:39
问题 I'm stuck trying to fix an issue. Here is what I'm trying to do : I'd like to predict missing values (Nan) (categorical one) using logistic regression. Here is my code : df_1 : my dataset with missing values only in the "Metier" feature (missing values I'm trying to predict) X_train = pd.get_dummies(df_1[df_1['Metier'].notnull()].drop(columns='Metier'),drop_first = True) X_test = pd.get_dummies(df_1[df_1['Metier'].isnull()].drop(columns='Metier'),drop_first = True,dummy_na = True) Y_train =