Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# Model Card for ombayus_iris_model
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
```python
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn as nn
|
| 8 |
+
import torch.nn.functional as F
|
| 9 |
+
|
| 10 |
+
class Model(nn.Module):
|
| 11 |
+
def __init__(self,in_features=4,h1=8,h2=9,out_feauteres=3):
|
| 12 |
+
super().__init__() # instantiate our nn.Module
|
| 13 |
+
self.fc1 = nn.Linear(in_features,h1)
|
| 14 |
+
self.fc2 = nn.Linear(h1,h2)
|
| 15 |
+
self.out = nn.Linear(h2,out_feauteres)
|
| 16 |
+
|
| 17 |
+
def forward(self,x):
|
| 18 |
+
x = F.relu(self.fc1(x))
|
| 19 |
+
x = F.relu(self.fc2(x))
|
| 20 |
+
x = self.out(x)
|
| 21 |
+
return x
|
| 22 |
+
|
| 23 |
+
def number_to_follower(x):
|
| 24 |
+
if x == 0:
|
| 25 |
+
return'Setosa'
|
| 26 |
+
elif x == 1:
|
| 27 |
+
return 'Versicolor'
|
| 28 |
+
elif x == 2:
|
| 29 |
+
return 'Virginica'
|
| 30 |
+
|
| 31 |
+
model = Model()
|
| 32 |
+
|
| 33 |
+
model.load_state_dict(torch.load('ombayus_iris_model.pt'))
|
| 34 |
+
|
| 35 |
+
new_iris = torch.tensor([5.9,3.0,5.1,1.8])
|
| 36 |
+
|
| 37 |
+
with torch.no_grad():
|
| 38 |
+
print(number_to_follower(model(new_iris).argmax().item()))
|
| 39 |
+
|
| 40 |
+
```
|