Skip to content

Commit

Permalink
deploy: b4f1a71
Browse files Browse the repository at this point in the history
  • Loading branch information
tianxuzhang committed Dec 20, 2023
1 parent 531881f commit 4dc73a7
Show file tree
Hide file tree
Showing 7 changed files with 464 additions and 27 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
228 changes: 219 additions & 9 deletions _sources/docs/分类/决策树.ipynb

Large diffs are not rendered by default.

191 changes: 176 additions & 15 deletions docs/分类/决策树.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/回归/被动攻击算法.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ <h1>被动攻击算法<a class="headerlink" href="#id1" title="Permalink to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>预测结果: [11.8500034 13.80000328]
<div class="output stream highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>预测结果: [11.85000366 13.80000353]
</pre></div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/降维/LDA和QDA.html
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ <h2>LDA vs QDA<a class="headerlink" href="#lda-vs-qda" title="Permalink to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_2275/3074259613.py:16: MatplotlibDeprecationWarning: The register_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps.register(name)`` instead.
<div class="output stderr highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>/tmp/ipykernel_2289/3074259613.py:16: MatplotlibDeprecationWarning: The register_cmap function was deprecated in Matplotlib 3.7 and will be removed two minor releases later. Use ``matplotlib.colormaps.register(name)`` instead.
plt.cm.register_cmap(cmap=cmap)
</pre></div>
</div>
Expand Down
66 changes: 66 additions & 0 deletions reports/docs/分类/决策树.err.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Traceback (most recent call last):
File "/home/runner/.local/lib/python3.10/site-packages/jupyter_cache/executors/utils.py", line 58, in single_nb_execution
executenb(
File "/home/runner/.local/lib/python3.10/site-packages/nbclient/client.py", line 1305, in execute
return NotebookClient(nb=nb, resources=resources, km=km, **kwargs).execute()
File "/home/runner/.local/lib/python3.10/site-packages/jupyter_core/utils/__init__.py", line 172, in wrapped
return loop.run_until_complete(inner)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/runner/.local/lib/python3.10/site-packages/nbclient/client.py", line 705, in async_execute
await self.async_execute_cell(
File "/home/runner/.local/lib/python3.10/site-packages/nbclient/client.py", line 1058, in async_execute_cell
await self._check_raise_for_error(cell, cell_index, exec_reply)
File "/home/runner/.local/lib/python3.10/site-packages/nbclient/client.py", line 914, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import export_graphviz
import pydotplus
import matplotlib.pyplot as plt

# 加载数据
data = load_iris()
X = data.data
y = data.target

# 划分训练集和测试集
X_train, X_test, y_train, _ = train_test_split(X, y, test_size=0.2, random_state=42)

# 创建随机森林分类器
model = RandomForestClassifier()

# 训练模型
model.fit(X_train, y_train)

# 可视化决策树(第一棵树)
estimator = model.estimators_[0]
dot_data = export_graphviz(estimator, out_file=None, feature_names=data.feature_names,
class_names=data.target_names, filled=True, rounded=True)
graph = pydotplus.graph_from_dot_data(dot_data)

# 保存为图像文件
graph.write_png('random_forest_tree.png')

# 使用matplotlib显示图像
plt.figure(figsize=(10, 10))
plt.imshow(plt.imread('random_forest_tree.png'))
plt.axis('off')
plt.show()
------------------


---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[3], line 5
 3 from sklearn.model_selection import train_test_split
 4 from sklearn.tree import export_graphviz
----> 5 import pydotplus
 6 import matplotlib.pyplot as plt
 8 # 加载数据

ModuleNotFoundError: No module named 'pydotplus'

2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 4dc73a7

Please sign in to comment.