Exemple #1
0
if __name__ == '__main__':
    inputTest = pd.read_csv('{}.csv'.format(
        str(input('Enter Feature File name:\t'))),
                            header=None)
    outputTest = pd.read_csv('{}.csv'.format(
        str(input('Enter Class File name:\t'))),
                             header=None)

    outputTest.columns = ['Class']

    inputTest = inputTest.T
    inputTest = DropIfMaxNaN(inputTest)
    inputTest = handlingNaN(inputTest)

    Test_FeatureMatrix = pd.concat([
        Features.Deviation(inputTest, 'N/A'),
        Features.meanRange(inputTest, 'N/A')[['MeanRange']],
        Features.Range(inputTest, 'N/A')[['HighRange', 'LowRange']],
        Features.FFT(inputTest, 'N/A')[['varFFT', 'sdFFT', 'meanFFT']],
        Features.Quantile(inputTest, 'N/A')['Quantile'],
    ],
                                   axis=1)

    if int(input('Pass From PCA? 1: YES, 0: NO:\t')) == 1:
        columns = TopFeatures(Test_FeatureMatrix,
                              len(Test_FeatureMatrix.columns) - 1)
    else:
        columns = list(Test_FeatureMatrix.columns)
        columns.remove('Class')

    Test_DF = Test_FeatureMatrix[columns]
        meal[i] = handlingNaN(meal[i])
        for j in meal[i].columns:
            meal[i][j] = list(meal[i][j])[::-1]
        meal[i].columns = [i for i in range(len(meal[i].columns))]

        noMeal[i] = DropIfMaxNaN(noMeal[i])
        meal[i] = handlingNaN(noMeal[i])
        for j in noMeal[i].columns:
            noMeal[i][j] = list(noMeal[i][j])[::-1]
        noMeal[i].columns = [i for i in range(len(noMeal[i].columns))]

    DeviationFeature = pd.DataFrame(columns=[
        'inRangeCount', 'LowCount', 'HighCount', 'LowMean', 'HighMean', 'Class'
    ])
    for i in range(numFiles):
        DeviationFeature = DeviationFeature.append(Features.Deviation(
            meal[i], 'Meal'),
                                                   ignore_index=True)
    for i in range(numFiles):
        DeviationFeature = DeviationFeature.append(Features.Deviation(
            noMeal[i], 'NoMeal'),
                                                   ignore_index=True)

    mean_range_feature = pd.DataFrame(columns=['MeanRange', 'Class'])
    for i in range(numFiles):
        mean_range_feature = mean_range_feature.append(Features.meanRange(
            meal[i], 'Meal'),
                                                       ignore_index=True)
    for i in range(numFiles):
        mean_range_feature = mean_range_feature.append(Features.meanRange(
            noMeal[i], 'NoMeal'),
                                                       ignore_index=True)