Hi, I’m new to ML and DL from a coding perspective.

I built the following regression NN to generate an estimate based on 8 features with 1134 datapoints.

```
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import torch.utils.data
import torch.optim as optim
import pandas as pd
from sklearn.preprocessing import StandardScaler
#### IMPORT THE DATASET ####
dataset = pd.read_csv('./Mel.csv')
# columns of input data
maxCol = 8
startCol = 0
# redraw the dataset
datasetInterim = dataset.iloc[:, 0:9].values
# set up independent variables
x_temp = datasetInterim[:, startCol:maxCol]
sc = StandardScaler()
x_temp = sc.fit_transform(x_temp)
# set up dependent values
y_temp = datasetInterim[:, maxCol]
datasetFinal = torch.FloatTensor(datasetInterim)
X_train = torch.FloatTensor(x_temp)
Y_train = torch.FloatTensor(y_temp)
# batch the data
trainset = torch.utils.data.DataLoader(datasetFinal, batch_size = 1, shuffle = True)
testset = torch.utils.data.DataLoader(datasetFinal, batch_size = 1, shuffle = True)
# no errors above
#### MODEL THE ARCHITECTURE ####
class Net(nn.Module):
def __init__(self):
super().__init__()
self.layer1 = nn.Linear(8, 64)
self.layer2 = nn.Linear(64, 32)
self.layerOutput = nn.Linear(32, 1)
def forward(self, x):
y_pred1 = F.relu(self.layer1(x))
y_pred2 = F.relu(self.layer2(y_pred1))
y_output_pred = self.layerOutput(y_pred2)
return y_output_pred
net = Net()
# no errors above
#### START THE ENGINES ####
loss_function = nn.MSELoss()
optimizer = optim.Adam(net.parameters(), lr = 0.01)
EPOCHS = 500
for epoch in range(EPOCHS):
y_output_pred = net(X_train)
loss = loss_function(y_output_pred, Y_train)
optimizer.zero_grad()
loss.backward()
print(loss)
optimizer.step()
```

My code works, largely, the loss hovers at 260. However, I have encountered the following problems:

- Using a target size (torch.Size([1133])) that is different to the input size (torch.Size([1133, 1])) (1133 being the sample size). I can’t seem to resolve this.
- I dont know how to use it. It’s good to see the loss function converging, but I dont know how to test datapoints.

Do you guys know how to give me a hand in this? very new to this. Big thank you!