part1 done
This commit is contained in:
@@ -4,3 +4,4 @@ __pycache__/
|
||||
*.pyo
|
||||
cache/
|
||||
*.parquet
|
||||
*.pth
|
||||
@@ -0,0 +1,23 @@
|
||||
import torch.nn as nn
|
||||
|
||||
# Simple Linear Model
|
||||
class LinearModel(nn.Module):
|
||||
def __init__(self, input_features):
|
||||
super(LinearModel, self).__init__()
|
||||
self.linear = nn.Linear(input_features, 1) # Single output (return prediction)
|
||||
|
||||
def forward(self, x):
|
||||
return self.linear(x)
|
||||
|
||||
# Non-Linear Neural Network Model
|
||||
class NonLinearModel(nn.Module):
|
||||
def __init__(self, input_features, hidden_size=64):
|
||||
super(NonLinearModel, self).__init__()
|
||||
self.network = nn.Sequential(
|
||||
nn.Linear(input_features, hidden_size),
|
||||
nn.ReLU(), # Non-linear activation
|
||||
nn.Linear(hidden_size , 1) # Output layer
|
||||
)
|
||||
|
||||
def forward(self, x):
|
||||
return self.network(x)
|
||||
+2290
-73
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user