TFIDF ( term frequency–inverse document frequency ) is a statistical approach that is popular in text mining to say how important a word is to a sentence in a whole document. You can use sklearn package of python to easily get vector representation of words in a sentence. However, the default settings of TFIDF in sklearn package only consider two or multi-length words of a document as token. Since single length words are not important in English literature (e.g. 'a', 'b', 'c', ... 'z'); you don't need to worry about the process and you can easily use this package in your application. The interesting fact is that the single length tokens or letters could be very important feature in other languages or domains. Hence, you need to be careful to change the default settings and get vectors for all the tokens. The default token_pattern regexp in TfidfVectorizer selects words which have at least 2 chars. To change the settings, we can update the regular ex...
মেশিন লানিং (Machine learning) এর একটা খুবই পরিচিত শব্দ হচ্ছে F1 score। সাধারণত কোন মডেলের পারফরমেন্স কেমন সেটা বুঝার জন্যে F1 ব্যবহার হয়; F1 score এর মান যত বেশী হয়, মডেল তত ভাল ধরে নেওয়া হয়। কিন্তু আমারা কি জানি, আসলে F1 score আমাদের কি বলে? F1 score স্কোর বেশী হলে, মডেল ভাল কিন্তু আসলে মডেলের কোন দিকটি ভাল? Accuracy বেশী হলেও, একটি মডেলকে ভাল বলা হয়, কিন্তু তাহলে accuracy এবং F1 এর মাঝে পার্থক্য কোথায়? সহজ কথায় আমার কি F1 score দেখে পরিষ্কার ভাবে বোঝতে পারি ঠিক কোথায় আমাদের মডেল ভালভাবে কাজ করছে? এই সমস্ত প্রশ্নের উত্তর সহজ কিছু উদাহরণ দিয়ে ব্যাখ্যা দেওয়ার জন্যেই আজকের এই পোষ্ট। ধরুন, আপনার একটি মডেল আছে যেটি আপনার এক্সরে ছবি দেখে বলে দিতে পারে আপনার বুকের মাঝে ক্যান্সার আছে কিনা। এখন ক্যান্সার ছবি সনাক্তে ৪ ধরনের ঘটনা ঘটতে পারে। ১) ছবিটিতে ক্যান্সার আছে এবং মডেল বলল ক্যান্সার আছে। ২) ছবিটিতে ক্যান্সার নেই, মডেল বলল ক্যান্সার নেই। ৩) ছবিটিতে...