NameError: имя 'print_rows' не определено - PullRequest
0 голосов
/ 28 октября 2019

Спасибо за помощь! Я тренирую модель классификатора звука на основе VGG. Я получил исходный код от Apple: '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')
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...