Exemplo n.º 1
0
        return train_cv_metric, val_cv_metric, test_metric, all_train_metric


if __name__ == '__main__':
    from FAE.DataContainer.DataContainer import DataContainer
    from FAE.FeatureAnalysis.Normalizer import NormalizerZeroCenter
    from FAE.FeatureAnalysis.Classifier import SVM, LR, LDA, LRLasso, GaussianProcess, NaiveBayes, DecisionTree, RandomForest, AE, AdaBoost
    import numpy as np

    train_data_container = DataContainer()
    train_data_container.Load(
        r'C:\MyCode\FAEGitHub\FAE\Example\withoutshape\non_balance_features.csv'
    )

    normalizer = NormalizerZeroCenter()
    train_data_container = normalizer.Run(train_data_container)

    data = train_data_container.GetArray()
    label = np.asarray(train_data_container.GetLabel())

    #     param_list = [
    # {"hidden_layer_sizes": [(30,), (100,)],
    # "solver": ["adam"],
    # "alpha": [0.0001, 0.001],
    # "learning_rate_init": [0.001, 0.01]}
    # ]
    #     from sklearn.model_selection import ParameterGrid
    #     pl = ParameterGrid(param_list)

    cv = CrossValidation5Folder()
Exemplo n.º 2
0
            input_data_container = output
        return output

    def SaveInfo(self, store_folder, all_features):
        for fs in self.__selector_list:
            fs.SaveInfo(store_folder, all_features)

    def SaveDataContainer(self, data_container, store_folder, store_key):
        for fs in self.__selector_list:
            fs.SaveDataContainer(data_container, store_folder, store_key)


################################################################

if __name__ == '__main__':
    from FAE.DataContainer.DataContainer import DataContainer
    from FAE.FeatureAnalysis.Normalizer import NormalizerZeroCenter
    from FAE.FeatureAnalysis.DimensionReduction import DimensionReductionByPCC

    dc = DataContainer()
    pcc = DimensionReductionByPCC()
    fs = FeatureSelectByKruskalWallis(selected_feature_number=5)

    dc.Load(r'..\..\Demo\train_numeric_feature.csv')

    dc = NormalizerZeroCenter.Run(dc)
    dc = pcc.Run(dc)
    print(dc.GetArray().shape)
    dc = fs.Run(dc)
    print(dc.GetArray().shape)