Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,26 +29,7 @@ from sklearn.feature_selection import SelectFromModel
|
|
| 29 |
import tempfile
|
| 30 |
#------------------------------------------GRUModel-------------------------------------
|
| 31 |
def GRUModel(trainX, trainy, testX, testy, epochs=1000, batch_size=64, learning_rate=0.0001, l1_reg=0.001, l2_reg=0.001, dropout_rate=0.2):
|
| 32 |
-
|
| 33 |
-
GRU Model for regression tasks.
|
| 34 |
-
|
| 35 |
-
Args:
|
| 36 |
-
trainX (np.array): Training features of shape (samples, features).
|
| 37 |
-
trainy (np.array): Training target values of shape (samples,).
|
| 38 |
-
testX (np.array): Testing features of shape (samples, features).
|
| 39 |
-
testy (np.array): Testing target values of shape (samples,).
|
| 40 |
-
epochs (int): Number of epochs for training.
|
| 41 |
-
batch_size (int): Batch size for training.
|
| 42 |
-
learning_rate (float): Learning rate for the optimizer.
|
| 43 |
-
l1_reg (float): L1 regularization parameter.
|
| 44 |
-
l2_reg (float): L2 regularization parameter.
|
| 45 |
-
dropout_rate (float): Dropout rate for regularization.
|
| 46 |
-
|
| 47 |
-
Returns:
|
| 48 |
-
predicted_train (np.array): Predicted values for the training set.
|
| 49 |
-
predicted_test (np.array): Predicted values for the testing set.
|
| 50 |
-
history: Training history.
|
| 51 |
-
"""
|
| 52 |
# Reshape trainX and testX to be 3D: (samples, timesteps, features)
|
| 53 |
trainX = trainX.reshape((trainX.shape[0], 1, trainX.shape[1])) # Adjusted for general feature count
|
| 54 |
if testX is not None:
|
|
|
|
| 29 |
import tempfile
|
| 30 |
#------------------------------------------GRUModel-------------------------------------
|
| 31 |
def GRUModel(trainX, trainy, testX, testy, epochs=1000, batch_size=64, learning_rate=0.0001, l1_reg=0.001, l2_reg=0.001, dropout_rate=0.2):
|
| 32 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
# Reshape trainX and testX to be 3D: (samples, timesteps, features)
|
| 34 |
trainX = trainX.reshape((trainX.shape[0], 1, trainX.shape[1])) # Adjusted for general feature count
|
| 35 |
if testX is not None:
|