Commit 73c54206 authored by Imène Lajili's avatar Imène Lajili

BinaryScore to csvwidget

parent 62e99e59
"ID","Name","CountryCode","District","Population"
"3793","New York","USA","New York","8008278"
"3794","Los Angeles","USA","California","3694820"
"3795","Chicago","USA","Illinois","2896016"
"3796","Houston","USA","Texas","1953631"
"3797","Philadelphia","USA","Pennsylvania","1517550"
......@@ -51,10 +51,17 @@ def scikitAlgorithms_logiscticRegression(input_dict):
output_dict={}
output_dict['LRout'] = clf
return output_dict
#
# REGRESSION
#
def scikitAlgorithms_isotonicRegression(input_dict):
from sklearn.isotonic import IsotonicRegression
cle = IsotonicRegression(y_min=str(input_dict["y_min"]), y_max=str(input_dict["y_max"]))
output_dict={}
output_dict['isregout']=cle
return output_dict
def scikitAlgorithms_Ridge(input_dict):
from sklearn.linear_model import Ridge
......@@ -226,13 +233,38 @@ def scikitAlgorithms_displayDecisionTree(input_dict):
# return output_dict
def scikitAlgorithms_binoryScoreToCsv(input_dict):
import csv
import os
import itertools
output_dict={}
item_to_remove='name'
BinaryScore = input_dict['binary_score']
if 'name' in BinaryScore : del BinaryScore['name']
try:
myFilePath = os.path.abspath('test/score.csv')
headings=BinaryScore.keys()
dictlist=BinaryScore.items()
with open('/home/clowdflows/clowdflows/workflows/scikitAlgorithms/test/score.csv','w') as myCSVFile:
csvWriter = csv.DictWriter(myCSVFile, fieldnames=headings)
csvWriter.writeheader()
foo1=[]
foo2=[]
foo1=BinaryScore.get('actual')
foo2=BinaryScore.get('predicted')
i=0
for f,b in itertools.izip(foo1,foo2):
csvWriter.writerow({'actual':f, 'predicted':b})
i=+1
except IOError as (errno, strerror):
print("I/O error({0}): {1}".format(errno, strerror))
scorePath='/home/clowdflows/clowdflows/workflows/scikitAlgorithms/test/score.csv'
output_dict['csv_out']=scorePath
return output_dict
......
[
{
"model": "workflows.abstractwidget",
"fields": {
"category": "ef06ed94-c57a-4bb0-8f05-1212920c95a0",
"treeview_image": "",
"uid": "0ff7d39e-0d32-11e6-a148-3e1d05defe78",
"windows_queue": false,
"package": "scikitAlgorithms",
"interaction_view": "",
"has_progress_bar": false,
"image": "",
"description": "convert binary score into csv file",
"static_image": "",
"action": "scikitAlgorithms_binoryScoreToCsv",
"visualization_view": "",
"streaming_visualization_view": "",
"post_interact_action": "",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"is_streaming": false,
"order": 1,
"name": "Binary score to CSV"
}
},
{
"model": "workflows.abstractinput",
"fields": {
"widget": "0ff7d39e-0d32-11e6-a148-3e1d05defe78",
"name": "BinaryScore",
"short_name": "scr",
"default": "",
"description": "",
"required": true,
"multi": false,
"parameter_type": null,
"variable": "binary_score",
"parameter": false,
"order": 1,
"uid": "0ff7ccc8-0d32-11e6-a148-3e1d05defe78"
}
},
{
"model": "workflows.abstractoutput",
"fields": {
"widget": "0ff7d39e-0d32-11e6-a148-3e1d05defe78",
"name": "CsvOut",
"short_name": "csv",
"description": "",
"variable": "csv_out",
"order": 1,
"uid": "0ff7d15a-0d32-11e6-a148-3e1d05defe78"
}
}
]
\ No newline at end of file
actual,predicted
0,-34.27652299999997
0,-68.94090900000003
1,-46.68245000000002
0,-74.74344199999996
0,-22.277918999999997
0,-94.63270399999999
0,1.9052730000000224
0,-78.53896600000002
0,-71.561802
0,-34.27652299999997
1,-64.16632599999997
1,0.08134799999999132
1,-46.68245000000002
0,-1.0828649999999698
1,-5.924311000000046
0,-71.561802
1,16.475798999999995
0,10.08275900000001
1,-1.3642859999999928
0,-28.711099999999988
1,35.09391400000001
0,-100.39270800000003
1,28.213662
1,-12.392975000000007
1,-6.754986999999971
1,45.188011999999986
0,10.08275900000001
0,-30.496555
0,-12.992399000000006
0,-100.39270800000003
1,4.8996449999999925
1,14.844707
1,22.56330299999999
0,-25.065054999999973
0,-25.065054999999973
1,5.565084000000013
0,-64.16632599999997
0,-33.713008
0,-70.075336
1,39.56942699999999
0,8.041542000000021
1,39.35023899999999
0,-12.992399000000006
0,-100.39270800000003
0,-30.496555
0,29.398346000000004
0,-70.075336
0,-100.39270800000003
1,11.081566999999978
1,17.83740899999998
1,37.25588700000003
0,54.19680499999998
0,-27.03575699999999
0,-75.98596000000003
0,9.05338900000001
0,-56.840097000000014
1,37.25588700000003
0,20.01932499999998
0,-5.6364750000000186
1,40.74596199999996
1,34.998118000000005
0,-33.713008
0,26.747443999999973
0,-24.828628000000037
0,-30.496555
1,16.475798999999995
0,-67.35008400000004
0,-67.35008400000004
0,-12.195186000000035
0,-54.29095799999999
0,-38.90842500000002
0,-10.935843000000034
0,-4.246102000000008
1,-8.854375000000005
1,2.0564390000000117
0,-30.21471600000001
0,-53.758493000000044
1,-30.21471600000001
0,-41.17367999999999
0,-38.139696999999956
1,31.16285000000005
0,-76.946418
0,-56.839084000000014
0,-30.21471600000001
0,-110.68513000000002
1,25.103321000000022
1,-0.7594650000000058
1,5.176423999999997
1,-0.7271099999999819
0,-83.69914599999998
0,-71.29764999999998
1,9.804790999999994
1,0.9271229999999946
1,37.764373999999975
0,80.777896
0,80.777896
1,3.694078999999988
0,-101.43708099999998
1,7.869854000000004
0,-4.246102000000008
0,29.125972999999988
0,-112.66724299999998
0,39.14901099999997
0,-101.99841400000003
0,-101.99841400000003
0,-37.32040000000001
0,4.621381000000014
0,17.489252000000022
0,-30.21471600000001
1,48.78765000000004
0,-10.636021999999969
0,8.547325999999998
1,30.48512800000003
0,-10.935843000000034
1,44.69518600000001
1,-34.93375500000002
1,-18.100301
0,22.597906999999964
1,48.583586000000025
0,-39.347699999999975
0,-68.44316100000003
0,-58.179303000000004
0,-94.57954799999993
0,47.17788300000001
0,-95.23234900000006
0,-112.66724299999998
0,17.489252000000022
1,32.89182299999999
0,20.050274
1,-8.406460999999979
1,-20.124504
0,-37.505904999999984
0,41.19676499999997
1,13.969118999999978
0,-20.323087999999984
0,-24.329802
0,-53.758493000000044
0,-71.29764999999998
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