<jupyter_start><jupyter_text>Settings<jupyter_code>classical_features_path = 'C:\\Users\\alext\\Desktop\\School\\2021 Spring\\CS 271\\Final Project\\Feature Extraction\\Classical\\Classical Features.csv'
jazz_features_path = 'C:\\Users\\alext\\Desktop\\School\\2021 Spring\\CS 271\\Final Project\\Feature Extraction\\Jazz\\Jazz Features.csv'

# Set the plot font
font = {'family' : 'DejaVu Sans',
        'size'   : 18}

matplotlib.rc('font', **font)<jupyter_output><empty_output><jupyter_text>Normalize Feature Vectors<jupyter_code>def normalize_features(features):
    # Compute the mean and varience of each feature
    scaler = StandardScaler().fit(features)
    # Use the computed values to normalize the features
    normalized_features = scaler.transform(features)
    
    return normalized_features<jupyter_output><empty_output><jupyter_text>Plot All Feature<jupyter_code>def plot_all_features(group1, group2, num_experiments):
    # Assume all experiments contain the same number of features
    num_features = len(group1[0])
    
    # Set the plot size
    figure(figsize=(8, 6), dpi=80)
    
    # Plot each feature of each sample
    for feature in range(num_features):
        for experiment in range(num_experiments):
            plot.scatter(feature, group1[experiment][feature], color='red', alpha=0.5)
            plot.scatter(feature, group2[experiment][feature], color='blue', alpha=0.5)
    
    # Set the plot title
    plot.title('All Features 0-{}'.format(num_features))
    
    # Hide the y-azis lables
    ax = plot.gca()
    ax.axes.yaxis.set_visible(False)
    
    # set the range of the y axis
    plot.ylim([-9, 9])
    
    # Display the plot
    plot.show()<jupyter_output><empty_output><jupyter_text>Visualize the Data<jupyter_code># Load the data set features
classical_features = genfromtxt(classical_features_path, delimiter=',')
jazz_features = genfromtxt(jazz_features_path, delimiter=',')

# Normalize the features
classical_normalized = normalize_features(classical_features)
jazz_normalized = normalize_features(jazz_features) 

plot_all_features(classical_normalized, jazz_normalized, 5)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11100832562442182, 'fraction_numerical': 0.01572617946345976, 'mean_word_length': 4.517857142857143, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '364718', 'license': 'MIT', 'n_tokens_mistral': 726, 'n_tokens_neox': 685, 'n_words': 146, 'path': 'Classification/Feature Visualization.ipynb', 'repo_name': 'CS-271-Final-Project/Music-Generation-AI', 'size': '2162'}