Skip to content

Commit

Permalink
OwLouvain: Widget changed to match new clustering interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed Jun 12, 2019
1 parent 081f2ce commit febfdb9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Orange/widgets/unsupervised/owlouvainclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from AnyQt.QtWidgets import QSlider, QCheckBox, QWidget, QLabel

from Orange.clustering.louvain import table_to_knn_graph, Louvain
from Orange.clustering.clustering import preprocess_data
from Orange.data import Table, DiscreteVariable
from Orange.data.util import get_unique_names, array_equal
from Orange import preprocess
Expand Down Expand Up @@ -612,7 +613,7 @@ def run_on_data(data, normalize, pca_components, k_neighbors, metric, resolution

# Apply Louvain preprocessing before converting the table into a graph
louvain = Louvain(resolution=resolution, random_state=0)
data = louvain.preprocess(data)
data = preprocess_data(louvain.preprocessors, data)

if state.is_interuption_requested():
return res
Expand All @@ -625,8 +626,7 @@ def pcallback(val):
try:
res.graph = graph = table_to_knn_graph(
data, k_neighbors=k_neighbors, metric=metric,
progress_callback=pcallback
)
progress_callback=pcallback)
except InteruptRequested:
return res

Expand All @@ -638,7 +638,7 @@ def pcallback(val):
if state.is_interuption_requested():
return res

res.partition = louvain.fit_predict(graph)
res.partition = louvain(graph)
state.set_partial_results(("partition", res.partition))
return res

Expand All @@ -654,7 +654,7 @@ def run_on_graph(graph, resolution, state):
state.set_status("Detecting communities...")
if state.is_interuption_requested():
return res
partition = louvain.fit_predict(graph)
partition = louvain(graph)
res.partition = partition
state.set_partial_results(("partition", res.partition))
return res
Expand Down

0 comments on commit febfdb9

Please sign in to comment.