SciSharp / SciSharp-Stack-Examples

Practical examples written in SciSharp's machine learning libraries
http://scisharpstack.org
Apache License 2.0
319 stars 103 forks source link

Dictionary with members count or item count? #60

Closed sascha-schwegelbauer closed 2 years ago

sascha-schwegelbauer commented 2 years ago

Hi!

I was just stepping through the example - one question regarding https://github.com/SciSharp/SciSharp-Stack-Examples/blob/bedbd284058774883229452f2c0e781dbe4c137a/src/TensorFlowNET.Examples/TextProcessing/DataHelpers.cs#L33

Isn't it a typo that just the current members count of the dictionary is put into it? My proposal would be: word_dict[word.Word] = word.Count;

If it's just a wrong interpretation of me - ignore this and nevermind.

Regards Sascha

PS: I think @Oceania2018 should be mentioned here :-)

Oceania2018 commented 2 years ago

@sascha-schwegelbauer I don't think it's a typo, it's encoding the dictonary as the incremental order.

sascha-schwegelbauer commented 2 years ago

@sascha-schwegelbauer I don't think it's a typo, it's encoding the dictonary as the incremental order.

Do you know why a dictionary was used if the absolute count is not needed? For just storing the order, I think a List would also be okay?

Oceania2018 commented 2 years ago

It's just to make an ID to every word in the dictionary.

sascha-schwegelbauer commented 2 years ago

It's just to make an ID to every word in the dictionary.

Thanks for the fast answers!