xinyiguan / py2lispidyom Goto Github PK
View Code? Open in Web Editor NEWA Python package for IDyOM
Home Page: https://xinyiguan.github.io/py2lispIDyOM/
License: MIT License
A Python package for IDyOM
Home Page: https://xinyiguan.github.io/py2lispIDyOM/
License: MIT License
Code coverage appears to be ~59% (including some cases where tests fail on my machine)
Name Stmts Miss Cover
----------------------------------------------------------------------------------------------
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/__init__.py 4 0 100%
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/configuration.py 434 71 84%
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/export.py 95 32 66%
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/extract.py 138 45 67%
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/run.py 62 16 74%
/home/hayesall/Review/py2lispIDyOM/py2lispIDyOM/viz.py 321 269 16%
----------------------------------------------------------------------------------------------
TOTAL 1054 433 59%
Recommendation: I don't have a hard rule for what coverage should be. I'd recommend clarifying what coverage threshold matters to the project in the contributing guidelines. A good portion of the library involves visualization, which tends to be slightly harder to test in my experience.
After working through the Jupyter notebooks, my local git directory listed a large number of files as having been modified:
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_csv/chor-005.csv
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_csv/chor-006.csv
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor001_cpitch.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor001_melody_name.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor001_onset.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor002_cpitch.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor002_melody_name.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/chor002_onset.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/entropy.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/information_content.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/outputs_in_mat/melody_name.mat
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/entropy_plots/chor-006.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/pianoroll_groundtruth_surprisal/chor-001.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/pianoroll_groundtruth_surprisal/chor-002.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/pianoroll_pitch_prediction_groundtruth/chor-003.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/pianoroll_pitch_prediction_groundtruth/chor-010.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/selected_surprisal_entropy/chor-003.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/simple_plot_information.content/chor-001.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/simple_plot_information.content/chor-002.png
modified: tutorials/experiment_history/21-05-22_17.05.05/plots/surprisals_plots/chor-005.png
It looks like they are not being reproduced exactly.
Recommendation: Clarify whether these should be reproduced exactly, update copies on remote branch, or add some of these files to a .gitignore
cd tutorials/
head -n 2 experiment_history/21-05-22_17.05.05/outputs_in_csv/chor-005.csv
(Run through the notebooks)
The previous version showed:
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
66052122170523.0,5.0 ,1.0 ,"""chor-005""",NA ,0.0 ,0.0 ,1.0 ,0.0 ,NA ,0.0 ,0.0 ,0.0 ,NA ,NA ,72.0 ,96.0 ,4.0 ,600000.0,NA ,NA ,24.0,0.0 ,0.0 ,0.0 ,0.55405396 ,0.445946 ,1.0 ,1.0 ,0.041816834 ,4.5797725 ,4.8619256 ,0.02490338 ,0.02490338 ,0.025781138 ,0.02490338 ,0.028281277 ,0.029853348 ,0.025781138 ,0.034215137 ,0.028281277 ,0.027468303 ,0.043547735 ,0.023999978 ,0.04467151 ,0.027468303 ,0.044112504,0.041816834,0.026635475 ,0.043547735,0.025781138 ,0.052472092,0.03489898 ,0.036888853 ,0.03879583 ,0.049981304 ,0.029075868 ,0.04738632 ,0.025781138 ,0.029075868 ,0.030614864 ,0.029075868 ,0.0 ,0.0 ,0.648152 ,0.351848 ,0.99999994 ,1.0 ,0.13584055 ,2.880014 ,3.3046489 ,0.13584055 ,0.03393319 ,0.03393319 ,0.03393319 ,0.10838893 ,0.069162674 ,0.10838893 ,0.089950934 ,0.13060634 ,0.13060634 ,0.12525566 ,0.005680422 ,7.459786 ,8.166577 ,NA
... and after re-running, they show:
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
66052122170523.0,5.0,1.0,"""chor-005""",NA,0.0,0.0,1.0,0.0,NA,0.0,0.0,0.0,NA,NA,72.0,96.0,4.0,600000.0,NA,NA,24.0,0.0,0.0,0.0,0.55405396,0.445946,1.0,1.0,0.041816834,4.5797725,4.8619256,0.02490338,0.02490338,0.025781138,0.02490338,0.028281277,0.029853348,0.025781138,0.034215137,0.028281277,0.027468303,0.043547735,0.023999978,0.04467151,0.027468303,0.044112504,0.041816834,0.026635475,0.043547735,0.025781138,0.052472092,0.03489898,0.036888853,0.03879583,0.049981304,0.029075868,0.04738632,0.025781138,0.029075868,0.030614864,0.029075868,0.0,0.0,0.648152,0.351848,0.99999994,1.0,0.13584055,2.880014,3.3046489,0.13584055,0.03393319,0.03393319,0.03393319,0.10838893,0.069162674,0.10838893,0.089950934,0.13060634,0.13060634,0.12525566,0.005680422,7.459786,8.166577,NA
The installation is pretty tricky at the moment, following from the idyom
installation instructions.
Recommmendation: Figure out how to automate installation on a common platform (e.g. Ubuntu).
sbcl
This one should be pretty straightforward:
curl -L http://prdownloads.sourceforge.net/sbcl/sbcl-2.2.9-x86-64-linux-binary.tar.bz2 > sbcl-2.2.9-x86-64-linux-binary.tar.bz2
bzip2 -cd sbcl-2.2.9-x86-64-linux-binary.tar.bz2 | tar xvf -
cd sbcl-2.2.9-x86-linux
sudo sh install.sh
quicklisp
This one might be trickier. The quicklisp
installation instructions currently suggest installing in interactive mode.
I didn't test it yet (I'm less familiar with sbcl
), but using --eval
might be one path to follow here:
sbcl --eval '(quicklisp-quickstart:install)'
sqlite3
This one should be easy.
sudo apt install sqlite3
IDyOM
This one feels fairly straightforward after figuring out the username (whoami
), and evaluating a few expressions to make sure packages are correctly downloaded.
Here is a rough draft for the fourth step:
echo '(ql:quickload "clsql")' >> .sbclrc
echo '(defun start-idyom ()' >> .sbclrc
echo " (defvar *idyom-root* \"/home/$(whoami)/idyom/\")" >> .sbclrc
echo " (ql:quickload \"idyom\")" >> .sbclrc
echo " (clsql:connect '(\"/home/$(whoami)/idyom/db/database.sqlite\") :if-exists :old :database-type :sqlite3))" >> .sbclrc
Hello @xinyiguan,
I'll be updating this issue here with respect to review: #4738. Most of my comments will be suggestions and so can be discussed. If anything is a major issue, I will make it clear π
brew install sbcl
or, I assume, linux package mangers? - this might just help you to make an install guide fit onto your repo without directing people around (could even make an install script for users?).Please note: I will let you know when I've finished adding thoughts
The .github/workflows/tests.yml
file appears to suggest a "Test with pytest" step using the following:
pytest --cov=py2lispIDyOM --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml
Recommendation: Clarify how tests work, and enforce this by running tests on pushes and pull requests (see #5)
On the current master
branch, the tutorial notebooks work correctly. However, running this command from the base of the repository produces:
---------- coverage: platform linux, python 3.9.13-final-0 -----------
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml
========================================================================================= short test summary info =========================================================================================
FAILED tests/test_export.py::TestExport::test_csv_file_check - IndexError: list index out of range
FAILED tests/test_export.py::TestExport::test_export_csv_files - IndexError: list index out of range
FAILED tests/test_export.py::TestExport::test_export_mat_files - IndexError: list index out of range
FAILED tests/test_export.py::TestExport::test_mat_file_check - IndexError: list index out of range
FAILED tests/test_extract.py::TestExtract::test_experimentinfo_extract - IndexError: list index out of range
FAILED tests/test_extract.py::TestExtract::test_melodyinfo_extract - IndexError: list index out of range
FAILED tests/test_run.py::TestIDyOMExperiment::test_case_1 - FileExistsError: [Errno 17] File exists: 'experiment_history/TestCase1/'
FAILED tests/test_run.py::TestIDyOMExperiment::test_case_2 - AssertionError: test_dataset folder is empty!
Running this command after switching to the tests/
directory:
cd tests/
pytest --cov=py2lispIDyOM --cov-report=xml --cov-report=html --junitxml=junit/test-results.xml
results in one failed test:
---------- coverage: platform linux, python 3.9.13-final-0 -----------
Coverage HTML written to dir htmlcov
Coverage XML written to file coverage.xml
========================================================================================= short test summary info =========================================================================================
FAILED test_run.py::TestIDyOMExperiment::test_case_1 - FileExistsError: [Errno 17] File exists: 'experiment_history/TestCase1/'
Hello @xinyiguan
Thanks for your helpful project!
However, some music canβt be counted when project run to βmy_experiment.run ()β.
Error messages were attached to the question, and look forward to your answer~
** running lisp script **
To load "clsql":
Load 1 ASDF system:
clsql
; Loading "clsql"
To load "idyom":
Load 1 ASDF system:
idyom
; Loading "idyom"
..........
Inserting data into database: dataset 66022123143047.
Inserting data into database: dataset 99022123143047.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [REPLACE-FUNCTION] Call a different function with the same arguments
1: [CALL-FORM ] Call a different form
2: [RETRY ] Retry EVAL of current toplevel form.
3: [CONTINUE ] Ignore error and continue loading file "/Users/yousiqi/Downloads/install_idyom/experiment_history/21-02-23_14.30.43/compute.lisp".
4: [ABORT ] Abort loading file "/Users/yousiqi/Downloads/install_idyom/experiment_history/21-02-23_14.30.43/compute.lisp".
5: Ignore runtime option --load "experiment_history/21-02-23_14.30.43/compute.lisp".
6: Skip rest of --eval and --load options.
7: Skip to toplevel READ/EVAL/PRINT loop.
8: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(MAX) [external]
0]
*
** Finished! **
While evaluating the form starting at line 4, column 0
of #P"/Users/yousiqi/Downloads/install_idyom/experiment_history/21-02-23_14.30.43/compute.lisp":
debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR @52AD7DB4 in thread
#<THREAD "main thread" RUNNING {1001080003}>:
invalid number of arguments: 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.