diff --git a/multiview_platform/execute.py b/multiview_platform/execute.py index 47f485fbdb3e729872d402f92e2b3bc76c85449c..5772286a7c562fed60466478956d673d4bd04145 100644 --- a/multiview_platform/execute.py +++ b/multiview_platform/execute.py @@ -1,15 +1,9 @@ """This is the execution module, used to execute the code""" -<<<<<<< HEAD def execute(): import multiview_platform.versions as vs vs.test_versions() -======= -def exec(): - import multiview_platform.versions as versions - versions.test_versions() ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 import sys from multiview_platform.mono_multi_view_classifiers import exec_classif diff --git a/multiview_platform/mono_multi_view_classifiers/utils/execution.py b/multiview_platform/mono_multi_view_classifiers/utils/execution.py index 7850b6a00dd1615dd3d5ee7ff5b76dcf076b7f1c..105dafa497162c9a9450a338f076989de2bf0c7c 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/execution.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/execution.py @@ -24,680 +24,6 @@ def parse_the_args(arguments): help='Path to the hdf5 dataset or database ' 'folder (default: %(default)s)', default='../config_files/config.yml') -<<<<<<< HEAD -# groupStandard.add_argument('-log', action='store_true', -# help='Use option to activate logging to console') -# groupStandard.add_argument('--name', metavar='STRING', nargs='+', action='store', -# help='Name of Database (default: %(default)s)', -# default=['Plausible']) -# groupStandard.add_argument('--label', metavar='STRING', action='store', -# help='Labeling the results directory (default: ' -# '%(default)s)', -# default='') -# groupStandard.add_argument('--type', metavar='STRING', action='store', -# help='Type of database : .hdf5 or .csv (' -# 'default: %(default)s)', -# default='.hdf5') -# groupStandard.add_argument('--views', metavar='STRING', action='store', -# nargs="+", -# help='Name of the views selected for learning ' -# '(default: %(default)s)', -# default=['']) -# groupStandard.add_argument('--pathF', metavar='STRING', action='store', -# help='Path to the hdf5 dataset or database ' -# 'folder (default: %(default)s)', -# default='../data/') -# groupStandard.add_argument('--nice', metavar='INT', action='store', -# type=int, -# help='Niceness for the processes', default=0) -# groupStandard.add_argument('--random_state', metavar='STRING', -# action='store', -# help="The random state seed to use or the path " -# "to a pickle file where it is stored", -# default=None) -# groupStandard.add_argument('--nbCores', metavar='INT', action='store', -# help='Number of cores to use for parallel ' -# 'computing, -1 for all', -# type=int, default=2) -# groupStandard.add_argument('--machine', metavar='STRING', action='store', -# help='Type of machine on which the script runs', -# default="PC") -# groupStandard.add_argument('-full', action='store_true', -# help='Use option to use full dataset and no ' -# 'labels or view filtering') -# groupStandard.add_argument('-debug', action='store_true', -# help='Use option to bebug implemented algorithms') -# groupStandard.add_argument('-add_noise', action='store_true', -# help='Use option to add noise to the data') -# groupStandard.add_argument('--noise_std', metavar='FLOAT', nargs="+", action='store', -# help='The std of the gaussian noise that will ' -# 'be added to the data.', -# type=float, default=[0.0]) -# groupStandard.add_argument('--res_dir', metavar='STRING', action='store', -# help='The path to the result directory', -# default="../results/") -# -# groupClass = parser.add_argument_group('Classification arguments') -# groupClass.add_argument('--CL_multiclassMethod', metavar='STRING', -# action='store', -# help='Determine which multiclass method to use if ' -# 'the dataset is multiclass', -# default="oneVersusOne") -# groupClass.add_argument('--CL_split', metavar='FLOAT', action='store', -# help='Determine the split ratio between learning ' -# 'and validation sets', -# type=float, -# default=0.2) -# groupClass.add_argument('--CL_nbFolds', metavar='INT', action='store', -# help='Number of folds in cross validation', -# type=int, default=2) -# groupClass.add_argument('--CL_nbClass', metavar='INT', action='store', -# help='Number of classes, -1 for all', type=int, -# default=2) -# groupClass.add_argument('--CL_classes', metavar='STRING', action='store', -# nargs="+", -# help='Classes used in the dataset (names of the ' -# 'folders) if not filled, random classes will ' -# 'be ' -# 'selected', default=["yes", "no"]) -# groupClass.add_argument('--CL_type', metavar='STRING', action='store', -# nargs="+", -# help='Determine whether to use multiview and/or ' -# 'monoview, or Benchmark classification', -# default=['monoview', 'multiview']) -# groupClass.add_argument('--CL_algos_monoview', metavar='STRING', -# action='store', nargs="+", -# help='Determine which monoview classifier to use ' -# 'if empty, considering all', -# default=['']) -# groupClass.add_argument('--CL_algos_multiview', metavar='STRING', -# action='store', nargs="+", -# help='Determine which multiview classifier to use ' -# 'if empty, considering all', -# default=['']) -# groupClass.add_argument('--CL_statsiter', metavar='INT', action='store', -# help="Number of iteration for each algorithm to " -# "mean preds on different random states. " -# "If using multiple cores, it's highly " -# "recommended to use statsiter mod nbCores == " -# "0", -# type=int, -# default=2) -# groupClass.add_argument('--CL_metrics', metavar='STRING', action='store', -# nargs="+", -# help='Determine which metrics to use, separate ' -# 'metric and configuration with ":". ' -# 'If multiple, separate with space. If no ' -# 'metric is specified, ' -# 'considering all' -# , default=['']) -# groupClass.add_argument('--CL_metric_princ', metavar='STRING', -# action='store', -# help='Determine which metric to use for ' -# 'randomSearch and optimization', -# default="f1_score") -# groupClass.add_argument('--CL_HPS_iter', metavar='INT', action='store', -# help='Determine how many hyper parameters ' -# 'optimization tests to do', -# type=int, default=2) -# groupClass.add_argument('--CL_HPS_type', metavar='STRING', action='store', -# help='Determine which hyperparamter search ' -# 'function use', -# default="randomizedSearch") -# -# groupRF = parser.add_argument_group('Random Forest arguments') -# groupRF.add_argument('--RF_trees', metavar='INT', type=int, action='store', -# help='Number max trees',nargs="+", -# default=[25]) -# groupRF.add_argument('--RF_max_depth', metavar='INT', type=int, -# action='store',nargs="+", -# help='Max depth for the trees', -# default=[5]) -# groupRF.add_argument('--RF_criterion', metavar='STRING', action='store', -# help='Criterion for the trees',nargs="+", -# default=["entropy"]) -# -# groupSVMLinear = parser.add_argument_group('Linear SVM arguments') -# groupSVMLinear.add_argument('--SVML_C', metavar='INT', type=int, -# action='store', nargs="+", help='Penalty parameter used', -# default=[1]) -# -# groupSVMRBF = parser.add_argument_group('SVW-RBF arguments') -# groupSVMRBF.add_argument('--SVMRBF_C', metavar='INT', type=int, -# action='store', nargs="+", help='Penalty parameter used', -# default=[1]) -# -# groupSVMPoly = parser.add_argument_group('Poly SVM arguments') -# groupSVMPoly.add_argument('--SVMPoly_C', metavar='INT', type=int, -# action='store', nargs="+", help='Penalty parameter used', -# default=[1]) -# groupSVMPoly.add_argument('--SVMPoly_deg', nargs="+", metavar='INT', type=int, -# action='store', help='Degree parameter used', -# default=[2]) -# -# groupAdaboost = parser.add_argument_group('Adaboost arguments') -# groupAdaboost.add_argument('--Ada_n_est', metavar='INT', type=int, -# action='store', nargs="+", help='Number of estimators', -# default=[2]) -# groupAdaboost.add_argument('--Ada_b_est', metavar='STRING', action='store', -# help='Estimators',nargs="+", -# default=['DecisionTreeClassifier']) -# -# groupAdaboostPregen = parser.add_argument_group('AdaboostPregen arguments') -# groupAdaboostPregen.add_argument('--AdP_n_est', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of estimators', -# default=[100]) -# groupAdaboostPregen.add_argument('--AdP_b_est', metavar='STRING', -# action='store',nargs="+", -# help='Estimators', -# default=['DecisionTreeClassifier']) -# groupAdaboostPregen.add_argument('--AdP_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps inthe ' -# 'pregenerated dataset', -# default=[1]) -# -# groupAdaboostGraalpy = parser.add_argument_group( -# 'AdaboostGraalpy arguments') -# groupAdaboostGraalpy.add_argument('--AdG_n_iter', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of estimators', -# default=[100]) -# groupAdaboostGraalpy.add_argument('--AdG_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps inthe ' -# 'pregenerated dataset', -# default=[1]) -# -# groupDT = parser.add_argument_group('Decision Trees arguments') -# groupDT.add_argument('--DT_depth', metavar='INT', type=int, action='store', -# help='Determine max depth for Decision Trees',nargs="+", -# default=[3]) -# groupDT.add_argument('--DT_criterion', metavar='STRING', action='store', -# help='Determine max depth for Decision Trees',nargs="+", -# default=["entropy"]) -# groupDT.add_argument('--DT_splitter', metavar='STRING', action='store', -# help='Determine criterion for Decision Trees',nargs="+", -# default=["random"]) -# -# groupDTP = parser.add_argument_group('Decision Trees pregen arguments') -# groupDTP.add_argument('--DTP_depth', metavar='INT', type=int, -# action='store',nargs="+", -# help='Determine max depth for Decision Trees', -# default=[3]) -# groupDTP.add_argument('--DTP_criterion', metavar='STRING', action='store', -# help='Determine max depth for Decision Trees',nargs="+", -# default=["entropy"]) -# groupDTP.add_argument('--DTP_splitter', metavar='STRING', action='store', -# help='Determine criterion for Decision Trees',nargs="+", -# default=["random"]) -# groupDTP.add_argument('--DTP_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Determine the number of stumps for Decision ' -# 'Trees pregen', -# default=[1]) -# -# groupSGD = parser.add_argument_group('SGD arguments') -# groupSGD.add_argument('--SGD_alpha', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Determine alpha for SGDClassifier', default=[0.1]) -# groupSGD.add_argument('--SGD_loss', metavar='STRING', action='store', -# help='Determine loss for SGDClassifier',nargs="+", -# default=['log']) -# groupSGD.add_argument('--SGD_penalty', metavar='STRING', action='store', -# help='Determine penalty for SGDClassifier', nargs="+", -# default=['l2']) -# -# groupKNN = parser.add_argument_group('KNN arguments') -# groupKNN.add_argument('--KNN_neigh', metavar='INT', type=int, -# action='store',nargs="+", -# help='Determine number of neighbors for KNN', -# default=[1]) -# groupKNN.add_argument('--KNN_weights', nargs="+", -# metavar='STRING', action='store', -# help='Determine number of neighbors for KNN', -# default=["distance"]) -# groupKNN.add_argument('--KNN_algo', metavar='STRING', action='store', -# help='Determine number of neighbors for KNN', -# default=["auto"],nargs="+", ) -# groupKNN.add_argument('--KNN_p', metavar='INT', nargs="+", -# type=int, action='store', -# help='Determine number of neighbors for KNN', -# default=[1]) -# -# groupSCM = parser.add_argument_group('SCM arguments') -# groupSCM.add_argument('--SCM_max_rules', metavar='INT', type=int, -# action='store', nargs="+", -# help='Max number of rules for SCM', default=[1]) -# groupSCM.add_argument('--SCM_p', metavar='FLOAT', type=float, -# action='store', nargs="+", -# help='Max number of rules for SCM', default=[1.0]) -# groupSCM.add_argument('--SCM_model_type', metavar='STRING', action='store', -# help='Max number of rules for SCM', nargs="+", -# default=["conjunction"]) -# -# groupSCMPregen = parser.add_argument_group('SCMPregen arguments') -# groupSCMPregen.add_argument('--SCP_max_rules', metavar='INT', type=int, -# action='store',nargs="+", -# help='Max number of rules for SCM', default=[1]) -# groupSCMPregen.add_argument('--SCP_p', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Max number of rules for SCM', default=[1.0]) -# groupSCMPregen.add_argument('--SCP_model_type', metavar='STRING', -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=["conjunction"]) -# groupSCMPregen.add_argument('--SCP_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps per attribute', -# default=[1]) -# -# groupSCMSparsity = parser.add_argument_group('SCMSparsity arguments') -# groupSCMSparsity.add_argument('--SCS_max_rules', metavar='INT', type=int, -# action='store',nargs="+", -# help='Max number of rules for SCM', default=[1]) -# groupSCMSparsity.add_argument('--SCS_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps', default=[1]) -# groupSCMSparsity.add_argument('--SCS_p', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=[1.0]) -# groupSCMSparsity.add_argument('--SCS_model_type', metavar='STRING', -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=["conjunction"]) -# -# groupCQBoost = parser.add_argument_group('CQBoost arguments') -# groupCQBoost.add_argument('--CQB_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for CQBoost', -# default=[0.001]) -# groupCQBoost.add_argument('--CQB_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for CQBoost', -# default=[1e-06]) -# groupCQBoost.add_argument('--CQB_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the number of stumps for CQBoost', -# default=[1]) -# groupCQBoost.add_argument('--CQB_n_iter', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the maximum number of iteration in ' -# 'CQBoost', -# default=[None]) -# -# groupCQBoostv2 = parser.add_argument_group('CQBoostv2 arguments') -# groupCQBoostv2.add_argument('--CQB2_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for CQBoostv2', -# default=[0.002]) -# groupCQBoostv2.add_argument('--CQB2_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for CQBoostv2', -# default=[1e-08]) -# -# groupCQBoostv21 = parser.add_argument_group('CQBoostv21 arguments') -# groupCQBoostv21.add_argument('--CQB21_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for CQBoostv2', -# default=[0.001]) -# groupCQBoostv21.add_argument('--CQB21_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for CQBoostv2', -# default=[1e-08]) -# -# groupQarBoost = parser.add_argument_group('QarBoost arguments') -# groupQarBoost.add_argument('--QarB_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for QarBoost', -# default=[0.001]) -# groupQarBoost.add_argument('--QarB_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for QarBoost', -# default=[1e-08]) -# -# groupCGreed = parser.add_argument_group('CGreed arguments') -# groupCGreed.add_argument('--CGR_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the n_stumps_per_attribute parameter ' -# 'for CGreed', -# default=[1]) -# groupCGreed.add_argument('--CGR_n_iter', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the n_max_iterations parameter for ' -# 'CGreed', -# default=[100]) -# -# groupCGDesc = parser.add_argument_group('CGDesc arguments') -# groupCGDesc.add_argument('--CGD_stumps', nargs="+", metavar='INT', type=int, -# action='store', -# help='Set the n_stumps_per_attribute parameter ' -# 'for CGreed', -# default=[1]) -# groupCGDesc.add_argument('--CGD_n_iter', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set the n_max_iterations parameter for ' -# 'CGreed', -# default=[10]) -# -# groupCBBoost= parser.add_argument_group('CBBoost arguments') -# groupCBBoost.add_argument('--CBB_stumps', nargs="+", metavar='INT', type=int, -# action='store', -# help='Set the n_stumps_per_attribute parameter ' -# 'for CBBoost', -# default=[1]) -# groupCBBoost.add_argument('--CBB_n_iter', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set the n_max_iterations parameter for ' -# 'CBBoost', -# default=[100]) -# -# groupCGDescTree = parser.add_argument_group('CGDesc arguments') -# groupCGDescTree.add_argument('--CGDT_trees', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set thenumber of trees for CGreed', -# default=[100]) -# groupCGDescTree.add_argument('--CGDT_n_iter', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set the n_max_iterations parameter for ' -# 'CGreed', -# default=[100]) -# groupCGDescTree.add_argument('--CGDT_max_depth', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set the n_max_iterations parameter for CGreed', -# default=[2]) -# -# groupMinCQGraalpyTree = parser.add_argument_group( -# 'MinCQGraalpyTree arguments') -# groupMinCQGraalpyTree.add_argument('--MCGT_mu', metavar='FLOAT', type=float, -# action='store', nargs="+", -# help='Set the mu_parameter for MinCQGraalpy', -# default=[0.05]) -# groupMinCQGraalpyTree.add_argument('--MCGT_trees', metavar='INT', type=int, -# action='store', nargs="+", -# help='Set the n trees parameter for MinCQGraalpy', -# default=[100]) -# groupMinCQGraalpyTree.add_argument('--MCGT_max_depth', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Set the n_stumps_per_attribute parameter for MinCQGraalpy', -# default=[2]) -# -# groupCQBoostTree = parser.add_argument_group('CQBoostTree arguments') -# groupCQBoostTree.add_argument('--CQBT_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for CQBoost', -# default=[0.001]) -# groupCQBoostTree.add_argument('--CQBT_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for CQBoost', -# default=[1e-06]) -# groupCQBoostTree.add_argument('--CQBT_trees', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the number of trees for CQBoost', -# default=[100]) -# groupCQBoostTree.add_argument('--CQBT_max_depth', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the number of stumps for CQBoost', -# default=[2]) -# groupCQBoostTree.add_argument('--CQBT_n_iter', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the maximum number of iteration in CQBoostTree', -# default=[None]) -# -# groupSCMPregenTree = parser.add_argument_group('SCMPregenTree arguments') -# groupSCMPregenTree.add_argument('--SCPT_max_rules', metavar='INT', type=int, -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=[1]) -# groupSCMPregenTree.add_argument('--SCPT_p', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=[1.0]) -# groupSCMPregenTree.add_argument('--SCPT_model_type', metavar='STRING', -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=["conjunction"]) -# groupSCMPregenTree.add_argument('--SCPT_trees', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps per attribute', -# default=[100]) -# groupSCMPregenTree.add_argument('--SCPT_max_depth', metavar='INT', type=int, -# action='store',nargs="+", -# help='Max_depth of the trees', -# default=[1]) -# -# groupSCMSparsityTree = parser.add_argument_group( -# 'SCMSparsityTree arguments') -# groupSCMSparsityTree.add_argument('--SCST_max_rules', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Max number of rules for SCM', -# default=[1]) -# groupSCMSparsityTree.add_argument('--SCST_p', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=[1.0]) -# groupSCMSparsityTree.add_argument('--SCST_model_type', metavar='STRING', -# action='store',nargs="+", -# help='Max number of rules for SCM', -# default=["conjunction"]) -# groupSCMSparsityTree.add_argument('--SCST_trees', metavar='INT', type=int, -# action='store',nargs="+", -# help='Number of stumps per attribute', -# default=[100]) -# groupSCMSparsityTree.add_argument('--SCST_max_depth', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Max_depth of the trees', -# default=[1]) -# -# groupAdaboostPregenTree = parser.add_argument_group( -# 'AdaboostPregenTrees arguments') -# groupAdaboostPregenTree.add_argument('--AdPT_n_est', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Number of estimators', -# default=[100]) -# groupAdaboostPregenTree.add_argument('--AdPT_b_est', metavar='STRING', -# action='store',nargs="+", -# help='Estimators', -# default=['DecisionTreeClassifier']) -# groupAdaboostPregenTree.add_argument('--AdPT_trees', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Number of trees in the pregenerated dataset', -# default=[100]) -# groupAdaboostPregenTree.add_argument('--AdPT_max_depth', metavar='INT', -# type=int,nargs="+", -# action='store', -# help='Number of stumps inthe pregenerated dataset', -# default=[3]) -# -# groupLasso = parser.add_argument_group('Lasso arguments') -# groupLasso.add_argument('--LA_n_iter', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the max_iter parameter for Lasso', -# default=[1]) -# groupLasso.add_argument('--LA_alpha', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the alpha parameter for Lasso', -# default=[1.0]) -# -# groupGradientBoosting = parser.add_argument_group( -# 'Gradient Boosting arguments') -# groupGradientBoosting.add_argument('--GB_n_est', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the n_estimators_parameter for Gradient Boosting', -# default=[100]) -# -# groupMinCQ = parser.add_argument_group('MinCQ arguments') -# groupMinCQ.add_argument('--MCQ_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu_parameter for MinCQ', -# default=[0.05]) -# groupMinCQ.add_argument('--MCQ_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the n_stumps_per_attribute parameter for MinCQ', -# default=[1]) -# -# groupMinCQGraalpy = parser.add_argument_group('MinCQGraalpy arguments') -# groupMinCQGraalpy.add_argument('--MCG_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu_parameter for MinCQGraalpy', -# default=[0.05]) -# groupMinCQGraalpy.add_argument('--MCG_stumps', metavar='INT', type=int, -# action='store',nargs="+", -# help='Set the n_stumps_per_attribute parameter for MinCQGraalpy', -# default=[1]) -# -# groupQarBoostv3 = parser.add_argument_group('QarBoostv3 arguments') -# groupQarBoostv3.add_argument('--QarB3_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for QarBoostv3', -# default=[0.001]) -# groupQarBoostv3.add_argument('--QarB3_epsilon', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the epsilon parameter for QarBoostv3', -# default=[1e-08]) -# -# groupQarBoostNC = parser.add_argument_group('QarBoostNC arguments') -# groupQarBoostNC.add_argument('--QarBNC_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for QarBoostNC', -# default=[0.001]) -# groupQarBoostNC.add_argument('--QarBNC_epsilon', metavar='FLOAT', -# type=float, action='store',nargs="+", -# help='Set the epsilon parameter for QarBoostNC', -# default=[1e-08]) -# -# groupQarBoostNC2 = parser.add_argument_group('QarBoostNC2 arguments') -# groupQarBoostNC2.add_argument('--QarBNC2_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for QarBoostNC2', -# default=[0.001]) -# groupQarBoostNC2.add_argument('--QarBNC2_epsilon', metavar='FLOAT', -# type=float, action='store',nargs="+", -# help='Set the epsilon parameter for QarBoostNC2', -# default=[1e-08]) -# -# groupQarBoostNC3 = parser.add_argument_group('QarBoostNC3 arguments') -# groupQarBoostNC3.add_argument('--QarBNC3_mu', metavar='FLOAT', type=float, -# action='store',nargs="+", -# help='Set the mu parameter for QarBoostNC3', -# default=[0.001]) -# groupQarBoostNC3.add_argument('--QarBNC3_epsilon', metavar='FLOAT', -# type=float, action='store',nargs="+", -# help='Set the epsilon parameter for QarBoostNC3', -# default=[1e-08]) -# -# # -# # multiview args -# # -# -# groupMumbo = parser.add_argument_group('Mumbo arguments') -# groupMumbo.add_argument('--MU_types', metavar='STRING', action='store', -# nargs="+", -# help='Determine which monoview classifier to use with Mumbo', -# default=['']) -# groupMumbo.add_argument('--MU_config', metavar='STRING', action='store', -# nargs='+', -# help='Configuration for the monoview classifier in Mumbo' -# ' separate each classifier with sapce and each argument with:', -# default=['']) -# groupMumbo.add_argument('--MU_iter', metavar='INT', action='store', nargs=3, -# help='Max number of iteration, min number of iteration, convergence threshold', -# type=float, -# default=[10, 1, 0.01]) -# groupMumbo.add_argument('--MU_combination', action='store_true', -# help='Try all the monoview classifiers combinations for each view', -# default=False) -# -# groupFusion = parser.add_argument_group('fusion arguments') -# groupFusion.add_argument('--FU_types', metavar='STRING', action='store', -# nargs="+", -# help='Determine which type of fusion to use', -# default=['']) -# groupEarlyFusion = parser.add_argument_group('Early fusion arguments') -# groupEarlyFusion.add_argument('--FU_early_methods', metavar='STRING', -# action='store', nargs="+", -# help='Determine which early fusion method of fusion to use', -# default=['']) -# groupEarlyFusion.add_argument('--FU_E_method_configs', metavar='STRING', -# action='store', nargs='+', -# help='Configuration for the early fusion methods separate ' -# 'method by space and values by :', -# default=['']) -# groupEarlyFusion.add_argument('--FU_E_cl_config', metavar='STRING', -# action='store', nargs='+', -# help='Configuration for the monoview classifiers ' -# ' used separate classifier by space ' -# 'and configs must be of form argument1_name:value,' -# 'argument2_name:value', -# default=['']) -# groupEarlyFusion.add_argument('--FU_E_cl_names', metavar='STRING', -# action='store', nargs='+', -# help='Name of the classifiers used for each early fusion method', -# default=['']) -# -# groupLateFusion = parser.add_argument_group('Late fusion arguments') -# groupLateFusion.add_argument('--FU_late_methods', metavar='STRING', -# action='store', nargs="+", -# help='Determine which late fusion method of fusion to use', -# default=['']) -# groupLateFusion.add_argument('--FU_L_method_config', metavar='STRING', -# action='store', nargs='+', -# help='Configuration for the fusion method', -# default=['']) -# groupLateFusion.add_argument('--FU_L_cl_config', metavar='STRING', -# action='store', nargs='+', -# help='Configuration for the monoview classifiers used', -# default=['']) -# groupLateFusion.add_argument('--FU_L_cl_names', metavar='STRING', -# action='store', nargs="+", -# help='Names of the classifier used for late fusion', -# default=['']) -# groupLateFusion.add_argument('--FU_L_select_monoview', metavar='STRING', -# action='store', -# help='Determine which method to use to select the monoview classifiers', -# default="intersect") -# -# groupFatLateFusion = parser.add_argument_group('Fat Late fusion arguments') -# groupFatLateFusion.add_argument('--FLF_weights', metavar='FLOAT', -# action='store', nargs="+", -# help='Determine the weights of each monoview decision for FLF', -# type=float, -# default=[]) -# -# groupFatSCMLateFusion = parser.add_argument_group( -# 'Fat SCM Late fusion arguments') -# groupFatSCMLateFusion.add_argument('--FSCMLF_p', metavar='FLOAT', -# action='store', -# help='Determine the p argument of the SCM', -# type=float, -# default=0.5) -# groupFatSCMLateFusion.add_argument('--FSCMLF_max_attributes', metavar='INT', -# action='store', -# help='Determine the maximum number of aibutes used by the SCM', -# type=int, -# default=4) -# groupFatSCMLateFusion.add_argument('--FSCMLF_model', metavar='STRING', -# action='store', -# help='Determine the model type of the SCM', -# default="conjunction") -# -# groupDisagreeFusion = parser.add_argument_group( -# 'Disagreement based fusion arguments') -# groupDisagreeFusion.add_argument('--DGF_weights', metavar='FLOAT', -# action='store', nargs="+", -# help='Determine the weights of each monoview decision for DFG', -# type=float, -# default=[]) - -======= ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 args = parser.parse_args(arguments) return args diff --git a/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py b/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py index d91d1b51d5d7ef23dd2a66c656013052ee50068f..02a084a7c229832338458b2a1070deaf954c1e79 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/get_multiview_db.py @@ -90,13 +90,8 @@ def makeMeNoisy(viewData, random_state, percentage=5): return noisyViewData -<<<<<<< HEAD -def getPlausibleDBhdf5(features, pathF, name, NB_CLASS=3, LABELS_NAME="", - random_state=None, full=True, add_noise=False, -======= def get_plausible_db_hdf5(features, pathF, name, NB_CLASS=3, LABELS_NAME="", randomState=None, full=True, add_noise=False, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 noise_std=0.15, nbView=3, nbClass=2, datasetLength=100, randomStateInt=42, nbFeatures = 10): """Used to generate a plausible dataset to test the algorithms""" @@ -472,14 +467,9 @@ def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name, return noisy_dataset, dataset_name + "_noised" -<<<<<<< HEAD -def getClassicDBcsv(views, pathF, nameDB, NB_CLASS, askedLabelsNames, - random_state, full=False, add_noise=False, noise_std=0.15, -======= def get_classic_db_csv(views, pathF, nameDB, NB_CLASS, askedLabelsNames, - randomState, full=False, add_noise=False, noise_std=0.15, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 - delimiter=","): + randomState, full=False, add_noise=False, noise_std=0.15, + delimiter=","): # TODO : Update this one labels_names = np.genfromtxt(pathF + nameDB + "-labels-names.csv", dtype='str', delimiter=delimiter) diff --git a/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py b/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py index dee2cd7d8dbab3a000cad4216e8e67156d3110af..114764faf8c6121106f8dcbddebb9866fa5d6b64 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/hyper_parameter_search.py @@ -108,35 +108,6 @@ def randomized_search_x(X, y, framework, random_state, output_file_name, classif min_list = np.array( [min(nb_possible_combination, n_iter) for nb_possible_combination in nb_possible_combinations]) -<<<<<<< HEAD - random_search = MultiviewCompatibleRandomizedSearchCV( - estimator, - n_iter=int(np.sum(min_list)), - param_distributions=params_dict, - refit=True, - n_jobs=nb_cores, scoring=scorer, - cv=folds, random_state=random_state, - learning_indices=learning_indices, - view_indices=view_indices, - framework=framework) - detector = random_search.fit(X, y) - - best_params = dict((key, value) for key, value in - estimator.genBestParams(detector).items() if - key is not "random_state") - - scores_array = detector.cv_results_['mean_test_score'] - params = estimator.genParamsFromDetector(detector) - - gen_heat_maps(params, scores_array, output_file_name) - best_estimator = detector.best_estimator_ - else: - best_estimator = estimator - best_params = {} - test_folds_preds = get_test_folds_preds(X, y, folds, best_estimator, - framework, learning_indices) - return best_params, test_folds_preds -======= random_search = MultiviewCompatibleRandomizedSearchCV(estimator, n_iter=int(np.sum(min_list)), param_distributions=params_dict, @@ -161,7 +132,6 @@ def randomized_search_x(X, y, framework, random_state, output_file_name, classif testFoldsPreds = get_test_folds_preds(X, y, folds, best_estimator, framework, learning_indices) return best_params, testFoldsPreds ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 from sklearn.base import clone diff --git a/multiview_platform/tests/test_ExecClassif.py b/multiview_platform/tests/test_ExecClassif.py index acb10c4f4432c667fb08873f7671483808f52ecb..24d4f0cf6c8eba250c1b0863545cf157ae8d5cc2 100644 --- a/multiview_platform/tests/test_ExecClassif.py +++ b/multiview_platform/tests/test_ExecClassif.py @@ -130,11 +130,6 @@ class Test_InitArgumentDictionaries(unittest.TestCase): ] self.assertEqual(arguments["multiview"][0], expected_output[0]) -<<<<<<< HEAD -def fakeBenchmarkExec(core_index=-1, a=7, args=1): - return [core_index, a] -======= ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 def test_init_argument_dictionaries_multiview_complex(self): self.multiview_classifier_arg_value = {"fake_value_2":"plif", "plaf":"plouf"} @@ -213,11 +208,6 @@ def fakeBenchmarkExec(core_index=-1, a=7, args=1): def fakeBenchmarkExec(core_index=-1, a=7, args=1): return [core_index, a] -<<<<<<< HEAD -def fakeBenchmarkExec_mutlicore(nb_cores=-1, a=6, args=1): - return [nb_cores, a] -======= ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 def fakeBenchmarkExec_mutlicore(nb_cores=-1, a=6, args=1): return [nb_cores, a] @@ -270,17 +260,10 @@ class Test_execBenchmark(unittest.TestCase): res = exec_classif.exec_benchmark(2, 1, 2, cls.argument_dictionaries, [[[1, 2], [3, 4, 5]]], 5, 6, 7, 8, 9, 10, cls.Dataset, -<<<<<<< HEAD exec_one_benchmark=fakeBenchmarkExec, exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, exec_one_benchmark_mono_core=fakeBenchmarkExec_monocore, get_results=fakegetResults, -======= - exec_one_benchmark=fakeBenchmarkExec, - exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, - exec_one_benchmark_mono_core=fakeBenchmarkExec_monocore, - get_results=fakegetResults, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 delete=fakeDelete) cls.assertEqual(res, 3) @@ -292,17 +275,10 @@ class Test_execBenchmark(unittest.TestCase): res = exec_classif.exec_benchmark(2, 2, 2, cls.argument_dictionaries, [[[1, 2], [3, 4, 5]]], 5, 6, 7, 8, 9, 10, cls.Dataset, -<<<<<<< HEAD exec_one_benchmark=fakeBenchmarkExec, exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, exec_one_benchmark_monoCore=fakeBenchmarkExec_monocore, get_results=fakegetResults, -======= - exec_one_benchmark=fakeBenchmarkExec, - exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, - exec_one_benchmark_mono_core=fakeBenchmarkExec_monocore, - get_results=fakegetResults, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 delete=fakeDelete) cls.assertEqual(res, 3) @@ -310,17 +286,10 @@ class Test_execBenchmark(unittest.TestCase): res = exec_classif.exec_benchmark(2, 1, 1, cls.argument_dictionaries, [[[1, 2], [3, 4, 5]]], 5, 6, 7, 8, 9, 10, cls.Dataset, -<<<<<<< HEAD exec_one_benchmark=fakeBenchmarkExec, exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, exec_oneBenchmark_mono_core=fakeBenchmarkExec_monocore, get_results=fakegetResults, -======= - exec_one_benchmark=fakeBenchmarkExec, - exec_one_benchmark_multicore=fakeBenchmarkExec_mutlicore, - exec_one_benchmark_mono_core=fakeBenchmarkExec_monocore, - get_results=fakegetResults, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 delete=fakeDelete) cls.assertEqual(res, 3) @@ -333,26 +302,15 @@ class Test_execBenchmark(unittest.TestCase): os.rmdir(path) -<<<<<<< HEAD def fakeExecMono(directory, name, labels_names, classification_indices, k_folds, coreIndex, type, pathF, random_state, labels, -======= -def fakeExecMono(directory, name, labelsNames, classificationIndices, kFolds, - coreIndex, type, pathF, randomState, labels, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 hyper_param_search="try", metrics="try", nIter=1, **arguments): return ["Mono", arguments] -<<<<<<< HEAD def fakeExecMulti(directory, coreIndex, name, classification_indices, k_folds, type, pathF, labels_dictionary, random_state, labels, hyper_param_search="", metrics=None, -======= -def fakeExecMulti(directory, coreIndex, name, classificationIndices, kFolds, - type, pathF, LABELS_DICTIONARY, - randomState, labels, hyper_param_search="", metrics=None, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 nIter=1, **arguments): return ["Multi", arguments] @@ -387,7 +345,6 @@ class Test_execOneBenchmark(unittest.TestCase): def test_simple(cls): flag, results = exec_classif.exec_one_benchmark(core_index=10, -<<<<<<< HEAD labels_dictionary={ 0: "a", 1: "b"}, @@ -401,21 +358,6 @@ class Test_execOneBenchmark(unittest.TestCase): hyper_param_search="try", metrics="try", argument_dictionaries={ -======= - labels_dictionary={ - 0: "a", - 1: "b"}, - directory="multiview_platform/tests/tmp_tests/", - classification_indices=( - [1, 2, 3, 4], - [0, 5, 6, 7, 8]), - args=cls.args, - k_folds=FakeKfold(), - random_state="try", - hyper_param_search="try", - metrics="try", - argument_dictionaries={ ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 "Monoview": [ { "try": 0}, @@ -427,26 +369,16 @@ class Test_execOneBenchmark(unittest.TestCase): "try4": 10}]}, benchmark="try", views="try", -<<<<<<< HEAD views_indices="try", -======= - views_indices="try", ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 flag=None, labels=np.array( [0, 1, 2, 1, 2, 2, 2, 12, 1, 2, 1, 1, 2, 1, 21]), -<<<<<<< HEAD exec_monoview_multicore=fakeExecMono, exec_multiview_multicore=fakeExecMulti, init_multiview_arguments=fakeInitMulti) -======= - exec_monoview_multicore=fakeExecMono, - exec_multiview_multicore=fakeExecMulti, - init_multiview_arguments=fakeInitMulti) ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 cls.assertEqual(flag, None) cls.assertEqual(results , @@ -480,11 +412,8 @@ class Test_execOneBenchmark_multicore(unittest.TestCase): def test_simple(cls): flag, results = exec_classif.exec_one_benchmark_multicore( -<<<<<<< HEAD nbCores=2, -======= - nb_cores=2, ->>>>>>> 7b3e918b4fb2938657cae3093d95b1bd6fc461d4 + labels_dictionary={0: "a", 1: "b"}, directory="multiview_platform/tests/tmp_tests/", classification_indices=([1, 2, 3, 4], [0, 10, 20, 30, 40]),