{ "cells": [ { "cell_type": "markdown", "id": "a2096734", "metadata": {}, "source": [ "# Data preprocessing - Extracting IDyOM output data\n", "\n", "This tutorial will cover how to extract certain IDyOM outputs (for analysis in python) and export them in different\n", "formats using py2lispIDyOM, given that you already have the `.dat` file output. For an overview of the py2lispIDyOM functionality, see the [README](../README.md).\n", "\n" ] }, { "cell_type": "markdown", "id": "f03aa743", "metadata": {}, "source": [ "Given that you already have the `.dat` file output, you can extract certain properties of certain melodies from that file.\n", "\n", "We will continue the sample example as in the [1_running_IDyOM_tutorial.ipynb](1_running_IDyOM_tutorial.ipynb), and extract some IDyOM outputs from that experiment, where the log folder is `experiment_history/21-05-22_17.05.05/`\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "333ce80d", "metadata": {}, "outputs": [], "source": [ "# import ExperimentInfo from extract module\n", "import py2lispIDyOM as py2lispIDyOM\n", "from py2lispIDyOM.extract import ExperimentInfo" ] }, { "cell_type": "markdown", "id": "95f4a397", "metadata": {}, "source": [ "## 1. Indicate the experiment log folder that you want to work with:\n", "\n", "To start, users need to indicate the experiment log folder that you want to work with by providing the log\n", "path `experiment_folder_path`. " ] }, { "cell_type": "code", "execution_count": 2, "id": "148ebeef", "metadata": {}, "outputs": [], "source": [ "# Set experiment_folder_path:\n", "my_experiment = ExperimentInfo(experiment_folder_path='experiment_history/21-05-22_17.05.05/')\n" ] }, { "cell_type": "markdown", "id": "0964280f", "metadata": {}, "source": [ "## 2. Experiment Info: to access some melodies in that experiment:\n", "\n", "There are two ways to access melodies in the experiment:\n", "1. Access a specific melody using `melodies_dict` by passing the melody name.\n", " - This returns a DataFrame of all IDyOM outputs for this melody.\n", " \n", " \n", "2. Access specific melodies using the method `access_melodies(starting_index=None, ending_index=None, melody_names=None)` \n", " - This returns a list of DataFrame of all IDyOM outputs for selected melodies.\n", " " ] }, { "cell_type": "markdown", "id": "01784ea0", "metadata": {}, "source": [ "### 2.1 Access a melody using `melodies_dict`:\n" ] }, { "cell_type": "code", "execution_count": 3, "id": "daf2adc2", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " dataset.id melody.id note.id melody.name vertint12 articulation \\\n", "0 6.605212e+13 12.0 1.0 \"chor-012\" NA 0.0 \n", "1 6.605212e+13 12.0 2.0 \"chor-012\" NA 0.0 \n", "2 6.605212e+13 12.0 3.0 \"chor-012\" NA 0.0 \n", "3 6.605212e+13 12.0 4.0 \"chor-012\" NA 0.0 \n", "4 6.605212e+13 12.0 5.0 \"chor-012\" NA 0.0 \n", "5 6.605212e+13 12.0 6.0 \"chor-012\" NA 0.0 \n", "6 6.605212e+13 12.0 7.0 \"chor-012\" NA 0.0 \n", "7 6.605212e+13 12.0 8.0 \"chor-012\" NA 0.0 \n", "8 6.605212e+13 12.0 9.0 \"chor-012\" NA 0.0 \n", "9 6.605212e+13 12.0 10.0 \"chor-012\" NA 0.0 \n", "10 6.605212e+13 12.0 11.0 \"chor-012\" NA 0.0 \n", "11 6.605212e+13 12.0 12.0 \"chor-012\" NA 0.0 \n", "12 6.605212e+13 12.0 13.0 \"chor-012\" NA 0.0 \n", "13 6.605212e+13 12.0 14.0 \"chor-012\" NA 0.0 \n", "14 6.605212e+13 12.0 15.0 \"chor-012\" NA 0.0 \n", "15 6.605212e+13 12.0 16.0 \"chor-012\" NA 0.0 \n", "16 6.605212e+13 12.0 17.0 \"chor-012\" NA 0.0 \n", "17 6.605212e+13 12.0 18.0 \"chor-012\" NA 0.0 \n", "18 6.605212e+13 12.0 19.0 \"chor-012\" NA 0.0 \n", "19 6.605212e+13 12.0 20.0 \"chor-012\" NA 0.0 \n", "20 6.605212e+13 12.0 21.0 \"chor-012\" NA 0.0 \n", "21 6.605212e+13 12.0 22.0 \"chor-012\" NA 0.0 \n", "22 6.605212e+13 12.0 23.0 \"chor-012\" NA 0.0 \n", "23 6.605212e+13 12.0 24.0 \"chor-012\" NA 0.0 \n", "24 6.605212e+13 12.0 25.0 \"chor-012\" NA 0.0 \n", "25 6.605212e+13 12.0 26.0 \"chor-012\" NA 0.0 \n", "26 6.605212e+13 12.0 27.0 \"chor-012\" NA 0.0 \n", "27 6.605212e+13 12.0 28.0 \"chor-012\" NA 0.0 \n", "28 6.605212e+13 12.0 29.0 \"chor-012\" NA 0.0 \n", "29 6.605212e+13 12.0 30.0 \"chor-012\" NA 0.0 \n", "30 6.605212e+13 12.0 31.0 \"chor-012\" NA 0.0 \n", "\n", " comma voice ornament dyn ... onset.18 onset.24 onset.36 onset.48 \\\n", "0 0.0 1.0 0.0 NA ... 0.069163 0.108389 0.089951 0.130606 \n", "1 0.0 1.0 0.0 NA ... 0.215268 0.083398 0.023693 0.040086 \n", "2 0.0 1.0 0.0 NA ... 0.064587 0.535028 0.080391 0.048375 \n", "3 0.0 1.0 0.0 NA ... 0.121740 0.356607 0.024939 0.029701 \n", "4 0.0 1.0 0.0 NA ... 0.005699 0.192398 0.015870 0.016998 \n", "5 0.0 1.0 0.0 NA ... 0.113231 0.077657 0.077657 0.080017 \n", "6 0.0 1.0 0.0 NA ... 0.028371 0.105038 0.013260 0.016347 \n", "7 0.0 1.0 0.0 NA ... 0.267783 0.091818 0.032460 0.042607 \n", "8 0.0 1.0 0.0 NA ... 0.011060 0.196659 0.024893 0.028715 \n", "9 0.0 1.0 0.0 NA ... 0.193435 0.023433 0.023433 0.026460 \n", "10 0.0 1.0 0.0 NA ... 0.011080 0.166016 0.028406 0.032707 \n", "11 0.0 1.0 0.0 NA ... 0.066150 0.117944 0.045238 0.056585 \n", "12 0.0 1.0 0.0 NA ... 0.014655 0.648461 0.010516 0.010516 \n", "13 0.0 1.0 0.0 NA ... 0.046266 0.315797 0.046266 0.086085 \n", "14 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "15 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "16 0.0 1.0 0.0 NA ... 0.036796 0.429145 0.036796 0.116969 \n", "17 0.0 1.0 0.0 NA ... 0.032738 0.507358 0.032738 0.032738 \n", "18 0.0 1.0 0.0 NA ... 0.048937 0.048937 0.048937 0.048937 \n", "19 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "20 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "21 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "22 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "23 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "24 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "25 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "26 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "27 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "28 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "29 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "30 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "\n", " onset.72 onset.120 probability information.content entropy \\\n", "0 0.130606 0.125256 0.004055 7.945978 8.166577 \n", "1 0.040086 0.037790 0.005786 7.433325 7.022451 \n", "2 0.048375 0.048375 0.031582 4.984756 4.881182 \n", "3 0.028123 0.009872 0.011077 6.496335 5.746488 \n", "4 0.018125 0.018125 0.048472 4.366702 5.291978 \n", "5 0.043719 0.072700 0.007871 6.989316 7.123601 \n", "6 0.051517 0.048669 0.019845 5.655067 5.447203 \n", "7 0.040106 0.042607 0.002457 8.669009 5.044505 \n", "8 0.471100 0.032497 0.002324 8.748941 5.526692 \n", "9 0.024948 0.008068 0.001581 9.304609 6.056644 \n", "10 0.034855 0.006698 0.047587 4.393278 5.147671 \n", "11 0.020384 0.016922 0.047720 4.389259 5.703556 \n", "12 0.008438 0.008438 0.000582 10.747887 3.765447 \n", "13 0.086085 0.086085 0.001754 9.154955 5.892540 \n", "14 0.096666 0.041449 0.034336 4.864124 7.016802 \n", "15 0.096666 0.041449 0.032692 4.934914 6.382860 \n", "16 0.036796 0.036796 0.004449 7.812364 4.985937 \n", "17 0.032738 0.032738 0.221689 2.173392 5.078086 \n", "18 0.048937 0.048937 0.006712 7.219008 4.581941 \n", "19 0.071475 0.071475 0.004367 7.839179 6.053847 \n", "20 0.071475 0.071475 0.005319 7.554738 5.934624 \n", "21 0.071475 0.071475 0.048676 4.360633 5.152714 \n", "22 0.071475 0.071475 0.041270 4.598770 5.460558 \n", "23 0.071475 0.071475 0.019223 5.701044 6.356779 \n", "24 0.071475 0.071475 0.021635 5.530499 5.941483 \n", "25 0.071475 0.071475 0.003628 8.106473 5.508440 \n", "26 0.071475 0.071475 0.018458 5.759634 6.264733 \n", "27 0.071475 0.071475 0.011388 6.456328 6.271060 \n", "28 0.071475 0.071475 0.054201 4.205528 4.788754 \n", "29 0.071475 0.071475 0.047520 4.395319 5.136540 \n", "30 0.071475 0.071475 0.031558 4.985858 5.510000 \n", "\n", " information.gain \n", "0 NA \n", "1 1.122545 \n", "2 2.702558 \n", "3 0.942574 \n", "4 1.959542 \n", "5 1.994862 \n", "6 1.374084 \n", "7 2.161627 \n", "8 3.825893 \n", "9 2.76596 \n", "10 0.99575 \n", "11 0.902952 \n", "12 2.129932 \n", "13 1.16337 \n", "14 0.58589 \n", "15 0.271728 \n", "16 1.935903 \n", "17 0.683338 \n", "18 2.941365 \n", "19 2.065624 \n", "20 0.252211 \n", "21 0.972446 \n", "22 1.956564 \n", "23 0.937542 \n", "24 0.297714 \n", "25 0.63992 \n", "26 0.351777 \n", "27 0.143677 \n", "28 1.379553 \n", "29 2.574325 \n", "30 1.474449 \n", "\n", "[31 rows x 86 columns]\n" ] } ], "source": [ "# Access the melody named '\"chor-012\"' using `melodies_dict` by providing it melody name as the key\n", "\n", "selected_melody = my_experiment.melodies_dict['\"chor-012\"']\n", "\n", "print(selected_melody)" ] }, { "cell_type": "markdown", "id": "71e46913", "metadata": {}, "source": [ "### 2.2 Access a list of melodies using the `access_melodies` method by providing their names\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "65337f90", "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ dataset.id melody.id note.id melody.name vertint12 articulation \\\n", "0 6.605212e+13 10.0 1.0 \"chor-010\" NA 0.0 \n", "1 6.605212e+13 10.0 2.0 \"chor-010\" NA 0.0 \n", "2 6.605212e+13 10.0 3.0 \"chor-010\" NA 0.0 \n", "3 6.605212e+13 10.0 4.0 \"chor-010\" NA 0.0 \n", "4 6.605212e+13 10.0 5.0 \"chor-010\" NA 0.0 \n", "5 6.605212e+13 10.0 6.0 \"chor-010\" NA 0.0 \n", "6 6.605212e+13 10.0 7.0 \"chor-010\" NA 0.0 \n", "7 6.605212e+13 10.0 8.0 \"chor-010\" NA 0.0 \n", "8 6.605212e+13 10.0 9.0 \"chor-010\" NA 0.0 \n", "9 6.605212e+13 10.0 10.0 \"chor-010\" NA 0.0 \n", "10 6.605212e+13 10.0 11.0 \"chor-010\" NA 0.0 \n", "11 6.605212e+13 10.0 12.0 \"chor-010\" NA 0.0 \n", "12 6.605212e+13 10.0 13.0 \"chor-010\" NA 0.0 \n", "13 6.605212e+13 10.0 14.0 \"chor-010\" NA 0.0 \n", "14 6.605212e+13 10.0 15.0 \"chor-010\" NA 0.0 \n", "15 6.605212e+13 10.0 16.0 \"chor-010\" NA 0.0 \n", "16 6.605212e+13 10.0 17.0 \"chor-010\" NA 0.0 \n", "17 6.605212e+13 10.0 18.0 \"chor-010\" NA 0.0 \n", "18 6.605212e+13 10.0 19.0 \"chor-010\" NA 0.0 \n", "19 6.605212e+13 10.0 20.0 \"chor-010\" NA 0.0 \n", "20 6.605212e+13 10.0 21.0 \"chor-010\" NA 0.0 \n", "21 6.605212e+13 10.0 22.0 \"chor-010\" NA 0.0 \n", "22 6.605212e+13 10.0 23.0 \"chor-010\" NA 0.0 \n", "23 6.605212e+13 10.0 24.0 \"chor-010\" NA 0.0 \n", "24 6.605212e+13 10.0 25.0 \"chor-010\" NA 0.0 \n", "25 6.605212e+13 10.0 26.0 \"chor-010\" NA 0.0 \n", "26 6.605212e+13 10.0 27.0 \"chor-010\" NA 0.0 \n", "27 6.605212e+13 10.0 28.0 \"chor-010\" NA 0.0 \n", "28 6.605212e+13 10.0 29.0 \"chor-010\" NA 0.0 \n", "29 6.605212e+13 10.0 30.0 \"chor-010\" NA 0.0 \n", "30 6.605212e+13 10.0 31.0 \"chor-010\" NA 0.0 \n", "31 6.605212e+13 10.0 32.0 \"chor-010\" NA 0.0 \n", "32 6.605212e+13 10.0 33.0 \"chor-010\" NA 0.0 \n", "33 6.605212e+13 10.0 34.0 \"chor-010\" NA 0.0 \n", "34 6.605212e+13 10.0 35.0 \"chor-010\" NA 0.0 \n", "35 6.605212e+13 10.0 36.0 \"chor-010\" NA 0.0 \n", "36 6.605212e+13 10.0 37.0 \"chor-010\" NA 0.0 \n", "37 6.605212e+13 10.0 38.0 \"chor-010\" NA 0.0 \n", "38 6.605212e+13 10.0 39.0 \"chor-010\" NA 0.0 \n", "39 6.605212e+13 10.0 40.0 \"chor-010\" NA 0.0 \n", "40 6.605212e+13 10.0 41.0 \"chor-010\" NA 0.0 \n", "41 6.605212e+13 10.0 42.0 \"chor-010\" NA 0.0 \n", "42 6.605212e+13 10.0 43.0 \"chor-010\" NA 0.0 \n", "43 6.605212e+13 10.0 44.0 \"chor-010\" NA 0.0 \n", "44 6.605212e+13 10.0 45.0 \"chor-010\" NA 0.0 \n", "45 6.605212e+13 10.0 46.0 \"chor-010\" NA 0.0 \n", "\n", " comma voice ornament dyn ... onset.18 onset.24 onset.36 onset.48 \\\n", "0 0.0 1.0 0.0 NA ... 0.069163 0.108389 0.089951 0.130606 \n", "1 0.0 1.0 0.0 NA ... 0.215268 0.083398 0.023693 0.040086 \n", "2 0.0 1.0 0.0 NA ... 0.064587 0.535028 0.080391 0.048375 \n", "3 0.0 1.0 0.0 NA ... 0.121740 0.356607 0.024939 0.029701 \n", "4 0.0 1.0 0.0 NA ... 0.005699 0.192398 0.015870 0.016998 \n", "5 0.0 1.0 0.0 NA ... 0.113231 0.077657 0.077657 0.080017 \n", "6 0.0 1.0 0.0 NA ... 0.025687 0.029588 0.081991 0.029588 \n", "7 0.0 1.0 0.0 NA ... 0.002914 0.037882 0.004984 0.763103 \n", "8 0.0 1.0 0.0 NA ... 0.008422 0.536129 0.053373 0.062757 \n", "9 0.0 1.0 0.0 NA ... 0.156526 0.484888 0.016137 0.021628 \n", "10 0.0 1.0 0.0 NA ... 0.011060 0.196659 0.024893 0.028715 \n", "11 0.0 1.0 0.0 NA ... 0.193435 0.023433 0.023433 0.026460 \n", "12 0.0 1.0 0.0 NA ... 0.011080 0.166016 0.028406 0.032707 \n", "13 0.0 1.0 0.0 NA ... 0.066150 0.117944 0.045238 0.056585 \n", "14 0.0 1.0 0.0 NA ... 0.009579 0.022542 0.022542 0.009579 \n", "15 0.0 1.0 0.0 NA ... 0.007703 0.108186 0.007703 0.015280 \n", "16 0.0 1.0 0.0 NA ... 0.046266 0.315797 0.046266 0.086085 \n", "17 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "18 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "19 0.0 1.0 0.0 NA ... 0.064011 0.064011 0.168065 0.064011 \n", "20 0.0 1.0 0.0 NA ... 0.036796 0.429145 0.036796 0.116969 \n", "21 0.0 1.0 0.0 NA ... 0.032738 0.507358 0.032738 0.032738 \n", "22 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "23 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "24 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "25 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "26 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "27 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "28 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "29 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "30 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "31 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "32 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "33 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "34 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "35 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "36 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "37 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "38 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "39 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "40 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "41 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "42 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "43 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "44 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "45 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "\n", " onset.72 onset.120 probability information.content entropy \\\n", "0 0.130606 0.125256 0.006068 7.364515 8.166577 \n", "1 0.040086 0.037790 0.002263 8.787534 6.692070 \n", "2 0.048375 0.048375 0.083642 3.579631 6.746566 \n", "3 0.028123 0.009872 0.005905 7.403954 5.811079 \n", "4 0.018125 0.018125 0.057928 4.109587 5.192007 \n", "5 0.043719 0.072700 0.001214 9.685899 6.688033 \n", "6 0.057079 0.060216 0.002273 8.781099 6.412182 \n", "7 0.025572 0.027625 0.004173 7.904568 5.691120 \n", "8 0.072021 0.076614 0.095043 3.395275 6.195409 \n", "9 0.020264 0.021628 0.084953 3.557193 6.054130 \n", "10 0.471100 0.032497 0.025328 5.303103 6.025271 \n", "11 0.024948 0.008068 0.002700 8.532955 5.496740 \n", "12 0.034855 0.006698 0.001368 9.514020 4.634595 \n", "13 0.020384 0.016922 0.000516 10.919970 6.279158 \n", "14 0.009579 0.009579 0.023234 5.427610 6.365307 \n", "15 0.015280 0.015280 0.001073 9.863976 5.434465 \n", "16 0.086085 0.086085 0.032688 4.935083 6.820054 \n", "17 0.096666 0.041449 0.016310 5.938136 6.445262 \n", "18 0.096666 0.041449 0.000285 11.777886 6.376330 \n", "19 0.064011 0.064011 0.032013 4.965190 7.453425 \n", "20 0.036796 0.036796 0.094515 3.403313 6.325965 \n", "21 0.032738 0.032738 0.000560 10.801688 5.515079 \n", "22 0.071475 0.071475 0.030527 5.033760 6.451129 \n", "23 0.071475 0.071475 0.030173 5.050578 6.242611 \n", "24 0.071475 0.071475 0.004487 7.799989 6.395721 \n", "25 0.071475 0.071475 0.000491 10.991930 6.505685 \n", "26 0.071475 0.071475 0.003304 8.241366 7.398329 \n", "27 0.071475 0.071475 0.005148 7.601661 6.615088 \n", "28 0.071475 0.071475 0.001718 9.184636 6.746635 \n", "29 0.071475 0.071475 0.003711 8.073947 6.704841 \n", "30 0.071475 0.071475 0.003893 8.004885 6.831011 \n", "31 0.071475 0.071475 0.009871 6.662527 6.981373 \n", "32 0.071475 0.071475 0.004060 7.944435 6.577649 \n", "33 0.071475 0.071475 0.012241 6.352193 6.626351 \n", "34 0.071475 0.071475 0.003576 8.127393 6.317979 \n", "35 0.071475 0.071475 0.016519 5.919709 6.640411 \n", "36 0.071475 0.071475 0.014281 6.129768 6.172625 \n", "37 0.071475 0.071475 0.000605 10.689795 6.107241 \n", "38 0.071475 0.071475 0.049025 4.350327 5.208764 \n", "39 0.071475 0.071475 0.006140 7.347494 5.184156 \n", "40 0.071475 0.071475 0.026622 5.231213 6.271502 \n", "41 0.071475 0.071475 0.025797 5.276651 5.858154 \n", "42 0.071475 0.071475 0.046497 4.426728 5.343955 \n", "43 0.071475 0.071475 0.012445 6.328318 6.123449 \n", "44 0.071475 0.071475 0.009146 6.772634 7.122422 \n", "45 0.071475 0.071475 0.027518 5.183463 6.121163 \n", "\n", " information.gain \n", "0 NA \n", "1 1.232259 \n", "2 1.375501 \n", "3 0.641172 \n", "4 1.142639 \n", "5 1.731693 \n", "6 1.562651 \n", "7 3.517963 \n", "8 2.56795 \n", "9 0.739198 \n", "10 1.249012 \n", "11 2.424903 \n", "12 1.126749 \n", "13 2.610063 \n", "14 1.653181 \n", "15 1.353293 \n", "16 2.303764 \n", "17 0.345092 \n", "18 0.243361 \n", "19 0.91787 \n", "20 1.046446 \n", "21 0.210775 \n", "22 1.898791 \n", "23 0.165335 \n", "24 0.352045 \n", "25 0.929199 \n", "26 0.230001 \n", "27 0.285012 \n", "28 0.13639 \n", "29 0.164278 \n", "30 0.110937 \n", "31 0.846874 \n", "32 1.187257 \n", "33 0.334889 \n", "34 0.067478 \n", "35 0.313294 \n", "36 0.513642 \n", "37 1.545731 \n", "38 2.524508 \n", "39 0.113159 \n", "40 0.422336 \n", "41 0.703918 \n", "42 2.159898 \n", "43 0.278918 \n", "44 0.727375 \n", "45 0.539936 \n", "\n", "[46 rows x 86 columns]]\n" ] } ], "source": [ "# Access the melody named '\"chor-010\"' using the `access_melodies` method.\n", "\n", "selected_melodies = my_experiment.access_melodies(melody_names = ['\"chor-010\"'])\n", "\n", "print(selected_melodies)\n" ] }, { "cell_type": "markdown", "id": "d053a7da", "metadata": {}, "source": [ "### 2.3 Access consecutive melodies using the `access_melodies` method by providing the indices.\n" ] }, { "cell_type": "code", "execution_count": 5, "id": "a8c49994", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ dataset.id melody.id note.id melody.name vertint12 articulation \\\n", "0 6.605212e+13 1.0 1.0 \"chor-001\" NA 0.0 \n", "1 6.605212e+13 1.0 2.0 \"chor-001\" NA 0.0 \n", "2 6.605212e+13 1.0 3.0 \"chor-001\" NA 0.0 \n", "3 6.605212e+13 1.0 4.0 \"chor-001\" NA 0.0 \n", "4 6.605212e+13 1.0 5.0 \"chor-001\" NA 0.0 \n", "5 6.605212e+13 1.0 6.0 \"chor-001\" NA 0.0 \n", "6 6.605212e+13 1.0 7.0 \"chor-001\" NA 0.0 \n", "7 6.605212e+13 1.0 8.0 \"chor-001\" NA 0.0 \n", "8 6.605212e+13 1.0 9.0 \"chor-001\" NA 0.0 \n", "9 6.605212e+13 1.0 10.0 \"chor-001\" NA 0.0 \n", "10 6.605212e+13 1.0 11.0 \"chor-001\" NA 0.0 \n", "11 6.605212e+13 1.0 12.0 \"chor-001\" NA 0.0 \n", "12 6.605212e+13 1.0 13.0 \"chor-001\" NA 0.0 \n", "13 6.605212e+13 1.0 14.0 \"chor-001\" NA 0.0 \n", "14 6.605212e+13 1.0 15.0 \"chor-001\" NA 0.0 \n", "15 6.605212e+13 1.0 16.0 \"chor-001\" NA 0.0 \n", "16 6.605212e+13 1.0 17.0 \"chor-001\" NA 0.0 \n", "17 6.605212e+13 1.0 18.0 \"chor-001\" NA 0.0 \n", "18 6.605212e+13 1.0 19.0 \"chor-001\" NA 0.0 \n", "19 6.605212e+13 1.0 20.0 \"chor-001\" NA 0.0 \n", "20 6.605212e+13 1.0 21.0 \"chor-001\" NA 0.0 \n", "21 6.605212e+13 1.0 22.0 \"chor-001\" NA 0.0 \n", "22 6.605212e+13 1.0 23.0 \"chor-001\" NA 0.0 \n", "23 6.605212e+13 1.0 24.0 \"chor-001\" NA 0.0 \n", "24 6.605212e+13 1.0 25.0 \"chor-001\" NA 0.0 \n", "25 6.605212e+13 1.0 26.0 \"chor-001\" NA 0.0 \n", "26 6.605212e+13 1.0 27.0 \"chor-001\" NA 0.0 \n", "27 6.605212e+13 1.0 28.0 \"chor-001\" NA 0.0 \n", "28 6.605212e+13 1.0 29.0 \"chor-001\" NA 0.0 \n", "29 6.605212e+13 1.0 30.0 \"chor-001\" NA 0.0 \n", "30 6.605212e+13 1.0 31.0 \"chor-001\" NA 0.0 \n", "31 6.605212e+13 1.0 32.0 \"chor-001\" NA 0.0 \n", "32 6.605212e+13 1.0 33.0 \"chor-001\" NA 0.0 \n", "33 6.605212e+13 1.0 34.0 \"chor-001\" NA 0.0 \n", "34 6.605212e+13 1.0 35.0 \"chor-001\" NA 0.0 \n", "35 6.605212e+13 1.0 36.0 \"chor-001\" NA 0.0 \n", "36 6.605212e+13 1.0 37.0 \"chor-001\" NA 0.0 \n", "37 6.605212e+13 1.0 38.0 \"chor-001\" NA 0.0 \n", "38 6.605212e+13 1.0 39.0 \"chor-001\" NA 0.0 \n", "\n", " comma voice ornament dyn ... onset.18 onset.24 onset.36 onset.48 \\\n", "0 0.0 1.0 0.0 NA ... 0.069163 0.108389 0.089951 0.130606 \n", "1 0.0 1.0 0.0 NA ... 0.215268 0.083398 0.023693 0.040086 \n", "2 0.0 1.0 0.0 NA ... 0.064587 0.535028 0.080391 0.048375 \n", "3 0.0 1.0 0.0 NA ... 0.005627 0.019489 0.023626 0.019489 \n", "4 0.0 1.0 0.0 NA ... 0.221086 0.085329 0.041988 0.049373 \n", "5 0.0 1.0 0.0 NA ... 0.005699 0.192398 0.015870 0.016998 \n", "6 0.0 1.0 0.0 NA ... 0.113231 0.077657 0.077657 0.080017 \n", "7 0.0 1.0 0.0 NA ... 0.028371 0.105038 0.013260 0.016347 \n", "8 0.0 1.0 0.0 NA ... 0.002986 0.490153 0.005057 0.372982 \n", "9 0.0 1.0 0.0 NA ... 0.008422 0.536129 0.053373 0.062757 \n", "10 0.0 1.0 0.0 NA ... 0.156526 0.484888 0.016137 0.021628 \n", "11 0.0 1.0 0.0 NA ... 0.011060 0.196659 0.024893 0.028715 \n", "12 0.0 1.0 0.0 NA ... 0.193435 0.023433 0.023433 0.026460 \n", "13 0.0 1.0 0.0 NA ... 0.011080 0.166016 0.028406 0.032707 \n", "14 0.0 1.0 0.0 NA ... 0.085692 0.057504 0.074620 0.020161 \n", "15 0.0 1.0 0.0 NA ... 0.021904 0.203087 0.015830 0.015830 \n", "16 0.0 1.0 0.0 NA ... 0.010427 0.509130 0.010427 0.020113 \n", "17 0.0 1.0 0.0 NA ... 0.042116 0.323085 0.042116 0.079686 \n", "18 0.0 1.0 0.0 NA ... 0.064011 0.064011 0.168065 0.064011 \n", "19 0.0 1.0 0.0 NA ... 0.046266 0.315797 0.046266 0.086085 \n", "20 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "21 0.0 1.0 0.0 NA ... 0.032738 0.507358 0.032738 0.032738 \n", "22 0.0 1.0 0.0 NA ... 0.048937 0.048937 0.048937 0.048937 \n", "23 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "24 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "25 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "26 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "27 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "28 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "29 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "30 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "31 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "32 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "33 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "34 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "35 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "36 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "37 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "38 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "\n", " onset.72 onset.120 probability information.content entropy \\\n", "0 0.130606 0.125256 0.003618 8.110521 8.166577 \n", "1 0.040086 0.037790 0.006168 7.340967 6.978885 \n", "2 0.048375 0.048375 0.003824 8.030865 7.040227 \n", "3 0.020869 0.005627 0.014959 6.062825 5.377770 \n", "4 0.046937 0.017783 0.006833 7.193185 6.516368 \n", "5 0.018125 0.018125 0.016638 5.909347 5.315919 \n", "6 0.043719 0.072700 0.012751 6.293203 7.594322 \n", "7 0.051517 0.048669 0.000793 10.299686 5.291717 \n", "8 0.025180 0.027164 0.055579 4.169328 5.839678 \n", "9 0.072021 0.076614 0.081680 3.613867 5.946950 \n", "10 0.020264 0.021628 0.041835 4.579153 5.821548 \n", "11 0.471100 0.032497 0.022307 5.486332 6.091876 \n", "12 0.024948 0.008068 0.003196 8.289616 5.076308 \n", "13 0.034855 0.006698 0.001381 9.500299 5.044838 \n", "14 0.009347 0.009347 0.146412 2.771899 5.432578 \n", "15 0.012763 0.012763 0.040615 4.621834 5.149334 \n", "16 0.020113 0.020113 0.074568 3.745300 5.098519 \n", "17 0.079686 0.079686 0.013097 6.254603 6.631182 \n", "18 0.064011 0.064011 0.049004 4.350946 5.644735 \n", "19 0.086085 0.086085 0.046306 4.432662 5.074976 \n", "20 0.096666 0.041449 0.016336 5.935765 6.052998 \n", "21 0.032738 0.032738 0.114361 3.128328 5.368318 \n", "22 0.048937 0.048937 0.008768 6.833459 4.613591 \n", "23 0.071475 0.071475 0.009778 6.676212 5.950436 \n", "24 0.071475 0.071475 0.000387 11.335936 5.986061 \n", "25 0.071475 0.071475 0.000809 10.271771 7.372804 \n", "26 0.071475 0.071475 0.010303 6.600861 7.279307 \n", "27 0.071475 0.071475 0.016263 5.942232 6.772683 \n", "28 0.071475 0.071475 0.020545 5.605064 6.487540 \n", "29 0.071475 0.071475 0.014429 6.114886 5.707804 \n", "30 0.071475 0.071475 0.008981 6.798859 6.379406 \n", "31 0.071475 0.071475 0.013602 6.200000 6.282618 \n", "32 0.071475 0.071475 0.020492 5.608791 6.283053 \n", "33 0.071475 0.071475 0.038168 4.711486 5.770165 \n", "34 0.071475 0.071475 0.025756 5.278932 5.667925 \n", "35 0.071475 0.071475 0.032324 4.951241 5.522875 \n", "36 0.071475 0.071475 0.028249 5.145631 6.720723 \n", "37 0.071475 0.071475 0.027012 5.210249 5.878130 \n", "38 0.071475 0.071475 0.030530 5.033616 5.738510 \n", "\n", " information.gain \n", "0 NA \n", "1 1.100655 \n", "2 1.148572 \n", "3 3.628526 \n", "4 1.281571 \n", "5 2.119374 \n", "6 1.740519 \n", "7 1.511522 \n", "8 3.603183 \n", "9 1.096036 \n", "10 0.996691 \n", "11 1.833349 \n", "12 3.445602 \n", "13 2.654872 \n", "14 3.811815 \n", "15 0.945636 \n", "16 0.610506 \n", "17 1.176221 \n", "18 1.228733 \n", "19 1.645714 \n", "20 0.902723 \n", "21 0.368654 \n", "22 2.086663 \n", "23 1.231321 \n", "24 0.431252 \n", "25 0.878882 \n", "26 0.188189 \n", "27 0.15374 \n", "28 0.266466 \n", "29 0.590087 \n", "30 1.13126 \n", "31 0.114677 \n", "32 0.050878 \n", "33 0.805284 \n", "34 0.409764 \n", "35 0.319236 \n", "36 1.080196 \n", "37 0.589475 \n", "38 0.874517 \n", "\n", "[39 rows x 86 columns], dataset.id melody.id note.id melody.name vertint12 articulation \\\n", "0 6.605212e+13 2.0 1.0 \"chor-002\" NA 0.0 \n", "1 6.605212e+13 2.0 2.0 \"chor-002\" NA 0.0 \n", "2 6.605212e+13 2.0 3.0 \"chor-002\" NA 0.0 \n", "3 6.605212e+13 2.0 4.0 \"chor-002\" NA 0.0 \n", "4 6.605212e+13 2.0 5.0 \"chor-002\" NA 0.0 \n", "5 6.605212e+13 2.0 6.0 \"chor-002\" NA 0.0 \n", "6 6.605212e+13 2.0 7.0 \"chor-002\" NA 0.0 \n", "7 6.605212e+13 2.0 8.0 \"chor-002\" NA 0.0 \n", "8 6.605212e+13 2.0 9.0 \"chor-002\" NA 0.0 \n", "9 6.605212e+13 2.0 10.0 \"chor-002\" NA 0.0 \n", "10 6.605212e+13 2.0 11.0 \"chor-002\" NA 0.0 \n", "11 6.605212e+13 2.0 12.0 \"chor-002\" NA 0.0 \n", "12 6.605212e+13 2.0 13.0 \"chor-002\" NA 0.0 \n", "13 6.605212e+13 2.0 14.0 \"chor-002\" NA 0.0 \n", "14 6.605212e+13 2.0 15.0 \"chor-002\" NA 0.0 \n", "15 6.605212e+13 2.0 16.0 \"chor-002\" NA 0.0 \n", "16 6.605212e+13 2.0 17.0 \"chor-002\" NA 0.0 \n", "17 6.605212e+13 2.0 18.0 \"chor-002\" NA 0.0 \n", "18 6.605212e+13 2.0 19.0 \"chor-002\" NA 0.0 \n", "19 6.605212e+13 2.0 20.0 \"chor-002\" NA 0.0 \n", "20 6.605212e+13 2.0 21.0 \"chor-002\" NA 0.0 \n", "21 6.605212e+13 2.0 22.0 \"chor-002\" NA 0.0 \n", "22 6.605212e+13 2.0 23.0 \"chor-002\" NA 0.0 \n", "23 6.605212e+13 2.0 24.0 \"chor-002\" NA 0.0 \n", "24 6.605212e+13 2.0 25.0 \"chor-002\" NA 0.0 \n", "25 6.605212e+13 2.0 26.0 \"chor-002\" NA 0.0 \n", "26 6.605212e+13 2.0 27.0 \"chor-002\" NA 0.0 \n", "27 6.605212e+13 2.0 28.0 \"chor-002\" NA 0.0 \n", "28 6.605212e+13 2.0 29.0 \"chor-002\" NA 0.0 \n", "29 6.605212e+13 2.0 30.0 \"chor-002\" NA 0.0 \n", "30 6.605212e+13 2.0 31.0 \"chor-002\" NA 0.0 \n", "31 6.605212e+13 2.0 32.0 \"chor-002\" NA 0.0 \n", "32 6.605212e+13 2.0 33.0 \"chor-002\" NA 0.0 \n", "33 6.605212e+13 2.0 34.0 \"chor-002\" NA 0.0 \n", "34 6.605212e+13 2.0 35.0 \"chor-002\" NA 0.0 \n", "35 6.605212e+13 2.0 36.0 \"chor-002\" NA 0.0 \n", "36 6.605212e+13 2.0 37.0 \"chor-002\" NA 0.0 \n", "37 6.605212e+13 2.0 38.0 \"chor-002\" NA 0.0 \n", "38 6.605212e+13 2.0 39.0 \"chor-002\" NA 0.0 \n", "39 6.605212e+13 2.0 40.0 \"chor-002\" NA 0.0 \n", "40 6.605212e+13 2.0 41.0 \"chor-002\" NA 0.0 \n", "\n", " comma voice ornament dyn ... onset.18 onset.24 onset.36 onset.48 \\\n", "0 0.0 1.0 0.0 NA ... 0.069163 0.108389 0.089951 0.130606 \n", "1 0.0 1.0 0.0 NA ... 0.215268 0.083398 0.023693 0.040086 \n", "2 0.0 1.0 0.0 NA ... 0.064587 0.535028 0.080391 0.048375 \n", "3 0.0 1.0 0.0 NA ... 0.121740 0.356607 0.024939 0.029701 \n", "4 0.0 1.0 0.0 NA ... 0.005699 0.192398 0.015870 0.016998 \n", "5 0.0 1.0 0.0 NA ... 0.113231 0.077657 0.077657 0.080017 \n", "6 0.0 1.0 0.0 NA ... 0.028371 0.105038 0.013260 0.016347 \n", "7 0.0 1.0 0.0 NA ... 0.002986 0.490153 0.005057 0.372982 \n", "8 0.0 1.0 0.0 NA ... 0.008422 0.536129 0.053373 0.062757 \n", "9 0.0 1.0 0.0 NA ... 0.156526 0.484888 0.016137 0.021628 \n", "10 0.0 1.0 0.0 NA ... 0.011060 0.196659 0.024893 0.028715 \n", "11 0.0 1.0 0.0 NA ... 0.011080 0.166016 0.028406 0.032707 \n", "12 0.0 1.0 0.0 NA ... 0.066150 0.117944 0.045238 0.056585 \n", "13 0.0 1.0 0.0 NA ... 0.014655 0.648461 0.010516 0.010516 \n", "14 0.0 1.0 0.0 NA ... 0.010427 0.509130 0.010427 0.020113 \n", "15 0.0 1.0 0.0 NA ... 0.042116 0.323085 0.042116 0.079686 \n", "16 0.0 1.0 0.0 NA ... 0.046266 0.315797 0.046266 0.086085 \n", "17 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "18 0.0 1.0 0.0 NA ... 0.041449 0.368062 0.041449 0.096666 \n", "19 0.0 1.0 0.0 NA ... 0.036796 0.429145 0.036796 0.116969 \n", "20 0.0 1.0 0.0 NA ... 0.032738 0.507358 0.032738 0.032738 \n", "21 0.0 1.0 0.0 NA ... 0.048937 0.048937 0.048937 0.048937 \n", "22 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "23 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "24 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "25 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "26 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "27 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "28 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "29 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "30 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "31 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "32 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "33 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "34 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "35 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "36 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "37 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "38 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "39 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "40 0.0 1.0 0.0 NA ... 0.071475 0.071475 0.071475 0.071475 \n", "\n", " onset.72 onset.120 probability information.content entropy \\\n", "0 0.130606 0.125256 0.004055 7.945978 8.166577 \n", "1 0.040086 0.037790 0.001879 9.055906 7.022451 \n", "2 0.048375 0.048375 0.031736 4.977722 6.759365 \n", "3 0.028123 0.009872 0.005187 7.590789 5.508813 \n", "4 0.018125 0.018125 0.032902 4.925688 5.474818 \n", "5 0.043719 0.072700 0.001262 9.629748 6.267564 \n", "6 0.051517 0.048669 0.008477 6.882165 5.693554 \n", "7 0.025180 0.027164 0.003460 8.174894 4.829847 \n", "8 0.072021 0.076614 0.053780 4.216774 6.363213 \n", "9 0.020264 0.021628 0.063863 3.968870 5.423235 \n", "10 0.471100 0.032497 0.002756 8.503351 5.354833 \n", "11 0.034855 0.006698 0.001428 9.451787 5.034352 \n", "12 0.020384 0.016922 0.001843 9.083658 5.695037 \n", "13 0.008438 0.008438 0.115812 3.110146 5.292224 \n", "14 0.020113 0.020113 0.203976 2.293531 4.940844 \n", "15 0.079686 0.079686 0.104582 3.257295 6.349461 \n", "16 0.086085 0.086085 0.068605 3.865542 6.544269 \n", "17 0.096666 0.041449 0.099663 3.326796 6.277746 \n", "18 0.096666 0.041449 0.073876 3.758748 6.411900 \n", "19 0.036796 0.036796 0.100216 3.318810 6.011344 \n", "20 0.032738 0.032738 0.004198 7.896226 5.887434 \n", "21 0.048937 0.048937 0.002329 8.746285 6.839952 \n", "22 0.071475 0.071475 0.008203 6.929573 6.760173 \n", "23 0.071475 0.071475 0.007193 7.119179 6.465666 \n", "24 0.071475 0.071475 0.014512 6.106617 6.799645 \n", "25 0.071475 0.071475 0.001969 8.988546 6.553230 \n", "26 0.071475 0.071475 0.010188 6.617039 6.445196 \n", "27 0.071475 0.071475 0.010286 6.603144 6.697904 \n", "28 0.071475 0.071475 0.029456 5.085311 5.969671 \n", "29 0.071475 0.071475 0.013323 6.229986 6.520202 \n", "30 0.071475 0.071475 0.003772 8.050456 5.935160 \n", "31 0.071475 0.071475 0.006251 7.321583 6.649951 \n", "32 0.071475 0.071475 0.017481 5.838043 6.340725 \n", "33 0.071475 0.071475 0.045288 4.464736 5.169728 \n", "34 0.071475 0.071475 0.037708 4.729003 5.658613 \n", "35 0.071475 0.071475 0.034882 4.841373 5.886921 \n", "36 0.071475 0.071475 0.043066 4.537309 5.345791 \n", "37 0.071475 0.071475 0.020413 5.614381 6.304415 \n", "38 0.071475 0.071475 0.036857 4.761912 5.775718 \n", "39 0.071475 0.071475 0.023005 5.441924 6.115581 \n", "40 0.071475 0.071475 0.017179 5.863214 6.414777 \n", "\n", " information.gain \n", "0 NA \n", "1 1.122545 \n", "2 1.364476 \n", "3 1.104274 \n", "4 1.629713 \n", "5 2.202822 \n", "6 1.688195 \n", "7 3.769675 \n", "8 1.383045 \n", "9 0.993839 \n", "10 1.573926 \n", "11 1.837875 \n", "12 0.995622 \n", "13 1.670692 \n", "14 0.309567 \n", "15 0.761373 \n", "16 0.078929 \n", "17 0.274441 \n", "18 0.237343 \n", "19 0.607593 \n", "20 0.347147 \n", "21 1.651555 \n", "22 0.409729 \n", "23 0.445225 \n", "24 0.337947 \n", "25 0.187545 \n", "26 0.500489 \n", "27 0.559612 \n", "28 0.364579 \n", "29 0.237544 \n", "30 0.552133 \n", "31 0.452988 \n", "32 0.420941 \n", "33 0.473281 \n", "34 0.109028 \n", "35 0.902037 \n", "36 0.102926 \n", "37 0.732466 \n", "38 0.61565 \n", "39 0.723997 \n", "40 0.585556 \n", "\n", "[41 rows x 86 columns]]\n" ] } ], "source": [ "# Access the first 2 melodies using the `access_melodies` method.\n", "\n", "selected_melodies = my_experiment.access_melodies(ending_index=2)\n", "\n", "print(selected_melodies)\n" ] }, { "cell_type": "markdown", "id": "b3e79406", "metadata": {}, "source": [ "## 3. Melody Info: to further access melody-specific information\n", "\n", "To get the IDyOM model outputs for each melodies, you will need to use the `MelodyInfo` class." ] }, { "cell_type": "markdown", "id": "6234def6", "metadata": {}, "source": [ "### 3.1 Access the melody\n", "\n", "For each melody in the experiment, all data are stored in the `MelodyInfo` class which is essentially a panda.DataFrame. To create an instance of `MelodyInfo`, we can use `ExperimentInfo.melodies_dict`, or `ExperimentInfo.access_melodies` as showed in part 2." ] }, { "cell_type": "code", "execution_count": 6, "id": "16345b51", "metadata": {}, "outputs": [], "source": [ "# first, access the melody by creating an instance of `MelodyInfo`\n", "\n", "selected_melody = my_experiment.melodies_dict['\"chor-002\"']\n" ] }, { "cell_type": "markdown", "id": "c997012c", "metadata": {}, "source": [ "Note that here, `selected_melody` is an instance of `MelodyInfo`." ] }, { "cell_type": "markdown", "id": "d55077b7", "metadata": {}, "source": [ "### 3.2 Check the valid IDyOM output keywords for the selected melody\n", "\n", "For each melody, you can check the valid IDyOM output keywords with the `get_idyom_output_keyword_list()` method." ] }, { "cell_type": "code", "execution_count": 7, "id": "482338bd", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['dataset.id', 'melody.id', 'note.id', 'melody.name', 'vertint12', 'articulation', 'comma', 'voice', 'ornament', 'dyn', 'phrase', 'bioi', 'deltast', 'accidental', 'mpitch', 'cpitch', 'barlength', 'pulses', 'tempo', 'mode', 'keysig', 'dur', 'onset', 'cpitch.order.ltm.cpitch', 'cpitch.order.stm.cpitch', 'cpitch.weight.ltm', 'cpitch.weight.stm', 'cpitch.weight.ltm.cpitch', 'cpitch.weight.stm.cpitch', 'cpitch.probability', 'cpitch.information.content', 'cpitch.entropy', 'cpitch.55', 'cpitch.57', 'cpitch.58', 'cpitch.59', 'cpitch.60', 'cpitch.62', 'cpitch.63', 'cpitch.64', 'cpitch.65', 'cpitch.66', 'cpitch.67', 'cpitch.68', 'cpitch.69', 'cpitch.70', 'cpitch.71', 'cpitch.72', 'cpitch.73', 'cpitch.74', 'cpitch.75', 'cpitch.76', 'cpitch.77', 'cpitch.78', 'cpitch.79', 'cpitch.81', 'cpitch.82', 'cpitch.83', 'cpitch.84', 'cpitch.85', 'cpitch.86', 'cpitch.88', 'onset.order.ltm.onset', 'onset.order.stm.onset', 'onset.weight.ltm', 'onset.weight.stm', 'onset.weight.ltm.onset', 'onset.weight.stm.onset', 'onset.probability', 'onset.information.content', 'onset.entropy', 'onset.0', 'onset.3', 'onset.6', 'onset.9', 'onset.12', 'onset.18', 'onset.24', 'onset.36', 'onset.48', 'onset.72', 'onset.120', 'probability', 'information.content', 'entropy', 'information.gain']\n" ] } ], "source": [ "# check the valid IDyOM output keywords for this selected_melody:\n", "\n", "valid_idyom_output_key_list = selected_melody.get_idyom_output_keyword_list()\n", "\n", "print(valid_idyom_output_key_list)" ] }, { "cell_type": "markdown", "id": "6b128c1d", "metadata": {}, "source": [ "The list above shows all the valid IDyOM output keys available for the melody '\"chor-002\"'.\n", "Now, we want to access the following data: `cpitch.information.content`, `onset.information.content`, `entropy`" ] }, { "cell_type": "markdown", "id": "edc734e9", "metadata": {}, "source": [ "### 3.3 Access IDyOM output data via keywords\n", "\n", "To extract the output values, we will use the `MelodyInfo` method called `access_idyom_output_keywords`.\n", "\n", "You need to pass a list of keywords to the method, and it will return a dataframe." ] }, { "cell_type": "code", "execution_count": 8, "id": "ea9a6616", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " onset.information.content entropy\n", "0 2.880014 8.166577\n", "1 3.583843 7.022451\n", "2 0.902314 6.759365\n", "3 1.487593 5.508813\n", "4 2.377832 5.474818\n", "5 3.686743 6.267564\n", "6 3.251021 5.693554\n", "7 1.028696 4.829847\n", "8 0.899349 6.363213\n", "9 1.044276 5.423235\n", "10 5.122056 5.354833\n", "11 2.590604 5.034352\n", "12 3.083826 5.695037\n", "13 0.624909 5.292224\n", "14 0.973895 4.940844\n", "15 1.630016 6.349461\n", "16 1.662930 6.544269\n", "17 1.441977 6.277746\n", "18 1.441977 6.411900\n", "19 1.220463 6.011344\n", "20 0.978923 5.887434\n", "21 4.352934 6.839952\n", "22 3.806420 6.760173\n", "23 3.806420 6.465666\n", "24 3.806420 6.799645\n", "25 3.806420 6.553230\n", "26 3.806420 6.445196\n", "27 3.806420 6.697904\n", "28 3.806420 5.969671\n", "29 3.806420 6.520202\n", "30 3.806420 5.935160\n", "31 3.806420 6.649951\n", "32 3.806420 6.340725\n", "33 3.806420 5.169728\n", "34 3.806420 5.658613\n", "35 3.806420 5.886921\n", "36 3.806420 5.345791\n", "37 3.806420 6.304415\n", "38 3.806420 5.775718\n", "39 3.806420 6.115581\n", "40 3.806420 6.414777\n" ] } ], "source": [ "# Accessing `onset.information.content`, `entropy` for '\"chor-002\"'\n", "\n", "selected_idyom_outputs = selected_melody.access_idyom_output_keywords(['onset.information.content',\n", " 'entropy'])\n", "\n", "print(selected_idyom_outputs)" ] }, { "cell_type": "markdown", "id": "a977a6ea", "metadata": {}, "source": [ "Get get the data as a numpy array, you can use the `get_idyom_output_nparray` method." ] }, { "cell_type": "code", "execution_count": 9, "id": "4511f750", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[4.8619256, 4.716329, 4.391901, 3.1552763, 4.0513153, 3.0147789, 3.5076356, 3.0511367, 4.0920258, 3.3372533, 3.1501474, 3.36347, 3.0170422, 3.643789, 2.8647585, 3.3451679, 3.466154, 3.354281, 3.4884357, 3.3005762, 3.4747243, 4.214637, 3.5233264, 3.2288165, 3.5627892, 3.3163767, 3.2083457, 3.4610538, 2.732824, 3.2833517, 2.698308, 3.4130876, 3.1038811, 1.9328707, 2.421765, 2.650072, 2.1089375, 3.0675576, 2.5388658, 2.878732, 3.1779296]\n" ] } ], "source": [ "# Get the values of `cpitch.entropy` as a numpy array for'\"chor-002\"'\n", "\n", "selected_idyom_output_array = selected_melody.get_idyom_output_nparray('cpitch.entropy')\n", "\n", "print(selected_idyom_output_array)" ] }, { "cell_type": "code", "execution_count": null, "id": "3fffbc49", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py2lispIDyOM", "language": "python", "name": "py2lispidyom" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.0" } }, "nbformat": 4, "nbformat_minor": 5 }