Skip to content

Commit

Permalink
better legacy archive, prepare for later changes
Browse files Browse the repository at this point in the history
  • Loading branch information
PanyiDong committed Apr 9, 2022
1 parent 316344c commit 960c5f0
Show file tree
Hide file tree
Showing 7 changed files with 394 additions and 7 deletions.
65 changes: 65 additions & 0 deletions My_AutoML/_balancing/_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""
File: _legacy.py
Author: Panyi Dong
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_balancing/_legacy.py
File Created: Friday, 8th April 2022 9:19:36 pm
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Friday, 8th April 2022 9:19:56 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
MIT License
Copyright (c) 2022 - 2022, Panyi Dong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from ._over_sampling import SimpleRandomOverSampling, Smote
from ._under_sampling import (
SimpleRandomUnderSampling,
TomekLink,
EditedNearestNeighbor,
CondensedNearestNeighbor,
OneSidedSelection,
CNN_TomekLink,
)
from ._mixed_sampling import Smote_TomekLink, Smote_ENN
from My_AutoML._base import no_processing

balancings = {
"no_processing": no_processing,
"SimpleRandomOverSampling": SimpleRandomOverSampling,
"SimpleRandomUnderSampling": SimpleRandomUnderSampling,
"TomekLink": TomekLink,
"EditedNearestNeighbor": EditedNearestNeighbor,
"CondensedNearestNeighbor": CondensedNearestNeighbor,
"OneSidedSelection": OneSidedSelection,
"CNN_TomekLink": CNN_TomekLink,
"Smote": Smote,
"Smote_TomekLink": Smote_TomekLink,
"Smote_ENN": Smote_ENN,
}
43 changes: 43 additions & 0 deletions My_AutoML/_encoding/_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""
File: _legacy.py
Author: Panyi Dong
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_encoding/_legacy.py
File Created: Friday, 8th April 2022 9:20:03 pm
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Friday, 8th April 2022 9:20:14 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
MIT License
Copyright (c) 2022 - 2022, Panyi Dong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from ._encoding import DataEncoding

encoders = {"DataEncoding": DataEncoding}
74 changes: 74 additions & 0 deletions My_AutoML/_feature_selection/_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""
File: _legacy.py
Author: Panyi Dong
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_feature_selection/_legacy.py
File Created: Friday, 8th April 2022 9:20:27 pm
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Friday, 8th April 2022 9:20:55 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
MIT License
Copyright (c) 2022 - 2022, Panyi Dong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from ._base import RBFSampler
from ._advance import FeatureFilter, ASFFS, GeneticAlgorithm
from My_AutoML._base import no_processing

import autosklearn
import autosklearn.pipeline.components.feature_preprocessing

feature_selections = {
"no_processing": no_processing,
# "LDASelection": LDASelection,
# "PCA_FeatureSelection": PCA_FeatureSelection,
"RBFSampler": RBFSampler,
"FeatureFilter": FeatureFilter,
"ASFFS": ASFFS,
"GeneticAlgorithm": GeneticAlgorithm,
# 'densifier' : autosklearn.pipeline.components.feature_preprocessing.densifier.Densifier, # from autosklearn
"extra_trees_preproc_for_classification": autosklearn.pipeline.components.feature_preprocessing.extra_trees_preproc_for_classification.ExtraTreesPreprocessorClassification,
"extra_trees_preproc_for_regression": autosklearn.pipeline.components.feature_preprocessing.extra_trees_preproc_for_regression.ExtraTreesPreprocessorRegression,
# "fast_ica": autosklearn.pipeline.components.feature_preprocessing.fast_ica.FastICA,
# "feature_agglomeration": autosklearn.pipeline.components.feature_preprocessing.feature_agglomeration.FeatureAgglomeration,
# "kernel_pca": autosklearn.pipeline.components.feature_preprocessing.kernel_pca.KernelPCA,
# "kitchen_sinks": autosklearn.pipeline.components.feature_preprocessing.kitchen_sinks.RandomKitchenSinks,
"liblinear_svc_preprocessor": autosklearn.pipeline.components.feature_preprocessing.liblinear_svc_preprocessor.LibLinear_Preprocessor,
# "nystroem_sampler": autosklearn.pipeline.components.feature_preprocessing.nystroem_sampler.Nystroem,
# "pca": autosklearn.pipeline.components.feature_preprocessing.pca.PCA,
"polynomial": autosklearn.pipeline.components.feature_preprocessing.polynomial.PolynomialFeatures,
# "random_trees_embedding": autosklearn.pipeline.components.feature_preprocessing.random_trees_embedding.RandomTreesEmbedding,
# 'select_percentile' : autosklearn.pipeline.components.feature_preprocessing.select_percentile.SelectPercentileBase,
"select_percentile_classification": autosklearn.pipeline.components.feature_preprocessing.select_percentile_classification.SelectPercentileClassification,
"select_percentile_regression": autosklearn.pipeline.components.feature_preprocessing.select_percentile_regression.SelectPercentileRegression,
"select_rates_classification": autosklearn.pipeline.components.feature_preprocessing.select_rates_classification.SelectClassificationRates,
"select_rates_regression": autosklearn.pipeline.components.feature_preprocessing.select_rates_regression.SelectRegressionRates,
"truncatedSVD": autosklearn.pipeline.components.feature_preprocessing.truncatedSVD.TruncatedSVD,
}
54 changes: 54 additions & 0 deletions My_AutoML/_imputation/_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
"""
File: _legacy.py
Author: Panyi Dong
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_imputation/_legacy.py
File Created: Friday, 8th April 2022 9:21:08 pm
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Friday, 8th April 2022 9:21:33 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
MIT License
Copyright (c) 2022 - 2022, Panyi Dong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

from ._base import SimpleImputer, DummyImputer, JointImputer
from ._multiple import ExpectationMaximization, KNNImputer, MissForestImputer, MICE
from ._nn import GAIN

imputers = {
"SimpleImputer": SimpleImputer,
# 'DummyImputer' : DummyImputer,
"JointImputer": JointImputer,
"ExpectationMaximization": ExpectationMaximization,
"KNNImputer": KNNImputer,
"MissForestImputer": MissForestImputer,
"MICE": MICE,
"GAIN": GAIN,
}
90 changes: 90 additions & 0 deletions My_AutoML/_model/_legacy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
"""
File: _legacy.py
Author: Panyi Dong
GitHub: https://github.com/PanyiDong/
Mathematics Department, University of Illinois at Urbana-Champaign (UIUC)
Project: My_AutoML
Latest Version: 0.2.0
Relative Path: /My_AutoML/_model/_legacy.py
File Created: Friday, 8th April 2022 9:18:08 pm
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Friday, 8th April 2022 9:18:53 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
MIT License
Copyright (c) 2022 - 2022, Panyi Dong
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

import autosklearn.pipeline.components.classification
import autosklearn.pipeline.components.regression

####################################################################################################
# classifiers

classifiers = {
# classification models from autosklearn
"AdaboostClassifier": autosklearn.pipeline.components.classification.adaboost.AdaboostClassifier,
"BernoulliNB": autosklearn.pipeline.components.classification.bernoulli_nb.BernoulliNB,
"DecisionTree": autosklearn.pipeline.components.classification.decision_tree.DecisionTree,
"ExtraTreesClassifier": autosklearn.pipeline.components.classification.extra_trees.ExtraTreesClassifier,
"GaussianNB": autosklearn.pipeline.components.classification.gaussian_nb.GaussianNB,
"GradientBoostingClassifier": autosklearn.pipeline.components.classification.gradient_boosting.GradientBoostingClassifier,
"KNearestNeighborsClassifier": autosklearn.pipeline.components.classification.k_nearest_neighbors.KNearestNeighborsClassifier,
"LDA": autosklearn.pipeline.components.classification.lda.LDA,
"LibLinear_SVC": autosklearn.pipeline.components.classification.liblinear_svc.LibLinear_SVC,
"LibSVM_SVC": autosklearn.pipeline.components.classification.libsvm_svc.LibSVM_SVC,
"MLPClassifier": autosklearn.pipeline.components.classification.mlp.MLPClassifier,
"MultinomialNB": autosklearn.pipeline.components.classification.multinomial_nb.MultinomialNB,
"PassiveAggressive": autosklearn.pipeline.components.classification.passive_aggressive.PassiveAggressive,
"QDA": autosklearn.pipeline.components.classification.qda.QDA,
"RandomForest": autosklearn.pipeline.components.classification.random_forest.RandomForest,
"SGD": autosklearn.pipeline.components.classification.sgd.SGD,
}

# regressors
regressors = {
# regression models from autosklearn
"AdaboostRegressor": autosklearn.pipeline.components.regression.adaboost.AdaboostRegressor,
"ARDRegression": autosklearn.pipeline.components.regression.ard_regression.ARDRegression,
"DecisionTree": autosklearn.pipeline.components.regression.decision_tree.DecisionTree,
"ExtraTreesRegressor": autosklearn.pipeline.components.regression.extra_trees.ExtraTreesRegressor,
"GaussianProcess": autosklearn.pipeline.components.regression.gaussian_process.GaussianProcess,
"GradientBoosting": autosklearn.pipeline.components.regression.gradient_boosting.GradientBoosting,
"KNearestNeighborsRegressor": autosklearn.pipeline.components.regression.k_nearest_neighbors.KNearestNeighborsRegressor,
"LibLinear_SVR": autosklearn.pipeline.components.regression.liblinear_svr.LibLinear_SVR,
"LibSVM_SVR": autosklearn.pipeline.components.regression.libsvm_svr.LibSVM_SVR,
"MLPRegressor": autosklearn.pipeline.components.regression.mlp.MLPRegressor,
"RandomForest": autosklearn.pipeline.components.regression.random_forest.RandomForest,
"SGD": autosklearn.pipeline.components.regression.sgd.SGD,
}


"""
LibSVM_SVR, MLP and SGD have problems of requiring inverse_transform
of StandardScaler while having 1D array
https://github.com/automl/auto-sklearn/issues/1297
problem solved
"""
14 changes: 7 additions & 7 deletions My_AutoML/_model_selection/_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Author: Panyi Dong (panyid2@illinois.edu)
-----
Last Modified: Thursday, 7th April 2022 4:02:23 pm
Last Modified: Friday, 8th April 2022 9:22:44 pm
Modified By: Panyi Dong (panyid2@illinois.edu)
-----
Expand Down Expand Up @@ -60,12 +60,12 @@
from sklearn.utils._testing import ignore_warnings
from sklearn.exceptions import ConvergenceWarning

from My_AutoML._encoding import encoders
from My_AutoML._imputation import imputers
from My_AutoML._balancing import balancings
from My_AutoML._scaling import scalings
from My_AutoML._feature_selection import feature_selections
from My_AutoML._model import (
from My_AutoML._encoding._legacy import encoders
from My_AutoML._imputation._legacy import imputers
from My_AutoML._balancing._legacy import balancings
from My_AutoML._scaling._legacy import scalings
from My_AutoML._feature_selection._legacy import feature_selections
from My_AutoML._model._legacy import (
classifiers,
regressors,
)
Expand Down
Loading

0 comments on commit 960c5f0

Please sign in to comment.