我对数据集进行了二进制分类,以确定是否存在泄漏。我分别应用了3种ML算法来比较性能,即朴素贝叶斯算法、随机森林算法和decision tree.for决策树分类器。我执行了以下代码,其中s1到s20是传感器值如何绘制误差分析graph.Since我的预测输出为0或1
#creating features and labels
n_features = list(zip(s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20))
n_samples = status
#Decision tree regression
clf = tree.DecisionTreeRegressor()
#spliting of data
X_train, X_test, y_train, y_test = train_test_split(n_features,n_samples, test_size=0.5,random_state=0)
sc = StandardScaler()
X_train_std = sc.fit_transform(X_train)
X_test_std = sc.fit_transform(X_test)
#train model
clf.fit(X_train,y_train)
#prediction
y_pred = clf.predict(X_test_std)
print('percentage Accuracy:',100*metrics.accuracy_score(y_test,y_pred))发布于 2020-03-02 18:56:30
创建一个名为model_performance_df的数据帧。添加您使用Naive Bayes, RandomForest and DecisionTree作为数据帧中的列名的机器学习算法。为数据帧中的每个算法添加这些性能指标。
使用可视化库matplotlib或seaborn来绘制您喜欢的图形。例如,尝试使用Histogram或Distribution plot。
https://stackoverflow.com/questions/60484535
复制相似问题