GithubHelp home page GithubHelp logo

fmpr / deepjmqr Goto Github PK

View Code? Open in Web Editor NEW
14.0 3.0 7.0 128 KB

Deep joint mean and quantile regression for spatio-temporal problems

License: GNU General Public License v3.0

Jupyter Notebook 50.99% Shell 0.03% Python 48.97%
deep-learning quantile-regression prediction-intervals spatio-temporal keras

deepjmqr's People

Contributors

fmpr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

deepjmqr's Issues

mean and std

Hi professor,
I have used this method to compute the 'removed_trend' and 'removed_std', but the result was not same as you. Can you tell me your method.
my method:
df['mean'] =( df.groupby(['day_of_week','hour','minute'])['pickups'].transform('mean'))

add weather data

Hi, Professor, when i read your paper, i have an idea that is to add weather(eg precipitation) into the model, then I have done something to the DeepJMQR model as following:

weather data processing

weather_feats = weather['precipitation'].values[:,np.newaxis]

---------------- Build lags

weather_feats[:-NUM_LAGS,:] = weather_feats[NUM_LAGS:,:]
weather_feats_train = weather_feats[:i_train,:]
weather_feats_val = weather_feats[i_train:i_val,:]
weather_feats_test = weather_feats[i_val:i_test,:]
#深度学习模型for mean

---------------- Independent deep learning models for mean and quantiles

def tilted_loss(q,y,f):
e = (y-f)
# The term inside k.mean is a one line simplification of the first equation
return K.mean(q*e + K.clip(-e, K.epsilon(), np.inf), axis=-1)

def build_model(loss="mse", num_outputs=1):
model = Sequential()

model.add(ConvLSTM2D(filters=100, kernel_size=(3, 3),
               input_shape=(None, nx, ny, 1),
               padding='same', return_sequences=False))
model.add(BatchNormalization())
model.add(Dropout(0.75))

model.add(Dense(units=num_outputs, 
                kernel_regularizer=regularizers.l2(0.0001),
         ))
model.add(Activation("linear"))

model.compile(loss=loss, optimizer='nadam')

return model

print ("\nTraining NN for mean...")

checkpoint best model

checkpoint = ModelCheckpoint("weights_mean.best.hdf5", monitor='val_loss', verbose=1, save_best_only=True, mode='min')

fit model to the mean

model_mean = build_model(loss="mse", num_outputs=1)
model_mean.summary()
model_mean.fit(
[X_train[:,:,:,:,np.newaxis],weather_feats_train[:,:]],
y_train[:,:,:,np.newaxis],
batch_size=128,
epochs=N_EPOCHS, #100
validation_data=([X_val[:,:,:,:,np.newaxis],weather_feats_val[:,:]],y_val[:,:,:,np.newaxis]),
callbacks=[checkpoint],
verbose=0)

But there is a error:ValueError: Error when checking model input: the list of Numpy arrays that you are passing to your model is not the size the model expected. Expected to see 1 array(s), but instead got the following list of 2 arrays

I have tried to solve this problem, but failed. Could you give me a good idea?
Thank you very much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.