-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelTrain.py
More file actions
29 lines (21 loc) · 778 Bytes
/
Copy pathModelTrain.py
File metadata and controls
29 lines (21 loc) · 778 Bytes
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
import numpy
import pandas
import joblib
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
def main():
data_set = pandas.read_csv('data_set.csv', index_col=False)
data_set = numpy.array(data_set)
print("Dataset shape:", data_set.shape)
number_of_rows, number_of_cols = data_set.shape
data_x = data_set[:, :number_of_cols - 1]
data_y = data_set[:, number_of_cols - 1]
model = SVC(C=100, gamma=0.08)
print("Training the model.....")
model.fit(data_x, data_y)
joblib.dump(model, 'model.pkl')
print("Trained and saved the model to project folder successfully.")
if __name__ == '__main__':
main()