<jupyter_start><jupyter_text>بررسی رفتار داده‌ها<jupyter_code>s1 = data[data['diagnosis'] == 'M'].describe().min()
s2 = data[data['diagnosis'] == 'M'].describe().max()
df_malignant = pd.DataFrame(pd.concat([s1,s2],axis = 1))
df_malignant.rename(columns = {0:'min',1:'Max'})
s1 = data[data['diagnosis'] == 'B'].describe().min()
s2 = data[data['diagnosis'] == 'B'].describe().max()
df_malignant = pd.DataFrame(pd.concat([s1,s2],axis = 1))
df_malignant.rename(columns = {0:'min',1:'Max'})<jupyter_output><empty_output><jupyter_text>به کارگیری مدل درخت<jupyter_code>X = data.drop('diagnosis',axis = 1)
y = data['diagnosis'].map({'M':1,'B':0})
X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
tree_model = DecisionTreeClassifier(criterion = 'entropy', max_depth= 4)
tree_model.fit(X_train,y_train)
y_predicted = tree_model.predict(X_test)
accuracy_score(y_predicted,y_test)<jupyter_output><empty_output><jupyter_text>تلاش برای کشیدن درخت<jupyter_code># import graphviz
# dot_data = export_graphviz(tree_model, out_file=None, 
#                       feature_names=X.columns,  
#                       class_names=['0','1'],  
#                       filled=True, rounded=True)  
# graph = graphviz.Source(dot_data)

# png_bytes = graph.pipe(format='png')
# with open('tree_graph.png','wb') as f:
#     f.write(png_bytes)
#     f.close()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18398268398268397, 'fraction_numerical': 0.015151515151515152, 'mean_word_length': 5.668269230769231, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '401186', 'license': 'MIT', 'n_tokens_mistral': 597, 'n_tokens_neox': 566, 'n_words': 69, 'path': 'decision_tree_cancer_dataset.ipynb', 'repo_name': 'mmehrani/Decision_Tree_cancer_dataset', 'size': '1386'}