Exemple #1
0
from decision_tree import DecisionTree
import os

feature_matrix = [
    'Glucose_max', 'Glucose_min', 'Glucose_variance', 'velocity_max',
    'velocity_min', 'velocity_variance', 'rms_max', 'rms_min', 'rms_variance'
]
target = ['target']

for i in range(1, 6):

    meal_data = Preprocess(
        f'D:\\python projects\\CSE572\\project2\\mealData{i}.csv')
    meal_data_df = meal_data.get_dataframe()
    meal_feature = Features(meal_data_df)
    temp1_matrix = meal_feature.features_extraction()
    feature_matrix = np.row_stack((feature_matrix, temp1_matrix))
    # print(len(temp1_matrix))
    target.extend([1] * len(temp1_matrix))

    nomeal_data = Preprocess(
        f'D:\\python projects\\CSE572\\project2\\Nomeal{i}.csv')
    nomeal_data_df = nomeal_data.get_dataframe()
    nomeal_feature = Features(nomeal_data_df)
    temp2_matrix = nomeal_feature.features_extraction()
    feature_matrix = np.row_stack((feature_matrix, temp2_matrix))
    target.extend([0] * len(temp2_matrix))

feature_matrix = np.array(feature_matrix)
target = np.array([target])
new_feature_matrix = np.concatenate((feature_matrix, target.T), axis=1)
Exemple #2
0
from preprocess import Preprocess
from features import Features
import pandas as pd

cgm_series_lunch = Preprocess(
    'D:\Desktop\ASU\CSE572\DataFolder\CGMSeriesLunchPat1.csv')
time_series_lunch = Preprocess(
    'D:\Desktop\ASU\CSE572\DataFolder\CGMDatenumLunchPat1.csv')
cgm_series_lunch1 = cgm_series_lunch.get_dataframe()
time_series_lunch1 = time_series_lunch.get_dataframe()
# print(cgm_series_lunch1)
# print(time_series_lunch1)

feature = Features(cgm_series_lunch1, time_series_lunch1)
feature.features_extraction()
# feature.save_to_csv()
final_pca = pd.DataFrame(feature.pca_decomposition())
final_pca.to_csv('final_pca.csv', index=False)
feature.plot_time_series()