[NameError:未定义名称'print_rows'

问题描述 投票:1回答:1

谢谢您的帮助!我正在训练基于VGG的声音分类器模型。我从苹果那里得到了原始代码:'https://apple.github.io/turicreate/docs/userguide/sound_classifier/'。

错误显示“ NameError:未定义名称'print_rows'”。

我要打印混淆矩阵。

我使用了“ print_rows”,因为在控制台中被告知:“您可以使用print_rows(num_rows = m,num_columns = n)打印更多的行和列。

任何人都知道缺少什么吗?高度赞赏。

import turicreate as tc
import numpy as np
import matplotlib as mb
import pandas as pd
import seaborn as sb
import tqdm as tqdm

from os.path import basename

# Load the audio data and meta data.
data = tc.load_audio('./Desktop/TP/newtracks_wav_cropped')
meta_data = tc.SFrame.read_csv('./Desktop/TP/Tracks/file.csv')

# Join the audio data and the meta data.
data['filename'] = data['path'].apply(lambda p: basename(p))
data = data.join(meta_data)
data

#Drop all records which are not part of the ESC-10.
#data = data.filter_by('True', 'esc10')

# Make a train-test split, just use the first fold as our test set.
test_set = data.filter_by(1, 'fold')
train_set = data.filter_by(1, 'fold', exclude=True)

#print(np.unique(test_set))

# Create the model.
model = tc.sound_classifier.create(train_set, target='situation', feature='audio')

# Generate an SArray of predictions from the test set.
predictions = model.predict(test_set)

# Evaluate the model and print the results
metrics = model.evaluate(test_set)
print(metrics)
print_rows(num_row=52, num_columns=3)

# Save the model for later use in Turi Create
model.save('musicclassifier_apple_1.model')

# Export for use in Core ML
model.export_coreml('musicclassifier_apple_1')

谢谢您的帮助!我正在训练基于VGG的声音分类器模型。我从苹果那里得到了原始代码:'https://apple.github.io/turicreate/docs/userguide/sound_classifier/。错误显示为“ ...

python printing confusion-matrix
1个回答
0
投票

turicreate的文档是python样式的垃圾,但是您可以这样操作:

© www.soinside.com 2019 - 2024. All rights reserved.