Ensemble Empirical Mode Decomposition (EEMD)

Feature extraction and supervised classification using EEMD

This function takes time series for turning cutting tests as inputs. It ask user to enter the file paths for the data files. If user specify that the decompositions for EEMD have already been computed, algorithm will ask user to enter the file paths for the decompositions. Otherwise, it will compute the IMFs and ask users to enter the file paths where they want to save these decompositions. Based on given stickout length cases and corresponding informative IMF numbers, it will generate the feature matrix and perform the classification with specified classification algorithm by user. It returns the results in an array and prints the total elapsed time.

EEMD_Feature_Extraction.EEMD_Feature_Extraction(stickout_length, EEMDecs, p, Classifier)[source]
Parameters:
  • (stickout_lengths) (str) –

    The distance between heel of the boring bar and the back surface of the cutting tool

    • if stickout length is 2 inch, ‘2’
    • if stickout length is 2.5 inch, ‘2p5’
    • if stickout length is 3.5 inch, ‘3p5’
    • if stickout length is 4.5 inch, ‘4p5’
  • (EEMDecs) (str) –
    • if decompositions have already been computed, ‘A’
    • if decompositions have not been computed, ‘NA’
  • (p) (int) – Informative intrinsic mode function (IMF) number
  • (Classifier) (str) –

    Classifier defined by user

    • Support Vector Machine: ‘SVC’
    • Logistic Regression: ‘LR’
    • Random Forest Classification: ‘RF’
    • Gradient Boosting: ‘GB’
Returns:
results:

(np.array([])) Classification results for training and test set for all combination of ranked features and devition for both set.

  • first column: mean accuracies for training set
  • second column: deviation for training set accuracies
  • third column: mean accuracies for test set
  • fourth column: deviation for test set accuracies
time:

(str) Elapsed time during feature matrix generation and classification

Example:
>>> from EEMD_Feature_Extraction import EEMD_Feature_Extraction
 
#parameters
>>> stickout_length='2'
>>> EEMDecs = 'A'
>>> p=2
>>> Classifier = 'SVC'

>>> results = EEMD_Feature_Extraction(stickout_length, EEMDecs, 
>>>                                  p, Classifier)     
Enter the path of the data files:
>>> D\...\cutting_tests_processed\data_2inch_stickout
Enter Enter the path of EEMD files:
>>> D\...\eIMFs\data_2inch_stickout

Transfer Learning Application Using EEMD

This function uses transfer learning principles on two differen stickout cases for cutting data set. It uses one of the cases as training set and train a specified classifier on this data set, then it tests the classfier on the other cases provided by the user. This functions assumes that the IMFs for EEMD have alread been computed and it asks the paths for data files and decompositions (IMFs). The informative IMF numbers should be provided by user for training and test set seperately. Then, function will generate feature matrix and perform classfication with chosen algorithm by user. It returns the results in a np.array and prints the total elapsed time.

EEMD_Transfer_Learning.EEMD_Transfer_Learning(stickout_length_training, stickout_length_test, p_train, p_test, Classifier)[source]
Parameters:
  • (stickout_length_training) (str) –

    Stickout length for the training data set

    • if stickout length is 2 inch, ‘2’
    • if stickout length is 2.5 inch, ‘2p5’
    • if stickout length is 3.5 inch, ‘3p5’
    • if stickout length is 4.5 inch, ‘4p5’
  • (stickout_length_test) (str) –

    Stickout length for the test data set

    • if stickout length is 2 inch, ‘2’
    • if stickout length is 2.5 inch, ‘2p5’
    • if stickout length is 3.5 inch, ‘3p5’
    • if stickout length is 4.5 inch, ‘4p5’
  • (p_train) (int) – Informative intrinsic mode function (IMF) number for training set
  • (p_test) (int) – Informative intrinsic mode function (IMF) number for test set
  • (Classifier) (str) –

    Classifier defined by user

    • Support Vector Machine: ‘SVC’
    • Logistic Regression: ‘LR’
    • Random Forest Classification: ‘RF’
    • Gradient Boosting: ‘GB’
Returns:
results:

(np.array([])) Classification results for training and test set for all combination of ranked features and devition for both set.

  • first column: mean accuracies for training set
  • second column: deviation for training set accuracies
  • third column: mean accuracies for test set
  • fourth column: deviation for test set accuracies
time:

(str) Elapsed time during feature matrix generation and classification

Example:
>>> from EEMD_Feature_Extraction import EEMD_Feature_Extraction
 
#parameters
>>> stickout_length_training='2'
>>> stickout_length_test='4p5'
>>> p_train = 2
>>> p_test = 1
>>> Classifier = 'GB'

>>> results = EEMD_Transfer_Learning(stickout_length_training, 
                                     stickout_length_test, 
>>>                                  p_train, p_test,
                                     Classifier)     
Enter the path of training data files:
>>> D\...\cutting_tests_processed\data_2inch_stickout
Enter the path of test data files:
>>> D\...\cutting_tests_processed\data_4p5inch_stickout
Enter the path to decompositions for training set:
>>> D\...\eIMFs\data_2inch_stickout
Enter the path to decompositions for test set:
>>> D\...\eIMFs\data_4p5inch_stickout  

Transfer Learning On Two Cases Using EEMD

This code takes four different stickout cases in an array from user. It uses first two cases as training set samples and remaining two cases are considered as test set data sets. Algorithm assumes that the IMFs for EEMD have alredy been computed and saved. The file paths to the IMFs and data files should be included in ‘file_paths.txt’ file and this file should be in the same folder with this function. This function generates the feature matrices for training and test correponding to given stickout cases and their informative Intrinsic Mode Functions (IMFs). It perform classification based on classifier name specified by the user. It returns the mean accuracies and deviations in a np.array([]). It also prints the total elapsed time.

EEMD_Transfer_Learning_2case.EEMD_Transfer_Learning_2case(stickout_lengths, IMF_Number, Classifier)[source]
Parameters:
  • (file_path.txt) (str) – Algorithm needs .txt file whose name is ‘file_paths.txt’ to add the paths of the data files and their corresponding decompositions. This .txt file should include 8 file path, four for data files and four for decompositions.First four file paths are for data files (time series). Other four are considered as paths to the decompositions. Each line in .txt file should include only one path. The ordering for the paths is such that the first path represents first case of training set data files. Second path is for the second case of training set data files. Third and fourth paths represent first test set case and second test set case data files. Same ordering should be followed for the paths of decompositions.
  • (stickout_lengths) (str) –

    Training and test set cases in a np.array([]). The algorithm considers the first two entry as training set cases and remanining ones as test set cases.

    • if stickout length is 2 inch, ‘2’
    • if stickout length is 2.5 inch, ‘2p5’
    • if stickout length is 3.5 inch, ‘3p5’
    • if stickout length is 4.5 inch, ‘4p5’
  • (IMF_Number) (int) – Corresponding Informative Intrinsic Mode Function (IMF) numbers in an array for cases given in stickout_lengths. First two entry are considered as training set IMFs and remaining ones are for test set IMFs.
  • (Classifier) (str) –

    Classifier defined by user

    • Support Vector Machine: ‘SVC’
    • Logistic Regression: ‘LR’
    • Random Forest Classification: ‘RF’
    • Gradient Boosting: ‘GB’
Returns:
results:

(np.array([])) Classification results for training and test set for all combination of ranked features and devition for both set.

  • first column: mean accuracies for training set
  • second column: deviation for training set accuracies
  • third column: mean accuracies for test set
  • fourth column: deviation for test set accuracies
time:

(str) Elapsed time during feature matrix generation and classification

Example:
>>> from EEMD_Transfer_Learning_2case import EEMD_Transfer_Learning_2case

#parameters
 
>>> stickout_lengths = ['2','2p5','3p5','4p5']
>>> IMF_Number=[2,2,1,1]
>>> Classifier = 'RF'

>>> results = EEMD_Transfer_Learning_2case(stickout_lengths,IMF_Number,Classifier)