Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
deep learning python
#1
WHat does x_train, y_train = zip(*train) mean? WHat does the "zip" and the asterick mean? How are they dividing X and Y ?

for x in range(40):
    
    y, sr = librosa.load('C:/audio files/folderCat/'  + str(x)+'.wav',   
    duration=2.95)  
    ps = librosa.feature.melspectrogram(y=y, sr=sr)
    
    if ps.shape != (128, 128): continue
    #print(ps.shape)
    D.append( (ps, 1) )

#print(D)

for x in range(40):
    
    y, sr = librosa.load('C:/audio files/folderDog/' +  str(x)+'.wav',  
    duration=2.95)  
    ps = librosa.feature.melspectrogram(y=y, sr=sr)
    if ps.shape != (128, 128): continue
    D.append( (ps, 2) )

print("Number of samples: ", len(D))

#print(D)
dataset = D
random.shuffle(dataset)

train = dataset[:20]
test = dataset[20:40]
x_train, y_train = zip(*train)
x_test, y_test = zip(*test)
Larz60+ write Sep-26-2021, 02:02 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply


Messages In This Thread
deep learning python - by Stevedas - Sep-25-2021, 10:15 PM
RE: deep learning python - by Yoriz - Sep-26-2021, 08:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Teacher (thrown in at the deep end - help) Mr90 2 3,071 May-23-2018, 02:04 PM
Last Post: DeaD_EyE
  Teacher (thrown in at the deep end - help) Mr90 5 4,009 May-22-2018, 01:08 PM
Last Post: DeaD_EyE
  Parse XML - how to handle deep levels/hierarchy dwill 8 9,716 Apr-17-2018, 04:17 PM
Last Post: dwill

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020