def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument("-f", "--file-path", help="Path to the audio file")
    parser.add_argument("-a",
                        "--artist",
                        help="Name of the artist of the song")
    parser.add_argument("-t", "--title", help="title of the song")

    args = parser.parse_args()
    if args.file_path is None or not os.path.exists(args.file_path):
        print("invalid file path")
        return
    if args.artist is None:
        print("no artist provided")
        return
    if args.title is None:
        print("no title provided")
        return

    md = MusicData(args.file_path, title=args.title, artist=args.artist)
    md.detect_beats()
    md.detect_onsets()
    md.save_beat_diagram()
    md.save_onsets_diagram()
    upload_files_s3(args.file_path)
    save_to_dynamodb(md)
from gradient_descent import plot_history, plot_history_train_validation
from music_data import MusicData
from normal_equation import solve_normal_equation
from normalize import z_norm
import numpy as np
from compute_accuracy import compute_accuracy, compute_accuracy_year

if __name__ == '__main__':
    '''
    Read music data.
    '''

    print "Loading data."
    #music_train = MusicData("resources/YearPredictionMSD_samples_train.txt")
    #music_test = MusicData("resources/YearPredictionMSD_samples_test.txt")
    music_train = MusicData("resources/YearPredictionMSD_train.txt")
    #music_train.add_features(2)
    #music_test.add_features(max_degree)
    #music_validation.add_features(max_degree)

    # Normalize data.
    print "Normalize data."
    #music_train.X = z_norm(music_train.X)

    #music_validation = MusicData("resources/YearPredictionMSD_validation.txt")
    #music_test = MusicData("resources/YearPredictionMSD_test.txt")

    year1 = 1985
    year2 = 2000

    for year1 in range(1980, 2010):
Exemple #3
0
from compute_cost import compute_cost
from gradient_descent import gradient_descent, gradient_descent_with_J_history, \
    plot_history
from music_data import MusicData
from normal_equation import solve_normal_equation
from normalize import z_norm, z_norm_by_feature

if __name__ == '__main__':
    '''
    Read music data.
    '''

    print "Loading data."
    # music_train = MusicData("resources/YearPredictionMSD_samples_train.txt")
    # music_test = MusicData("resources/YearPredictionMSD_samples_test.txt")
    music_train = MusicData("resources/YearPredictionMSD_train.txt")
    music_validation = MusicData("resources/YearPredictionMSD_validation.txt")
    music_test = MusicData("resources/YearPredictionMSD_test.txt")

    # Normalize data.
    print "Normalize data."
    # music_train.X = z_norm(music_train.X)
    # music_validation.X = z_norm(music_validation.X)
    # music_test.X = z_norm(music_test.X)
    music_train.balance_data_oversampling_smote_regular()
    music_train.X, mean_X, std_X = z_norm_by_feature(music_train.X)
    #music_train.balance_data_undersampling_custom()
    music_validation.X = z_norm_by_feature(music_validation.X, mean_X, std_X)
    music_test.X = z_norm_by_feature(music_test.X, mean_X, std_X)

    # Balacing train data.
from gradient_descent import plot_history, plot_history_train_validation
from music_data import MusicData
from normal_equation import solve_normal_equation
from normalize import z_norm
import numpy as np


if __name__ == '__main__':
    '''
    Read music data.
    '''
    
    print "Loading data."
    #music_train = MusicData("resources/YearPredictionMSD_samples_train.txt")
    #music_test = MusicData("resources/YearPredictionMSD_samples_test.txt")
    music_train = MusicData("resources/YearPredictionMSD_train.txt")
    music_validation = MusicData("resources/YearPredictionMSD_validation.txt")
    music_test = MusicData("resources/YearPredictionMSD_test.txt")
    max_degree = 3
    
    # Add polynomial features.
    print "Adding polynomial features."
    music_train.add_features(max_degree)
    music_test.add_features(max_degree)
    music_validation.add_features(max_degree)
    
    ## Normalize data.    
    print "Normalize data."
    #music_train.X = z_norm(music_train.X)
    #music_validation.X = z_norm(music_validation.X)
    #music_test.X = z_norm(music_test.X)
Exemple #5
0
from compute_cost import compute_cost
from gradient_descent import plot_history, plot_history_train_validation
from music_data import MusicData
from normal_equation import solve_normal_equation
from normalize import z_norm, z_norm_by_feature
import numpy as np

if __name__ == '__main__':
    '''
    Read music data.
    '''

    print "Loading data."
    # music_train = MusicData("resources/YearPredictionMSD_samples_train.txt")
    # music_test = MusicData("resources/YearPredictionMSD_samples_test.txt")
    music_train = MusicData("resources/YearPredictionMSD_train.txt")
    music_validation = MusicData("resources/YearPredictionMSD_validation.txt")
    music_test = MusicData("resources/YearPredictionMSD_test.txt")
    max_degree = 3

    # Add polynomial features.
    print "Adding polynomial features."
    music_train.add_features(max_degree)
    music_test.add_features(max_degree)
    music_validation.add_features(max_degree)

    # Normalize data.
    print "Normalize data."
    # music_train.X = z_norm(music_train.X)
    # music_validation.X = z_norm(music_validation.X)
    # music_test.X = z_norm(music_test.X)