Package for parallelized feature selection methods
Project description
Parallel Feature Selector
A feature selection module that works in parallel among the processors
Installation
pip install parallel-feature-selector
Dependencies:
- pandas
- scikit-learn
- mpi4py
- arff2pandas
- openpyxl
MPI needs to be installed on the computer. For Windows:
- Install both Microsoft MPI v10.0 and Microsoft MPI SDK
- Set up environment variables -- C:\Program Files (x86)\Microsoft SDKs\MPI -- C:\Program Files\Microsoft MPI\Bin
- Install mpi4py with "conda install -c intel mpi4py" in Anaconda Prompt
Usage (Module)
Example Code:
import parallel_feature_selector as pfs
pfs.bruteForce(data, estimator, 0.2, 42, 10, 10, True, 'outputTimeAnalysis.csv', 'outputSubsetAnalysis.csv')
Function Parameters and Default Arguments:
def bruteForce(data, estimator, testSize=0.2, randomState=42, cv=5, topScoreNo=5, shuffle=True, timeResultFile='outputTimeAnalysis.csv', scoreResultFile='outputSubsetAnalysis.csv')
| Parameter | Description |
|---|---|
| data | pandas.DataFrame with column names and numerical values |
| esimator | scikit-learn esimator object |
| testSize | float, test size between 0 and 1 for train_test_split (Default = 0.2) |
| randomState | int or None, random state for train_test_split (Default = 42) |
| cv | int, fold number for cross-validation (Default = 5) |
| topScoreNo | int, specifies how many best-scoring subsets to print (Default = 5) |
| shuffle | bool, used to shuffle the data set before splitting (Default = True) |
| timeResultFile | Output file path for elapsed time results in csv format (Default = 'outputTimeAnalysis.csv') |
| scoreResultFile | Output file path for score and subset results in csv format (Default = 'outputSubsetAnalysis.csv') |
Usage (Script)
You can also run the code in terminal with the following arguments:
mpiexec -n [PROCESS_NO] python parallel_feature_selector.py [DATA_SET_PATH] [ESTIMATOR_NAME] [TEST_SIZE] [RANDOM_STATE] [CROSS_VALIDATION] [TOP_SCORE_NO] [SHUFFLE] [TIME_RESULT_PATH] [SCORE_RESULT_PATH]
- [RANDOM_STATE] must be given as integer ('None' can be given in module function)
- [SHUFFLE] must be given as integer, 1 for 'True' and 0 for 'False' ('True' or 'False' in module function)
Example:
mpiexec -n 4 python parallel_feature_selector.py C:\Users\BILGISAYAR\Desktop\AcademicPerformance.csv gnb 0.2 1 10 10 1 outputTimeAnalysis.csv outputSubsetAnalysis.csv
When running the script in terminal:
- .csv .xlsx .arff files can be used for input data set
- Available estimator arguments: gnb, bnb, knnMinkowski, knnEuclidean, svcRbf, svcPoly, logReg, dtEntropy, dtGini, rfEntropy, rfGini
| Terminal Argument | Scikit-Learn Estimator |
|---|---|
| gnb | GaussianNB() |
| bnb | BernoulliNB() |
| knnMinkowski | KNeighborsClassifier(n_neighbors=5, metric='minkowski') |
| knnEuclidean | KNeighborsClassifier(n_neighbors=5, metric='euclidean') |
| svcRbf | SVC(kernel = 'rbf', gamma='scale') |
| svcPoly | SVC(kernel = 'poly', gamma='scale') |
| logReg | LogisticRegression(solver='liblinear', multi_class='auto') |
| dtEntropy | DecisionTreeClassifier(criterion='entropy', random_state = 1) |
| dtGini | DecisionTreeClassifier(criterion='gini', random_state = 1) |
| rfEntropy | RandomForestClassifier(n_estimators=10, criterion='entropy', random_state=1) |
| rfGini | RandomForestClassifier(n_estimators=10, criterion='gini', random_state=1) |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parallel-feature-selector-0.1.1.tar.gz.
File metadata
- Download URL: parallel-feature-selector-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3317a50e04c352a4da66e8a47c77e473650a368b17696b3e213057eee7c4e43
|
|
| MD5 |
5c4dd0d24bb4d7237a4cab14f56eb352
|
|
| BLAKE2b-256 |
e6748a15df2d775de4e553670722240570a7b92a54daef29c392defe6cab6f4c
|
File details
Details for the file parallel_feature_selector-0.1.1-py3-none-any.whl.
File metadata
- Download URL: parallel_feature_selector-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b538d436892940069484b069e06ed65719484bb55d1641bda18054ca780a0722
|
|
| MD5 |
a22220e28022069fdee64849584ec33b
|
|
| BLAKE2b-256 |
8ed50be34fe9bfbba943e3e3c71e314ba5c1c228ae4fe623876779842ab3756a
|