• 大小: 3.4MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-10
  • 语言: Python
  • 标签: 人工智能  

资源简介

使用python实现了各种机器学习的算法,也有通过tensorflow实现CNN

资源截图

代码片段和文件信息

import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
from sklearn.metrics import classification_report

# Define sample labels
true_labels = [2 0 0 2 4 4 1 0 3 3 3]
pred_labels = [2 1 0 2 4 3 1 0 1 3 3]

# Create confusion matrix
confusion_mat = confusion_matrix(true_labels pred_labels)

# Visualize confusion matrix
plt.imshow(confusion_mat interpolation=‘nearest‘ cmap=plt.cm.gray)
plt.title(‘Confusion matrix‘)
plt.colorbar()
ticks = np.arange(5)
plt.xticks(ticks ticks)
plt.yticks(ticks ticks)
plt.ylabel(‘True labels‘)
plt.xlabel(‘Predicted labels‘)
plt.show()

# Classification report
targets = [‘Class-0‘ ‘Class-1‘ ‘Class-2‘ ‘Class-3‘ ‘Class-4‘]
print(‘\n‘ classification_report(true_labels pred_labels target_names=targets))


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\
     目录           0  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\
     目录           0  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\
     文件         810  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\confusion_matrix.py
     文件        4820  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\data_multivar_nb.txt
     文件       14445  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\data_multivar_regr.txt
     文件        1148  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\data_preprocessor.py
     文件         622  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\data_singlevar_regr.txt
     文件        1184  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\house_prices.py
     文件        2582  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\income_classifier.py
     文件     3974305  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\income_data.txt
     文件         813  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\label_encoder.py
     文件         671  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\logistic_regression.py
     文件        2172  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\naive_bayes.py
     文件        1745  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\regressor_multivar.py
     文件        1798  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\regressor_singlevar.py
     文件        1386  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 02\code\utilities.py
     目录           0  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\
     目录           0  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\
     文件        2013  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\class_imbalance.py
     文件        4250  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\data_decision_trees.txt
     文件       17674  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\data_imbalance.txt
     文件       10645  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\data_random_forests.txt
     文件        1720  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\decision_trees.py
     文件        1800  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\feature_importance.py
     文件        1645  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\grid_search.py
     文件        3388  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\random_forests.py
     文件        1645  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\run_grid_search.py
     文件      526911  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\traffic_data.txt
     文件        1987  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\traffic_prediction.py
     文件        1441  2017-03-27 10:14  Artificial-Intelligence-with-Python-master\Chapter 03\code\utilities.py
............此处省略261个文件信息

评论

共有 条评论