-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualization.java
More file actions
41 lines (33 loc) · 1.34 KB
/
Visualization.java
File metadata and controls
41 lines (33 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.ml1;
import java.io.IOException;
import tech.tablesaw.api.Table;
import tech.tablesaw.plotly.Plot;
import tech.tablesaw.plotly.components.Figure;
import tech.tablesaw.plotly.components.Layout;
import tech.tablesaw.plotly.traces.BoxTrace;
import tech.tablesaw.plotly.traces.HistogramTrace;
import tech.tablesaw.plotly.traces.ScatterTrace;
public class Visualization {
public static void main(String args[]) {
System.out.println("data analytics");
try {
Table insurance_data=Table.read().csv("C:\\Users\\SANDHYA\\Desktop\\dataset2.csv");
System.out.println(insurance_data.shape());
System.out.println(insurance_data.structure());
System.out.println(insurance_data.summary());
Layout l1=Layout.builder().title("Medical Insurance").build();
//box-plot
BoxTrace t1=BoxTrace.builder(insurance_data.categoricalColumn("smoker=no"), insurance_data.nCol("charges")).build();
//histogram
HistogramTrace t2=HistogramTrace.builder(insurance_data.categoricalColumn("children"), insurance_data.nCol("charges")).build();
Plot.show(new Figure(l1,t1));
Plot.show(new Figure(l1,t2));
//scatter-plot
ScatterTrace s=ScatterTrace.builder(insurance_data.nCol("bmi"),insurance_data.nCol("charges")).build();
Plot.show(new Figure(l1,s));
}
catch(IOException e) {
e.printStackTrace();
}
}
}