<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Analysis Notebook
Analysis for each of [cqt/wcqt/hcqt], and then comparison between them.
Step1:  First, select a model for each
Make sure you have done model selection, prediction, and analysis for each model
As follows
Step2:  CQT Analysis
Step3:  WCQT Analysis
HCQT Analysis
<ASSISTANT_TASK:>
Python Code:
## General Functions & Data Loading
import claudio
import librosa
import numpy as np
import os
import pandas
import pprint
import hcnn.common.config as C
import hcnn.common.utils as utils
import hcnn.train.analyze
import hcnn.train.models
%matplotlib inline
import seaborn
import mpld3
import matplotlib.pyplot as plt
seaborn.set()
np.set_printoptions(precision=4, suppress=True)
mpld3.enable_notebook()
config = C.Config.from_yaml("./data/master_config.yaml")
# Paths
models_dir = os.path.expanduser(config["paths/model_dir"])
datasets_file = config['dataframes/datasets']
notes_file = config['dataframes/notes']
features_df_fn = config['dataframes/features']
datasets_path = os.path.join(extract_path, datasets_file)
notes_path = os.path.join(extract_path, notes_file)
features_path = os.path.join(extract_path, features_df_fn)
# Load DataFrames
datasets_df = pandas.read_json(datasets_path)
notes_df = pandas.read_pickle(notes_path)
features_df = pandas.read_pickle(features_path)
def analyze_experiment(modeldef, name):
    analysis_file = os.path.join(models_dir, modeldef[0], config['experiment/analysis_format'].format(modeldef[1]))
    analysis = wcqtlib.train.analyze.PredictionAnalyzer.load(analysis_file)
    # Overall Results
#     summary_scores = analysis.dataset_summary()
#     plt.figure()
#     summary_scores.dropna().T.plot.bar()
    
    class_scores = analysis.dataset_class_wise()
    print(class_scores)
#     plt.figure()
#     class_scores.dropna().plot.bar()
Explanation: Analysis Notebook
Analysis for each of [cqt/wcqt/hcqt], and then comparison between them.
End of explanation
available_models = wcqtlib.train.models.list_models(config)
pprint.pprint(available_models)
# FILL IN YOUR SELECTED MODEL HERE
#  In the form (model_name, )
cqt_model = ("exp005", "final")
wcqt_model = ""
hcqt_model = ""
Explanation: First, select a model for each
Make sure you have done model selection, prediction, and analysis for each model
As follows:
```
python manage.py model_selection <experiment_name> 
python manage.py predict <experiment_name> 
python manage.py analyze <experiment_name> 
```
End of explanation
analyze_experiment(cqt_model, "CQT")
Explanation: CQT Analysis
End of explanation
import pandas as pd
import os
import json
results_dir = "./results"
def load_results(model_name):
    selected_model = model_name
    model_dir = os.path.join(results_dir, selected_model)
    results_json = os.path.join(model_dir, "experiment_results.json")
    with open(results_json, 'r') as fh:
        results = json.load(fh)
    return pd.DataFrame(results)
    
MF_resutls = load_results("cqt_MF_n16")
M2_results = load_results("cqt_M2_n8")
MH_results = load_results("hcqt_MH_n8")
MF_resutls.T[["mean_accuracy", "mean_precision", "mean_recall", "mean_f1"]]
M2_results.T[["mean_accuracy", "mean_precision", "mean_recall", "mean_f1"]]
MH_results.T[["mean_accuracy", "mean_precision", "mean_recall", "mean_f1"]]
def load_loss(model_name, hold_out):
    selected_model = model_name
    loss_dir = os.path.join(results_dir, selected_model, hold_out)
    training_loss_fp = os.path.join(loss_dir, "training_loss.pkl")
    validation_loss_fp = os.path.join(loss_dir, "validation_loss.pkl")
    training_loss = pd.read_pickle(training_loss_fp)
    validation_loss = pd.read_pickle(validation_loss_fp)
    return training_loss, validation_loss
%matplotlib inline
import seaborn
# import mpld3
seaborn.set()
np.set_printoptions(precision=4, suppress=True)
# mpld3.enable_notebook()
import matplotlib.pyplot as plt
training_loss, validation_loss = load_loss("cqt_MF_n16", "philharmonia")
plt.plot(training_loss['iteration'], training_loss['loss'])
# plt.plot(validation_loss['model_iteration'], validation_loss['mean_loss'])
plt.plot(validation_loss['model_iteration'], validation_loss['f1_weighted'])
plt.show()
Explanation: WCQT Analysis
HCQT Analysis
End of explanation
<END_TASK>