i build a classifying model about phishing site.
1. first, about my data
num_dataset: i have about 16000 dataset
num_feature: my dataset has 12 characterisitics.
label: if it's a phishing site, i set it's label -1. else 1
batch_size: set batch_size 128, for cnn model
kernel_size: 3
2. I try
from torch.utils.data import DataLoader, TensorDataset
train_dataset = TensorDataset(x_train, y_train)
train_loader = DataLoader(train_dataset, batch_size=batch_size, shuffle=True)
#-------------------------------------------------------#
class CNN(nn.Module):
def __init__(self, kernel_size):
super().__init__()
self.layer1 = nn.Sequential(
nn.Conv1d(12, 32, 3,
stride=1, padding=1)
...
def forward(self, x):
out = self.layer1(x)
...
#-------------------------------------------------------#
model = CNN()
for epoch in range(epochs):
avg_cost = 0
for x_train, y_train in train_loader:
Hypothesis = model(x_train)
x_train.shape
torch.Size([16072, 12])
y_train.shape
torch.Size([16072, 1])
3. Error
at Hypothesis = model(x_train)
RuntimeError: Expected 3-dimensional input for 3-dimensional weight [32, 12, 3], but got 2-dimensional input of size [128, 12] instead
4. Finnally
i think it's because I'm confused between conv1d and conv2d but i can't figure it out...
plz, i want to know the cause of this problem