Zaktualizuj 'main.py'
This commit is contained in:
parent
3bfbb22edb
commit
101b46639c
10
main.py
10
main.py
@ -14,23 +14,17 @@ data_train = shuffled_data[:n]
|
||||
data_test = shuffled_data[n:]
|
||||
|
||||
X_train = data_train.iloc[:, 1:-1].values
|
||||
print(X_train)
|
||||
y_train = data_train.iloc[:, -1].values
|
||||
|
||||
lab = preprocessing.LabelEncoder()
|
||||
y_transformed = lab.fit_transform(y_train)
|
||||
|
||||
X_test = data_test.iloc[:, 1:-1].values
|
||||
# y_test = data_test.iloc[:, 1:].values
|
||||
|
||||
# svr = SVR()
|
||||
# svr.fit(X_train, y_train)
|
||||
# print(svr.score(X_train, y_train))
|
||||
# print(svr.score(X_test, y_test))
|
||||
|
||||
classifier = RandomForestClassifier()
|
||||
classifier.fit(X_train, y_transformed)
|
||||
y_pred = classifier.predict(X_test)
|
||||
|
||||
for i, prediction in enumerate(y_pred):
|
||||
print(f"Rekord {i+1}: collapse={prediction}")
|
||||
print(data_test.iloc[i, 0] + ": ")
|
||||
print(prediction)
|
Loading…
Reference in New Issue
Block a user