Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 70d55db6 authored by Alain Shakour's avatar Alain Shakour
Browse files

Update 1BC/Proper

- 1BC and 1BC2 are available with separate widgets
- KDIC format available
- Add regex
- Score by attributes in 1BC
- Remove 1BC & tertius binaries
parent b4a31748
......@@ -22,6 +22,8 @@ atlassian-ide-plugin.xml
/mothra/backup
mothra-env/
build/
/workflows/ilp/tertius/bin/
/workflows/ilp/tertius/src/*.res
# SQLite
/mothra/mothra.db
......@@ -29,4 +31,4 @@ build/
celerybeat-schedule
.coverage
htmlcov
\ No newline at end of file
htmlcov
[
{
"model": "workflows.abstractwidget",
"fields": {
"category": "aa3ed779-1e0b-4c6b-883e-24d85b9a6009",
"treeview_image": "",
"uid": "777bee59-4e3f-4818-91f4-78d9c020d622",
"windows_queue": false,
"package": "cforange",
"interaction_view": "",
"has_progress_bar": false,
"image": "",
"description": "",
"static_image": "",
"action": "odt_to_kdic",
"visualization_view": "",
"streaming_visualization_view": "",
"post_interact_action": "",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"is_streaming": false,
"order": 1,
"name": "Orange Data Table to KDIC String"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "777bee59-4e3f-4818-91f4-78d9c020d622",
"name": "Orange Data Table",
"short_name": "odt",
"default": "",
"description": "Orange Data Table",
"required": false,
"multi": false,
"parameter_type": null,
"variable": "odt",
"parameter": false,
"order": 1,
"uid": "06db825a-76da-4019-bc4d-aae67a8de245"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "777bee59-4e3f-4818-91f4-78d9c020d622",
"name": "KDIC",
"short_name": "kdc",
"description": "",
"variable": "kdic",
"order": 1,
"uid": "075d553f-5133-4023-8148-5a2edc520af3"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "777bee59-4e3f-4818-91f4-78d9c020d622",
"name": "TXT",
"short_name": "txt",
"description": "",
"variable": "txt",
"order": 2,
"uid": "8d0df2c8-5969-4a82-b752-376534beea04"
}
}
]
\ No newline at end of file
......@@ -141,7 +141,12 @@ def ilp_relaggs(input_dict):
return output_dict
def ilp_1bc(input_dict):
onebc = OneBC(input_dict)
onebc = OneBC(input_dict,False)
output_dict = onebc.run()
return output_dict
def ilp_1bc2(input_dict):
onebc = OneBC(input_dict,True)
output_dict = onebc.run()
return output_dict
......
......@@ -205,5 +205,17 @@
"order": 1,
"uid": "63fa4451-4f98-406c-ba4a-d2feb83c2eaa"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "508c9bf5-a874-4027-beb3-3f4f4320e5a0",
"name": "score",
"short_name": "scr",
"description": "Score",
"variable": "score",
"order": 2,
"uid": "77c361d0-7a91-48b1-b1c5-ec72e3063cb0"
}
}
]
\ No newline at end of file
[
{
"model": "workflows.abstractwidget",
"fields": {
"category": "ed859be5-cc13-46b9-b249-c8f026732c1c",
"treeview_image": "",
"uid": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"windows_queue": false,
"package": "ilp",
"interaction_view": "",
"has_progress_bar": false,
"image": "",
"description": "",
"static_image": "ilp.png",
"action": "ilp_1bc2",
"visualization_view": "",
"streaming_visualization_view": "",
"post_interact_action": "",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"is_streaming": false,
"order": 1,
"name": "1BC2"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "ROC nb folds (-1 if no ROC)",
"short_name": "rcn",
"default": "-1",
"description": "number_of_folds to find the best threshold using an internal cross-validation according to roc curve for Bayesian classification",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "roc_nb_folds",
"parameter": true,
"order": 9,
"uid": "506d0550-666b-48f4-af20-4bdd85c02484"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Random seed",
"short_name": "ran",
"default": "0",
"description": "an integer for initialising the random seed",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "srand",
"parameter": true,
"order": 8,
"uid": "5a725dfb-4483-4055-bd9c-d6b6203cc907"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Max Var",
"short_name": "var",
"default": "2",
"description": "Max Variables",
"required": true,
"multi": false,
"parameter_type": "text",
"variable": "max_variable",
"parameter": true,
"order": 5,
"uid": "5ca34e43-8a57-4ee0-8318-752ed340c38b"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Test File",
"short_name": "tst",
"default": "",
"description": "Test File",
"required": false,
"multi": false,
"parameter_type": "file",
"variable": "test_file",
"parameter": false,
"order": 3,
"uid": "70bb70dd-5e79-4ff5-9e8e-bc246fc56b9c"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Prd File",
"short_name": "prd",
"default": "",
"description": "Prd File",
"required": true,
"multi": false,
"parameter_type": "file",
"variable": "prd_file",
"parameter": false,
"order": 1,
"uid": "755c70bd-6334-4acd-83e8-32bc9edb0d43"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Cross validation folds",
"short_name": "crs",
"default": "1",
"description": "the number of partition to apply a cross-validation on the dataset",
"required": false,
"multi": false,
"parameter_type": "text",
"variable": "cross_number",
"parameter": true,
"order": 7,
"uid": "93c979ee-ba3c-4cee-bf35-36b76f472c47"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Load partitions incrementally",
"short_name": "inc",
"default": "",
"description": "load partitions incrementaly, useful when the training set is too to be loaded in one go",
"required": false,
"multi": false,
"parameter_type": "checkbox",
"variable": "load_part_inc",
"parameter": true,
"order": 6,
"uid": "a32768ef-1fa9-481b-920c-cae19e08ce38"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Fct File",
"short_name": "fct",
"default": "",
"description": "Fct File",
"required": true,
"multi": false,
"parameter_type": "file",
"variable": "fct_file",
"parameter": false,
"order": 2,
"uid": "c007ef3d-661d-4059-836d-b92469098036"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Attribute List",
"short_name": "att",
"default": "",
"description": "Attribute name, Number of intervals the attribute has to be discretised in, and a kind of discretisation (sdm: standard deviation centered on the mean, eqb: equal bins)\r\nFormat: \r\ncol1 nbIntervalCol1 sdm, col2 nbInstanceCol2 eqb",
"required": false,
"multi": false,
"parameter_type": "textarea",
"variable": "attribute_list",
"parameter": true,
"order": 10,
"uid": "d9cef934-fa7f-4d7d-9d0a-68b6760770ef"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "Max Lit",
"short_name": "lit",
"default": "3",
"description": "Max Literals",
"required": true,
"multi": false,
"parameter_type": "text",
"variable": "max_literal",
"parameter": true,
"order": 4,
"uid": "dbf24de4-1b1a-4541-954f-1f68f0311055"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "score",
"short_name": "scr",
"description": "Score",
"variable": "score",
"order": 1,
"uid": "79614373-8265-464d-8ce0-6aa6d998388f"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "aa82dde6-3fd8-458f-9f8d-add64d654b11",
"name": "results",
"short_name": "res",
"description": "Results",
"variable": "results",
"order": 1,
"uid": "bde592a0-c2c3-4bb0-a79e-71d317676180"
}
}
]
\ No newline at end of file
......@@ -30,10 +30,18 @@ class Proper(object):
'-database', input_dict['context'].connection.database,
'-table', input_dict['context'].target_table]
try:
args_list += ['-discretize', '1','-discretize-parts', input_dict['discretize_parts'] ]
discretize_parts = input_dict['discretize_parts']
except KeyError:
pass
else:
try:
int(discretize_parts)
except ValueError:
raise Exception('Discretize parts should be an integer')
else:
args_list += ['-discretize', '1','-discretize-parts', discretize_parts]
return args_list
......
import os
import shutil
import re
def handle_files(fct_file_path,test_file_path, url):
if os.path.normpath(fct_file_path) != os.path.normpath(url + '.fct'):
......@@ -18,6 +19,18 @@ def create_attribute_list(attribute_str):
if attribute_list:
#map & strip e.g. : ['-d col1 5 eqb','-d col2 6 eqb']
#join e.g. : '-d col1 5 eqb -d col2 6 eqb'
#split e.g. : ['-d','col1','5','eqb','-d','col2','6','eqb']
return ' '.join(map(lambda field: '-d ' + str(field).strip(), attribute_list)).split(' ')
return ''
\ No newline at end of file
res = check_attributes(' '.join(map(lambda field: '-d ' + str(field).strip(), attribute_list)))
if res is None:
return ''
else:
#split e.g. : ['-d','col1','5','eqb','-d','col2','6','eqb']
return res.split(' ')
return ''
def check_attributes(attribute_str):
print attribute_str
if re.search('^(-d \w+ \d+ (eqb|sdm))( -d \w+ \d+ (eqb|sdm))*$',attribute_str):
return attribute_str
else :
raise Exception('Attribute list is not correct')
return None
\ No newline at end of file
......@@ -4,15 +4,17 @@ import re
import helper
class OneBC(object):
def __init__(self,input_dict):
def __init__(self,input_dict,is1BC2):
self.prd_file_path = input_dict['prd_file']
self.url = os.path.normpath(re.sub('\..*$', '', self.prd_file_path))
self.test_file_path = input_dict['test_file']
self.fct_file_path = input_dict['fct_file']
self.is1BC2 = is1BC2;
self.args_list = self.init_args_list(input_dict)
def init_args_list(self, input_dict):
args_list = [os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('bin','1BC.exe' if os.name == 'nt' else '1BC')), '-r','LANGUAGE']
args_list = [os.path.join(os.path.dirname(os.path.abspath(__file__)),os.path.join('bin','1BC.exe' if os.name == 'nt' else '1BC')), '-r', 'INDIVIDUAL' if self.is1BC2 else 'LANGUAGE']
args_list += ['-roc']
args_list += ['-m', '512']
try:
......@@ -53,7 +55,7 @@ class OneBC(object):
att_list = helper.create_attribute_list(input_dict['attribute_list'])
if att_list:
args_list += att_list
args_list += ['class']
args_list += [str(max_literal) + '/' + str(max_variable), os.path.relpath(self.url, os.path.dirname(os.path.abspath(__file__)))]
......@@ -65,12 +67,16 @@ class OneBC(object):
helper.handle_files(self.fct_file_path, self.test_file_path, self.url)
p = Popen(self.args_list,cwd=os.path.dirname(os.path.abspath(__file__)), stdout=PIPE)
p = Popen(self.args_list,cwd=os.path.dirname(os.path.abspath(__file__)), stderr=PIPE, stdout=PIPE)
stdout_str, stderr_str = p.communicate()
with open(self.url + '.res') as f:
res_file = f.read()
output_dict['results'] = res_file
print stdout_str
print ' '.join(self.args_list)
print stderr_str
output_dict['score'] = stderr_str
return output_dict
\ No newline at end of file
......@@ -1019,7 +1019,11 @@ int call_recursive_1BC(long *a_num_success,long *a_num_test,int status,int a_fol
the_list->next = *a_roc_list;
*a_roc_list = the_list;
/* display the id, the actual and the predicted classes, and the "ratio" of probabilities */
fprintf(stderr,"%s, %d, %d, %lf\n",the_roc->individual,the_actual_class,the_predicted_class,the_probabilities[0]-the_probabilities[1]);
fprintf(stderr,"%s, %d",the_roc->individual,the_actual_class);
for (i=0;i<the_num_classes;i++){
fprintf(stderr,",%lf",the_probabilities[i]);
}
fprintf(stderr,"\n");
} /* (the_error == 0) */
} /* (the_error == 0) */
} /* (the_error == 0) */
......
......@@ -721,6 +721,15 @@ def odt_to_arff(input_dict):
output_dict['arff'] = f.getvalue()
return output_dict
def odt_to_kdic(input_dict):
from noiseAlgorithms4lib import toKDICstring, toKDICheader
output_dict = {}
f = toKDICheader(input_dict['odt'])
output_dict['kdic'] = f.getvalue()
f2 = toKDICstring(input_dict['odt'])
output_dict['txt'] = f2.getvalue()
return output_dict
def string_to_file(input_dict):
return {}
......
......@@ -397,6 +397,69 @@ def toARFFstring(table,try_numericize=0):#filename,table,try_numericize=0):
return f
def toKDICheader(table,try_numericize=0):
import cStringIO, string
t = table
f = cStringIO.StringIO()
f.write('\nDictionary\t%s\n'%t.name)
f.write('{\n')
# attributes
ats = [i for i in t.domain.attributes]
ats.append(t.domain.classVar)
for i in ats:
real = True
if i.varType == 1:
if try_numericize:
# try if all values numeric
for j in i.values:
try:
x = string.atof(j)
except:
real = False # failed
break
else:
real = False
iname = str(i.name)
if string.find(iname," ") != -1:
iname = "'%s'"%iname
if real:
f.write('\tNumerical\t%s\t\t;\n'%iname)
else:
f.write('\tCategorical\t%s\t\t;\n'%iname)
f.write('};\n')
return f
def toKDICstring(table,try_numericize=0):
import cStringIO, string
t = table
f = cStringIO.StringIO()
# attributes
ats = [i for i in t.domain.attributes]
ats.append(t.domain.classVar)
for i in ats:
iname = str(i.name)
f.write('%s\t'%iname)
f.write('\n')
for j in t:
x = []
for i in range(len(ats)):
s = str(j[i])
if string.find(s," ") == -1:
x.append("%s"%s)
else:
x.append("'%s'"%s)
for i in x[:-1]:
f.write('%s\t'%i)
f.write('%s\n'%x[-1])
return f
def getWekaName(name):
#print name
if name == None:
......
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