Constructing a CNN model for a 2D input with Keras

General Tech Learning Aids/Tools 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

I know that this kind of question has been already asked a ton of com/tag/times">times before, but i haven't found a satisfactory answer or example that could aid me with the solution i'm looking for.

I'm pretty new to keras and data science in general, so excuse me if any of this sounds obvious or wrong.

I'm trying to create a CNN model that predicts a value from a 2D table (1M+, 16), the table has the following structure:

    Date  Name  [... 13 columns ... ]  Result
    1     A     ...                     0.5
    1     A     ...                     0.3
    1     A     ...                    -0.1
    ...
    1     B     ...                     0.4
    1     B     ...                    -0.8
    1     C     ...                     0.7
    ...
    2     A     ...                     0.15
    2     A     ...                     0.38
    ...

I have already tried several approaches, but the closest one was this:

def split_sequences(x_, y_ , n_steps):
  X, y = com/tag/list">list(), com/tag/list">list()
  for i in range(len(x_)):
      # find the end of this pattern
      end_ix = i + n_steps
      # check if we are beyond the dataset
      if end_ix > len(x_):
          break
      # gather com/tag/input">input and output parts of the pattern
      seq_x, seq_y = x_[i:end_ix, :], y_[end_ix-1]
      X.append(seq_x)
      y.append(seq_y)
  return array(X), array(y)

n_steps = 5
# X and Y are the training sets, val_X and val_Y are the validation sets
X_, Y_ = split_sequences(X,Y,n_steps)
n_features = X_.shape[2]
val_X_, val_Y_ = split_sequences(val_X,val_Y,n_steps)
print(X_.shape)
print(Y_.shape)
print(val_X_.shape)
print(val_Y_.shape)


->(1804642, 5, 15)
->(1804642,)
->(601545, 5, 15)
->(601545,)


model = Sequential()
model.add(Conv1D(filters=64, kernel_size=2, activation
                                                
                                                
0 views
0 shares

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.

tuteehub community

Join Our Community Today

Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.

tuteehub community