Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '__main__':
- warnings.filterwarnings('ignore', category=ConvergenceWarning)
- learning_rate = float(input())
- epochs = int(input())
- train_x, train_y, test_x, test_y = divide_set(data)
- # probaj go ova so epochs namesto max_iter
- klasifikator = MLPClassifier(6, activation="tanh", max_iter=epochs, learning_rate_init=learning_rate,
- random_state=0)
- klasifikator.fit(train_x, train_y)
- train_acc = 0
- prediction = klasifikator.predict(train_x)
- for pred, ele in zip(prediction, train_y):
- if pred == ele:
- train_acc += 1
- test_acc = 0
- prediction = klasifikator.predict(test_x)
- for pred, ele in zip(prediction, test_y):
- if pred == ele:
- test_acc += 1
- train_acc = train_acc / len(train_x)
- test_acc = test_acc / len(test_x)
- if (int((train_acc - test_acc) * 100 > 15)):
- print("Se sluchuva overfitting")
- else:
- print("Ne se sluchuva overfitting")
- print("Tochnost so trenirachko mnozhestvo:", train_acc)
- print("Tochnost so validacisko mnozhestvo:", test_acc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement