-
Notifications
You must be signed in to change notification settings - Fork 22
/
train.py
43 lines (28 loc) · 840 Bytes
/
train.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import pandas as pd
import numpy as np
from nnet import YapaySinirAgi
def category_encode(etiketler, etiketCesit = 10):
categorized_etiketler = []
for i in etiketler:
vector = np.zeros(etiketCesit)
vector[i] = 1
categorized_etiketler.append(vector)
return np.array(categorized_etiketler)
def optimizasyon(X):
X = X / 255
X_matrix = []
size = len(X)
for i in range(size):
X_matrix.append(np.array(X.iloc[i]).reshape(( 28, 28, 1)))
return np.array(X_matrix)
dataset = pd.read_csv("dataset.csv")
y = dataset["label"]
y = category_encode(y)
X = dataset.drop("label", axis = 1)
X = optimizasyon(X)
def egitimVerisi(): pass
egitimVerisi.X = X
egitimVerisi.y = y
yapayzeka = YapaySinirAgi()
yapayzeka.egit(egitimVerisi,50)
yapayzeka.kaydet("ytu_egitilmis_model_50")