I am interested to use multivariate regression with LSTM (Long Short Term Memory). As an example, we can take the stock price prediction problem, where the price at time t is based on multiple factors (open price, closed price, etc.). Using this information we need to predict the price for t+1. Another example can be the house price prediction (which depends on factors like, age of house, area, no. of beds, no. of baths, etc). Using this information, we can predict the price of a given house.
I have found many examples where they just used a single variable regression, but I am interested to use multiple features.
Has anyone tried this and can anyone point out the right direction for this?
I tried the following but have no idea if this is the efficient way.
# Importing the training set training_set = pd.read_csv('Google_Stock_Price_Train.csv').iloc[:,1:3].values#has fields: Date,Open,High,Low,Close,Volume # Feature Scaling from sklearn.preprocessing import MinMaxScaler sc = MinMaxScaler() training_set_scaled = sc.fit_transform(training_set) X_train = training_set_scaled[0:1257] y_train = training_set_scaled[1:1258] # Reshaping X_train = np.reshape(X_train, (1257, 1, 2)) X_train, y_train = np.array(X_train), np.array(y_train) X_train = np.reshape(X_train, (X_train.shape, X_train.shape, 2)) from keras.models import Sequential from keras.layers import Dense, LSTM regressor = Sequential() regressor.add(LSTM(units = 4, activation = 'sigmoid', input_shape = (None, 2))) regressor.add(Dense(units = 2)) regressor.compile(optimizer = 'rmsprop', loss = 'mean_squared_error') regressor.fit(X_train, y_train, batch_size = 32, epochs = 100)