Parsing, Ini matrix#9
Parsing, Ini matrix#9maxtretiakov wants to merge 11 commits intovmkononenko:devfrom maxtretiakov:dev
Conversation
vmkononenko
left a comment
There was a problem hiding this comment.
- Try to go further to your end goal and try to use your dataset classes from the
tct_hmm.pyscript. It'll highlight and dictate some of the structural changes. - Your commit messages need to be improved. Get familiar with these guidelines: https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53
| pass | ||
|
|
||
|
|
||
| class Iso_Dataset(Dataset): |
There was a problem hiding this comment.
first things first:
- Each child dataset implementation should have a separate class.
- Please decide which naming style are you going to use - if it's camel case then you'll have
IsoDataset.
| class Iso_Dataset(Dataset): | ||
|
|
||
| # assume we have chord_id dictionary which maps Chords into ids | ||
| def get_hmm_matrix_i(self, chord_id, dir_path): |
There was a problem hiding this comment.
What's the point of having this function duplicated in each child class? We discussed earlier that this is a parent class job.
| # assume we have chord_id dictionary which maps Chords into ids | ||
| def get_hmm_matrix_i(self, chord_id, dir_path): | ||
| chord_id = {} | ||
| song_list = self.load(dir_path) |
There was a problem hiding this comment.
why don't you use songlist defined in parent?
| song_list = self.load(dir_path) | ||
| i_matrix = np.array(len(chord_id), dtype=float) | ||
| for song in song_list: | ||
| i_matrix[chord_id.get(song.chords_list[0].label)] += 1 #для каждого аккорда получили кол-во раз, когда аккорд являлся первым в песне |
There was a problem hiding this comment.
please use English for all comments/code/variable names etc.
| i_matrix = np.array(len(chord_id), dtype=float) | ||
| for song in song_list: | ||
| i_matrix[chord_id.get(song.chords_list[0].label)] += 1 #для каждого аккорда получили кол-во раз, когда аккорд являлся первым в песне | ||
| i_matrix = i_matrix/len(song_list) #оцениваем вероятность через частоту |
There was a problem hiding this comment.
please use English for all comments/code/variable names etc.
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| Iso_Dataset().load("D:\\ChordsRecognition\\music-dsp\\tools\\DatasetExtraction\\test_chords_txt\\*.txt") |
There was a problem hiding this comment.
no hardcoding of your dev machine specific stuff, no one needs it except of you
| def __init__(self, chords_list): | ||
| self.chords_list = chords_list | ||
| try: | ||
| if chords_list[0].label == 'N': |
There was a problem hiding this comment.
why are you removing "no chord" representation?
| @@ -0,0 +1,62 @@ | |||
| 0.000000 2.612267 N | |||
There was a problem hiding this comment.
As far I understand these are your test files generated for checking correctness of the loading mechanism?
In this case we don't need them in the repo. Otherwise think through file/directory structure and come up with self explanatory naming. How's one supposed to know what dataset and song is represented by 1.txt?
| if label == 'Emin/4': | ||
| label = 'E:min/4' | ||
| elif label == 'A7/3': | ||
| label = 'A:7/3' | ||
| elif label == 'Bb7/3': | ||
| label = 'Bb:7/3' | ||
| elif label == 'Bb7/5': | ||
| label = 'Bb:7/5' |
There was a problem hiding this comment.
Looks like this can all be done with a simple generic logic for all cases without hardcoding.
| splits = line.split() | ||
| if len(splits) == 3: | ||
| s = splits[0] | ||
| e = splits[1] | ||
| l = self.label_error_modify(splits[2]) |
There was a problem hiding this comment.
this types of parsing always deserves a comment. Just give an example of a string to be parsed and highlight what is s, e and l. I had to go and look up dataset format to find out.
No description provided.