Python में Hyperparameter Tuning
Alex Scriven
Data Scientist
हाइपरपैरामीटर्स:

एक साधारण रैंडम फॉरेस्ट एस्टीमेटर बनाएँ और प्रिंट करें:
rf_clf = RandomForestClassifier() print(rf_clf)RandomForestClassifier(n_estimators='warn', criterion='gini', max_depth=None, max_features='auto', max_leaf_nodes=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_jobs=None, oob_score=False, random_state=None, verbose=0,bootstrap=True, class_weight=None, warm_start=False)
और जानकारी: http://scikit-learn.org
n_estimators पैरामीटर लें.
डेटा टाइप और डिफॉल्ट वैल्यू:
n_estimators : integer, optional (default=10)
परिभाषा:
The number of trees in the forest.
एस्टीमेटर बनाते समय कुछ हाइपरपैरामीटर्स सेट करें:
rf_clf = RandomForestClassifier(n_estimators=100, criterion='entropy')
print(rf_clf)
RandomForestClassifier(n_estimators=100, criterion='entropy',
max_depth=None, max_features='auto', max_leaf_nodes=None,
min_impurity_decrease=0.0, min_impurity_split=None,
min_samples_leaf=1, min_samples_split=2,
min_weight_fraction_leaf=0.0, n_jobs=None,
oob_score=False, random_state=None, verbose=0,bootstrap=True,
class_weight=None, warm_start=False)
Logistic Regression के हाइपरपैरामीटर्स देखें:
log_reg_clf = LogisticRegression()print(log_reg_clf) LogisticRegression(C=1.0, class_weight=None, dual=False, fit_intercept=True, intercept_scaling=1, max_iter=100, multi_class='warn', n_jobs=None, penalty='l2', random_state=None, solver='warn', tol=0.0001, verbose=0, warm_start=False)
इस एल्गोरिदम में tune करने के लिए कम हाइपरपैरामीटर्स हैं!
कुछ हाइपरपैरामीटर्स दूसरों से ज़्यादा महत्वपूर्ण होते हैं.
कुछ मॉडल के प्रदर्शन में मदद नहीं करेंगे:
रैंडम फॉरेस्ट क्लासिफायर के लिए:
n_jobsrandom_state verboseसभी हाइपरपैरामीटर्स को 'train' करना समझदारी नहीं है
कुछ महत्वपूर्ण हाइपरपैरामीटर्स:
n_estimators (उच्च मान)max_features (विभिन्न मान आज़माएँ)max_depth और min_sample_leaf (overfitting के लिए अहम)criterionध्यान रखें: यह सिर्फ़ एक गाइड है
सीखने के कुछ स्रोत:
Python में Hyperparameter Tuning