#!/usr/bin/env python
# coding: utf-8
# In[1]:
from sklearn.metrics import confusion_matrix
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# In[2]:
train_data = pd.read_csv('mnist_train.csv')
train_data.dropna(inplace=True)
train_feature = []
mid_data = np.array(train_data)
for i in mid_data:
train_feature.append(i[1:])
train_label = (mid_data.T)[0]
print(len(train_feature),len(train_label))
print(train_feature[0].shape)
# In[3]:
test_data = pd.read_csv('mnist_test.csv')
test_data.dropna(inplace=True)
test_feature = []
mid_data = np.array(test_data)
for i in mid_data:
test_feature.append(i[1:])
test_label
knn算法实现mnist分类
最新推荐文章于 2022-10-15 19:04:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)