data = pd.read_csv("SomervilleHappinessSurvey2015.csv")
```
3. Separate the input features from the target. Note that the target is located in the first column of the CSV file. Convert the values into tensors, making sure the values are converted into floats:
x = torch.tensor(data.iloc [:,1:]。values).float()
y = torch.tensor(data.iloc [:,:1] .values).float()
```py
x = torch.tensor(data.iloc[:,1:].values).float()
y = torch.tensor(data.iloc[:,:1].values).float()
```
4. Define the architecture of the model and store it in a variable named **model**. Remember to create a single-layer model:
模型= nn.Sequential(nn.Linear(6,1),
nn.Sigmoid())
```py
model = nn.Sequential(nn.Linear(6, 1),
nn.Sigmoid())
```
5. Define the loss function to be used. Use the MSE loss function:
loss_function = torch.nn.MSELoss()
```py
loss_function = torch.nn.MSELoss()
```
6. Define the optimizer of your model. Use the Adam optimizer and a learning rate of`0.01`: