Java教程

置信规则库推理

本文主要是介绍置信规则库推理,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
from sklearn.metrics import accuracy_score, f1_score, recall_score, precision_score
from sklearn.model_selection import KFold, train_test_split

from liu_ebrb import LiuEBRBClassifier

from process_data import process_to_pieces
import random
import pandas as pd
from random_process import random_array


df = pd.read_csv('newdata.csv', names=[' HR', ' PULSE', ' RESP', ' SpO2', 'Class'])
X = df.drop(['Class'], axis=1).values
y = df["Class"].values
A, D = process_to_pieces(X, y, 3, 4)


ebrb = LiuEBRBClassifier(A, D)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=1)

print(X_train)

ebrb = ebrb.fit(X_train,  y_train)

y_predict = ebrb.predict(X_test)
print(y_predict)
print(accuracy_score(y_predict, y_test))
这篇关于置信规则库推理的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!