<jupyter_start><jupyter_text>貝式定理https://ithelp.ithome.com.tw/articles/10205582?sc=iThelpRhttps://mropengate.blogspot.com/2015/06/ai-ch14-3-naive-bayes-classifier.htmlhttps://fu-sheng-wang.blogspot.com/2017/03/ai231-naive-bayes-classifier.html<jupyter_code>from sklearn import tree
from sklearn import svm
from sklearn.naive_bayes import GaussianNB
clf=tree.DecisionTreeClassifier()
# clf=svm.LinearSVC()
# clf=GaussianNB()
bagging=BaggingClassifier(base_estimator=clf,n_estimators=10,
                          bootstrap=True,bootstrap_features=True,max_features=3,max_samples=0.7)
bagging.fit(X_train,y_train)
bagging.predict(X_test)
bagging.score(X_train,y_train)
bagging.score(X_test,y_test)
plt.scatter(X[:,2],X[:,3],c=y)
plt.scatter(X[:,2],X[:,3],c=bagging.predict(X))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15298507462686567, 'fraction_numerical': 0.043532338308457715, 'mean_word_length': 7.473684210526316, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '480883', 'license': 'MIT', 'n_tokens_mistral': 361, 'n_tokens_neox': 334, 'n_words': 23, 'path': 'Unit06/2.1_Bagging.ipynb', 'repo_name': 'appletime81/IMLP', 'size': '804'}