Arefin Anwar
যখন মেশিন লার্নিং মডেলের কথা আসে, তখন অনেক সময় একটি মাত্র ডিসিশন ট্রি আমাদের কাঙ্ক্ষিত ফলাফল দিতে পারে না। ঠিক তখনই আসে র্যান্ডম ফরেস্ট, একটি শক্তিশালী এবং কার্যকরী অ্যালগরিদম যা একাধিক ডিসিশন ট্রি ব্যবহার করে আরও নির্ভুল এবং স্থিতিশীল প্রেডিকশন করতে পারে। র্যান্ডম ফরেস্ট একটি এনসেম্বল মডেল (একাধিক মডেলের সমন্বয়ে তৈরি মডেল)। এটি একাধিক ডিসিশন ট্রি তৈরি করে এবং সেগুলোর ফলাফলকে একত্রিত করে চূড়ান্ত সিদ্ধান্তে পৌঁছায়। ক্লাসিফিকেশনের ক্ষেত্রে এটি প্রতিটি ট্রি থেকে ভোট নিয়ে মেজরিটি ভোটকে প্রেডিকশন হিসেবে গণনা করে। আর রিগ্রেশনের ক্ষেত্রে, এটি সমস্ত ট্রির আউটপুটের গড়কে চূড়ান্ত ফলাফল হিসেবে গ্রহণ করে।
অর্থাৎ একাধিক ডিসিশন ট্রি (৫০-১০০) একত্র করে যে মডেল প্রেডিকশন দেয়, তাই ই হলো রেনডম ফরেস্ট মডেল।
র্যান্ডম ফরেস্টের কাজের ধাপগুলোকে সহজভাবে ব্যাখ্যা করা যাক (আবারো বলি, এসব জিনিস বুঝার জন্য লেখা, ইউজ করতে তোমাকে জাস্ট লাইব্রেরি ফাংশন কল করতে হবে):
১. বুটস্ট্র্যাপ স্যাম্পল তৈরি:
র্যান্ডম ফরেস্ট ট্রেনিং ডেটা থেকে একাধিক স্যাম্পল তৈরি করে। প্রতিটি স্যাম্পল মূল ডেটার থেকে এলোমেলোভাবে তৈরি হয় এবং এটি ডুপ্লিকেট ডেটাও রাখতে পারে। এই প্রক্রিয়াকে বলা হয় বুটস্ট্র্যাপিং।
২. ডিসিশন ট্রি তৈরি:
প্রতিটি বুটস্ট্র্যাপ স্যাম্পল দিয়ে একটি ডিসিশন ট্রি তৈরি করা হয়। তবে, প্রতিটি নোড বিভাজনের সময়, এটি পুরো ফিচার সেটের বদলে এলোমেলোভাবে নির্বাচন করা একটি সাবসেট ব্যবহার করে। এই এলোমেলোতা ট্রিগুলোর ভিন্নতা নিশ্চিত করে।
৩. প্রেডিকশন করা:
নতুন ডেটা আসার পর, র্যান্ডম ফরেস্টের প্রতিটি ট্রি প্রেডিকশন করে। ক্লাসিফিকেশনের ক্ষেত্রে, প্রতিটি ট্রি তার ভোট দেয়, এবং সবচেয়ে বেশি ভোট পাওয়া লেবেলটি চূড়ান্ত প্রেডিকশন হয়। রিগ্রেশনের ক্ষেত্রে, সব ট্রির প্রেডিকশনের গড় চূড়ান্ত ফলাফল হিসেবে নির্ধারিত হয়।
ধরো, তুমি একটি বাগান দেখতে গিয়েছো, যেখানে বিভিন্ন ধরনের গাছ রয়েছে। তুমি জানতে চাও, একটি বিশেষ গাছের ফল খাওয়া যাবে কি না। যদি তুমি একটি ডিসিশন ট্রি ব্যবহার করো, তবে এটি একটি নির্দিষ্ট পথ ধরে সিদ্ধান্ত দেবে। কিন্তু, যদি একাধিক গাছ (র্যান্ডম ফরেস্ট) ব্যবহার করো এবং তাদের সবাইকে আলাদাভাবে জিজ্ঞাসা করো, তখন সবচেয়ে বেশি সংখ্যক গাছ যে উত্তর দেবে, সেটাই হবে তোমার চূড়ান্ত সিদ্ধান্ত। এতে করে ভুলের সম্ভাবনা অনেক কমে যাবে।
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
# উদাহরণস্বরূপ ডেটাসেট তৈরি (Iris dataset)
from sklearn.datasets import load_iris
iris = load_iris()
X = iris.data
y = iris.target
# ডেটাকে ট্রেন ও টেস্ট সেটে ভাগ করা
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
# র্যান্ডম ফরেস্ট ক্লাসিফায়ার মডেল তৈরি
rf_model = RandomForestClassifier(n_estimators=100, random_state=42)
# মডেল ট্রেন করা
rf_model.fit(X_train, y_train)
# প্রেডিকশন করা
y_pred = rf_model.predict(X_test)
# একুরেসি মাপা
accuracy = accuracy_score(y_test, y_pred)
print(f'র্যান্ডম ফরেস্ট মডেলের একুরেসি: {accuracy:.2f}')
র্যান্ডম ফরেস্টের সুবিধা:
নানান ধরনের ডেটার জন্য কার্যকরী: এটি ক্লাসিফিকেশন এবং রিগ্রেশন উভয় ক্ষেত্রেই ভালো কাজ করে।
হাই একুরেসি: একাধিক ডিসিশন ট্রি ব্যবহার করায় এটি স্থিতিশীল এবং নির্ভুল ফলাফল দেয়।
ওভারফিটিং রোধ: এলোমেলো ফিচার নির্বাচন এবং বুটস্ট্র্যাপিং এর কারণে এটি ওভারফিটিং কমায়।
অ্যানমলি ডিটেকশন: এটি অ্যানমলি বা ব্যতিক্রমী ডেটা সনাক্ত করতে খুব কার্যকর।

Fascinating to see how gaming evolved in the Philippines! Platforms like Sugal777, with its accessible design, really cater to a growing market. Curious how the “magical forest” theme impacts player experience? Check out sugal777 download for a unique approach to online casinos!
Checking out pkrbet. See if you can turn a small investment into a fortune. Could be fun for a night. pkrbet
I’ve been messing around with jilicrown24 and it’s not bad at all. A pretty solid platform to checkout, it’s worth a look-see. Check it out here: jilicrown24
Jilibetonlinegames is the perfect place to relax and enjoy a new experience. The site is easy to navigate and you’ll never get bored! Take a deep dive : jilibetonlinegames
Just stumbled across aa8881 and decided to give it a whirl. Gotta say, the layout is pretty appealing. Let’s see how it goes! Check it out aa8881
Alright, x666gameapk, let’s see what you’ve got! Always on the hunt for the latest game APKs. Hopefully they’re bug-free. Grab yours x666gameapk
Lobbo888, that’s a fun name! Does it mean I’ll win triple the amount? Hope they have some cool promos. Trying my luck today! Find it here: lobbo888
Pokijogos is where it’s at. I recently found their site. So much easier to use than some others I’ve seen. Definitely my new go-to. pokijogos
S666welcome gives you a generous welcome bonus. I have been playing with it for awhile. Don’t miss it s666welcome.
Been playing at 68jlcasino for a while now and I gotta say, it’s not bad! The payouts are pretty consistent and the support team is helpful. Give it a try folks! Check it out here: 68jlcasino
Yo, tclottert’s site is alright. They seem to have some decent info on lottery stuff. I’m not saying it’s amazing, but it’s a useful resource. Give it a look-see: tclottert
The freshcasinoapp is surprisingly well optimized. Runs smooth on my phone, even on some of the more intense games. Definitely an upgrade from some other apps I’ve used. Download freshcasinoapp if you’re into mobile gaming.
Alright fellas, gamebetcom seems to be buzzing with activity. Anyone got any inside scoop? Seriously though, any opinions on gamebetcom before I dive in?
G’day, legends! I tried slotroyal01 and it was pretty sweet, to be honest. Plenty of slots to choose from and the bonuses don’t seem too shabby. Give it a burl: slotroyal01
Alright, time to give jili711casino a spin! I’ve heard some rumblings. Hopefully they pay out. Putting my luck to the test! Check it out for yourself jili711casino!
Trying to remember my 50jililogin. Swear I wrote it down somewhere. Oh well, password reset here I come!
Heard decent things about ph23casino. Might try my luck on their slots tonight. Someone send good vibes!
9apiso https://www.n9apiso.net
1plusph Casino: Best Online Slots in the Philippines. Quick Login, Easy Register, and App Download. Join 1plusph Casino for the best online slots in the Philippines. Enjoy fast 1plusph login, easy 1plusph register, and a quick 1plusph app download. Play premium 1plusph slot games and start winning big today! visit: 1plusph
onebra.com é confiável – that’s the question, isn’t it? Is it trustworthy? I’m always skeptical before putting my money anywhere. Does it really work for onebra.com é confiável?
Sv388thomosv388… Never heard of this before. Seems niche, what is it used to play? I would like to know more information before testing sv388thomosv388.
Jilipark app looks interesting! Mobile gaming is my jam. Is the app smooth and easy to use? Downloading now… let’s see what it’s all about because of jilipark app!
Heard about kk222game from a buddy, and man, it’s legit! Good vibes all around. You gotta try this, for real kk222game.
K9game is my secret weapon for unwinding after work. Gets my mind off things. Give it a shot, you need this k9game.
Downloaded the 51clubapp from 51clubapp.info. The App works perfectly well so far! Great gaming experience on my phone. Worth trying! Find the app at 51clubapp
Basic strategy’s all about minimizing the house edge, right? Seeing platforms like 888phl vip cater to Filipino players with easy access via app & web is smart. Verification is key for legit play, too! 👍