Exemplo n.º 1
0
def update_two_feature_scatter_plot_using_filters(xaxis_column_index,
                                                  yaxis_column_index,
                                                  co_click_data, ori_df):
    X, y = ResultProcessing.read_dataset_X_y(ori_df)
    names = ResultProcessing.read_dataset_names(ori_df)
    ctx = dash.callback_context
    trigger_id = ctx.triggered[0]['prop_id'].split('.')[0]
    if trigger_id == 'crossfilter-xaxis-column' or trigger_id == 'crossfilter-yaxis-column':
        xaxis_column_index = int(xaxis_column_index)
        yaxis_column_index = int(yaxis_column_index)
    elif trigger_id == 'co-occurrence-graph':
        xaxis_column_index = int(co_click_data['points'][0]['x'][1:])
        yaxis_column_index = int(co_click_data['points'][0]['y'][1:])
    # type_name = ['AD', 'Normal']
    unique_label = ori_df['category'].unique()
    return {
        'data': [
            dict(x=X[:, int(xaxis_column_index)][y == type],
                 y=X[:, int(yaxis_column_index)][y == type],
                 mode='markers',
                 marker={
                     'size': 15,
                     'opacity': 0.5,
                     'line': {
                         'width': 0.5,
                         'color': 'white'
                     },
                 },
                 name=type) for type in unique_label
        ],
        'layout':
        dict(xaxis={
            'title': names[int(xaxis_column_index)],
            'type': 'linear'
        },
             yaxis={
                 'title': names[int(yaxis_column_index)],
                 'type': 'linear'
             },
             hovermode='closest',
             clickmode='event+select',
             title='<b>Two-Feature Scatter Plot</b>')
    }
Exemplo n.º 2
0
import pandas as pd
import numpy as np
from data_processing_utils._processing_funcs import ResultProcessing

result = ResultProcessing()
result.load_models_from_file_path("../dataset/lgp_random_AD_vs_Normal.pkl")
data = pd.read_csv('../assets/sample_data/sample_alzheimer_vs_normal.csv')
X, y = ResultProcessing.read_dataset_X_y(data)
names = ResultProcessing.read_dataset_names(data)
result.calculate_featureList_and_calcvariableList()
# test get network function
# df, node_size_dic = result.get_network_data(names, 0.03, 'dUMP')
# print(node_size_dic)
# print(df.values)
#
# aaa = df.loc[(df['f1'] == 'dUMP') | (df['f2'] == 'dUMP')]
#
# others = np.unique(aaa[['f1', 'f2']].values)
# others = others[others != 'dUMP']
# aaa2 = df.loc[(df['f1'].isin(others)) & (df['f2'].isin(others)) ]
# aaa = aaa.append(aaa2, ignore_index=True)
# print("dd")
# end get network function

# for index, row in df.iterrows():
#     print(df['source'][index])

# prog_index, acc_scores =  result.get_accuracy_given_length(1)

# index = result.get_index_of_models_given_feature_and_length(105, 3)
# print(index)