Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 8f357aaf authored by Anze Vavpetic's avatar Anze Vavpetic
Browse files

added widget for querying data using subgroup descriptions

parent 8431ad28
......@@ -6,6 +6,7 @@ Subgroup discovery library functions.
import json
from SubgroupDiscovery.SD_learner_classifier import SD_learner
from SubgroupDiscovery.SDRule import SDRules
import Orange
class SubgroupDiscovery:
# Available algorithms and their parameters
......@@ -68,4 +69,15 @@ def select_subgroups_finished(postdata, input_dict, output_dict):
sd_rules = input_dict['rules']
selected_subgroups = [int(i) for i in json.loads(postdata['selected_subgroup_ids'][0])]
rules = SDRules(filter(lambda r: r.id in selected_subgroups, sd_rules.rules), sd_rules.targetClassRule, sd_rules.algorithmName)
return {'sel_rules' : rules}
\ No newline at end of file
return {'sel_rules' : rules}
def query_with_subgroups(input_dict):
data = input_dict['data']
sd_rules = input_dict['rules']
subset = set()
for rule in sd_rules.rules:
subset = subset.union(rule.filter(data))
subset_table = Orange.data.Table(data.domain)
for ex in subset:
subset_table.append(ex)
return {'data' : subset_table}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment