Skip to content

Commit

Permalink
Changed: Updated cluster visualization with temporal information. Fix…
Browse files Browse the repository at this point in the history
…ed: Fixed some clustering-related bugs.
  • Loading branch information
AAnzel committed Jan 11, 2022
1 parent 5ce49b8 commit 61bac1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Source/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1539,7 +1539,7 @@ def work_with_data_set(df, data_set_type, folder_path, recache, key_suffix):
# Traversing pairs in list
for i in labels_list:
temporal_feature, feature_list = find_temporal_feature(df)
feature_list = i[0]
feature_list = [i[0]]
df[i[0]] = i[1]
chosen_charts += visualize_data_set(
df, temporal_feature, feature_list,
Expand All @@ -1565,7 +1565,7 @@ def work_with_data_set(df, data_set_type, folder_path, recache, key_suffix):
# Traversing pairs in list
for i in labels_list:
temporal_feature, feature_list = find_temporal_feature(df)
feature_list = i[0]
feature_list = [i[0]]
df[i[0]] = i[1]
chosen_charts += visualize_data_set(
df, temporal_feature, feature_list,
Expand Down
19 changes: 11 additions & 8 deletions Source/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,12 @@ def elbow_rule(data):


# Everything below is used for genomics data set exclusively
def visualize_clusters(data, temporal_feature, labels_feature, method):

temporal_series = data[temporal_feature]
tmp_data = data.drop(temporal_feature, axis=1)
def visualize_clusters(data, temporal_feature, feature_list, method):
tmp_data = data.copy()
temporal_series = tmp_data[temporal_feature]
tmp_data = tmp_data.drop(temporal_feature, axis=1)

labels_feature = feature_list[0]
labels_series = tmp_data[labels_feature]
tmp_data = tmp_data.drop(labels_feature, axis=1)

Expand Down Expand Up @@ -483,12 +484,14 @@ def visualize_clusters(data, temporal_feature, labels_feature, method):
# select_time = alt.selection_single(
# fields=['New_DateTime'], bind=slider)

chart = alt.Chart(tmp_data, title=tmp_title).mark_circle(opacity=1).encode(
chart = alt.Chart(tmp_data, title=tmp_title).mark_point(opacity=1).encode(
alt.X(str(tmp_data.columns[2]), type='quantitative'),
alt.Y(str(tmp_data.columns[3]), type='quantitative'),
alt.Color(str(tmp_data.columns[1]), type='nominal'),
alt.Tooltip(str(tmp_data.columns[0]), type='temporal')
)
alt.Shape(str(tmp_data.columns[1]), type='nominal'),
alt.Color(str(tmp_data.columns[0]), type='temporal',
scale=alt.Scale(scheme='greys')),
alt.Tooltip([temporal_feature, labels_feature]),
).configure_legend(columns=2)
# .add_selection(select_time).transform_filter(select_time)

return chart
Expand Down

0 comments on commit 61bac1c

Please sign in to comment.