def _load_sklearn_default_classifier():
if sys.version_info[0] == 2:
file_name = "sklearn_classifier_py2.pklz"
protocol = 2
else:
file_name = "sklearn_classifier_py3.pklz"
protocol = 3
file_path = resource_filename('sudokuextract.data', file_name)
if resource_exists('sudokuextract.data', file_name):
f = gzip.open(file_path, 'rb')
classifier = pickle.load(f)
f.close()
else:
classifier = KNeighborsClassifier(n_neighbors=10)
classifier = fit_combined_classifier(classifier)
f = gzip.open(file_path, 'wb')
pickle.dump(classifier, f, protocol=protocol)
f.close()
return classifier
评论列表
文章目录