FahadAlam commited on
Commit
ec76814
1 Parent(s): 351771b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -19,28 +19,30 @@ def findCorrelation(dataset, target):
19
  print("\n")
20
 
21
  d = df.corr()[target].to_dict()
22
- print(d)
23
- labels = sorted(d.items(), key=lambda x: x[1], reverse=True)
24
-
25
  d = d.pop(target)
26
-
 
 
27
  fig1 = plt.figure()
28
  hm = sns.heatmap(df.corr(), annot = True)
29
  hm.set(title = "Correlation matrix of dataset\n")
30
 
31
  fig2 = plt.figure()
32
  # use the function regplot to make a scatterplot
33
- sns.regplot(x=labels.keys()[0], y=df[target])
34
 
35
  fig3 = plt.figure()
36
  # use the function regplot to make a scatterplot
37
- sns.regplot(x=labels.keys()[1], y=df[target])
38
 
39
  fig4 = plt.figure()
40
  # use the function regplot to make a scatterplot
41
- sns.regplot(x=labels.keys()[2], y=df[target])
 
 
 
42
 
43
- return d, fig1, fig2, fig3, fig4
44
 
45
  demo = gr.Interface(fn=findCorrelation, inputs=[gr.File(), 'text'], outputs=[gr.Label(), gr.Plot(), gr.Plot(), gr.Plot(), gr.Plot()], title="Find correlation")
46
  demo.launch(debug=True)
 
19
  print("\n")
20
 
21
  d = df.corr()[target].to_dict()
 
 
 
22
  d = d.pop(target)
23
+ print(d)
24
+ keys = sorted(d.items(), key=lambda x: x[0], reverse=True)
25
+
26
  fig1 = plt.figure()
27
  hm = sns.heatmap(df.corr(), annot = True)
28
  hm.set(title = "Correlation matrix of dataset\n")
29
 
30
  fig2 = plt.figure()
31
  # use the function regplot to make a scatterplot
32
+ sns.regplot(x=keys[0], y=df[target])
33
 
34
  fig3 = plt.figure()
35
  # use the function regplot to make a scatterplot
36
+ sns.regplot(x=keys[1], y=df[target])
37
 
38
  fig4 = plt.figure()
39
  # use the function regplot to make a scatterplot
40
+ sns.regplot(x=keys[2], y=df[target])
41
+
42
+
43
+ labels = {key: d[key] for key in keys[10]}
44
 
45
+ return labels, fig1, fig2, fig3, fig4
46
 
47
  demo = gr.Interface(fn=findCorrelation, inputs=[gr.File(), 'text'], outputs=[gr.Label(), gr.Plot(), gr.Plot(), gr.Plot(), gr.Plot()], title="Find correlation")
48
  demo.launch(debug=True)