[973ab6]: / Stats / __pycache__ / FeatureSelection.cpython-36.pyc

Download this file

84 lines (79 with data), 6.8 kB

3

ZSöX«Ń@sÉddlmZddlmZddlmZddlmZddlmZddlmZddl	Z	ddl
mZd	Zd
Z
d	gZdZdZd	Zd
ZdZGddädâZdS)Ú)┌ensemble)┌feature_selection)┌tree)┌svm)┌SVR)┌RandomizedLogisticRegressionN)┌	CONSTANTSzMohsen Mesgarpourz-Copyright 2016, https://github.com/mesgarpour┌GPLz1.xzmohsen.mesgarpour@gmail.com┌Developmentc@s^eZdZddäZddäZddäZddäZd	d
äZddäZdddäZ	ddäZ
ddäZddäZdS)┌FeatureSelectioncCstjtjâ|_|jjtâdS)N)┌logging┌	getLoggerr┌app_name┌_FeatureSelection__logger┌debug┌__name__)┌selfęr˙VC:\Users\eagle\Documents\GitHub\UoW_Docobo\IntegratedCare_py\Stats\FeatureSelection.py┌__init__szFeatureSelection.__init__cKs4|jjtâ|jjdâtjf|Ä}|j||â}|S)a÷random forest classifier (Brieman)
        model.estimators_
        model.classes_
        model.n_classes_
        model.n_features_
        model.n_outputs_
        model.feature_importances_

        n_estimators=10, criterion='gini', max_depth=None, min_samples_split=2, min_samples_leaf=1,
        min_weight_fraction_leaf=0.0, max_features='auto', max_leaf_nodes=None, bootstrap=True,
        oob_score=False, n_jobs=-1, random_state=None, verbose=0, warm_start=False, class_weight=None
        z*Running Random Forest Classifier (Brieman))rrr┌inforZRandomForestClassifier┌fit)r┌features_indep┌feature_target┌kwargs┌
classifier┌modelrrr┌rank_random_forest_breimans

z+FeatureSelection.rank_random_forest_breimancKs2|jjtâ|jjdâtf|Ä}|j||â}|S)aúrandom forest classifier (Brieman)
        model.estimators_
        model.classes_
        model.n_classes_
        model.n_features_
        model.n_outputs_
        model.feature_importances_

        C=1, scaling=0.5, sample_fraction=0.75, n_resampling=200, selection_threshold=0.25, tol=0.001,
        fit_intercept=True, verbose=False, normalize=True, random_state=None, n_jobs=1, pre_dispatch='3*n_jobs'
        z"Running Random Logistic Regression)rrrrrr)rrrrrrrrr┌rank_random_logistic_regression/s

z0FeatureSelection.rank_random_logistic_regressioncKs4|jjtâ|jjdâtjf|Ä}|j||â}|S)a┬C-Support Vector Classification
        model.support_
        model.support_vectors_
        model.n_support_
        model.dual_coef_
        model.coef_
        model.intercept_

        C=1.0, kernel='linear', degree=3, gamma='auto', coef0=0.0, shrinking=True, probability=False,
        tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=-1, decision_function_shape=None,
        random_state=None, sample_weight=None
        z'Running C-Support Vector Classification)rrrrr┌SVCr)rrrrrrrrr┌rank_svm_c_supportBs

z#FeatureSelection.rank_svm_c_supportcKs4|jjtâ|jjdâtjf|Ä}|j||â}|S)adecision tree classifier (Brieman)
        model.classes_
        model.feature_importances_
        model.max_features_
        model.n_classes_
        model.n_features_
        model.n_outputs_
        model.tree_

        criterion='gini', splitter='best', max_depth=None, min_samples_split=2, min_samples_leaf=1,
        min_weight_fraction_leaf=0.0, max_features=None, random_state=None, max_leaf_nodes=None, class_weight=None,
        presort=True, sample_weight=None, check_input=True, X_idx_sorted=None
        z*Running Decision Tree Classifier (Brieman))rrrrrZDecisionTreeClassifierr)rrrrrrrrr┌rank_tree_briemanVs
z"FeatureSelection.rank_tree_briemancKs4|jjtâ|jjdâtjf|Ä}|j||â}|S)aÎGradient Boosted Regression Trees (GBRT)
        model.feature_importances_
        model.train_score_
        model.loss_
        model.init
        model.estimators_

        loss='ls', learning_rate=0.1, n_estimators=100, subsample=1.0, min_samples_split=2, min_samples_leaf=1,
        min_weight_fraction_leaf=0.0, max_depth=3, init=None, random_state=None, max_features=None, alpha=0.9,
        verbose=0, max_leaf_nodes=None, warm_start=False, presort=True
        z0Running Gradient Boosted Regression Trees (GBRT))rrrrrZGradientBoostingRegressorr)rrrrrrrrr┌rank_tree_gbrtks
zFeatureSelection.rank_tree_gbrt┌linearcCsF|jjtâ|jjdât|dŹ}tj|dddddŹ}|j||â}|S)z═Feature ranking with recursive feature elimination
        model.n_features_
        model.support_   # selected features
        model.ranking_
        model.grid_scores_
        model.estimator_
        z:Running Feature Ranking with Recursive Feature Elimination)┌kernelÚNr)┌	estimator┌step┌cv┌scoring┌verbose)rrrrrr┌RFECVr)rrrr$r&┌selectorrrrr┌selector_logistic_rfe~s
z&FeatureSelection.selector_logistic_rfecCs|j||tj|âS)N)┌5_FeatureSelection__selector_univarite_selection_kbestr┌chi2)rrr┌kbestrrr┌'selector_univarite_selection_kbest_chi2Ćsz8FeatureSelection.selector_univarite_selection_kbest_chi2cCs|j||tj|âS)N)r.r┌	f_classif)rrrr0rrr┌,selector_univarite_selection_kbest_f_classifôsz=FeatureSelection.selector_univarite_selection_kbest_f_classifcCsL|jjtâ|jjdâtt|â|jdâ}tj||dŹ}|j	||â}|S)zmUnivariate feature selection with configurable strategy
        model.scores_
        model.pvalues_
        z?Running Univariate Feature Selection with Configurable Strategyr%)┌
score_func┌k)
rrrr┌int┌float┌shaper┌SelectKBestr)rrrr4r0r,rrrrZ$__selector_univarite_selection_kbestŚs
z5FeatureSelection.__selector_univarite_selection_kbestN)r#)
r┌
__module__┌__qualname__rrrr r!r"r-r1r3r.rrrrrs
r)┌sklearnrrrr┌sklearn.svmrZsklearn.linear_modelrr┌Configs.CONSTANTSr┌
__author__┌
__copyright__┌__credits__┌__license__┌__version__┌__maintainer__┌	__email__┌
__status__rrrrr┌<module>s