-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
data.html
2128 lines (1987 loc) · 130 KB
/
data.html
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
layout: layout.njk
permalink: "{{ page.filePathStem }}.html"
---
{% include "toc.njk" %}
<div class="col-md-9 col-md-pull-3">
<h1 id="data-top" class="title">Data</h1>
<p>Machine learning is all about building models from data. However, data scientists
frequently talk about models and algorithms first, which very likely generates
suboptimal results. The other approach is to play with the data first. Even simple
statistics and plots can help us get feelings of data and problems, which more likely
lead us to better modelling.</p>
<h2 id="features">Features</h2>
<p>A feature is an individual measurable property of a phenomenon being observed.
Features are also called explanatory variables, independent variables, predictors, regressors, etc.
Any attribute could be a feature, but choosing informative, discriminating and
independent features is a crucial step for effective algorithms in machine learning.
Features are usually numeric and a set of numeric features can be conveniently
described by a feature vector. Structural features such as strings, sequences and
graphs are also used in areas such as natural language processing, computational biology, etc.</p>
<p>Feature engineering is the process of using domain knowledge of the data to create features that make
machine learning algorithms work. Feature engineering is fundamental to the application of machine
learning, and is both difficult and expensive. It requires the experimentation of multiple
possibilities and the combination of automated
techniques with the intuition and knowledge of the domain expert.</p>
<h2 title="data-type">Data Type</h2>
<p>Generally speaking, there are two major types of attributes:</p>
<dl>
<dt>Qualitative variables:</dt>
<dd><p>The data values are non-numeric categories. Examples: Blood type, Gender.</p></dd>
<dt>Quantitative variables:</dt>
<dd><p>The data values are counts or numerical measurements. A quantitative
variable can be either discrete such as the number of students receiving
an 'A' in a class, or continuous such as GPA, salary and so on.</p></dd>
</dl>
<p>Another way of classifying data is by the measurement scales. In statistics,
there are four generally used measurement scales:</p>
<dl>
<dt>Nominal data:</dt>
<dd><p>Data values are non-numeric group labels. For example, Gender variable
can be defined as male = 0 and female =1.</p></dd>
<dt>Ordinal data:</dt>
<dd><p>Data values are categorical and may be ranked in some numerically
meaningful way. For example, strongly disagree to strong agree may be
defined as 1 to 5.</p></dd>
<dt>Continuous data:</dt>
<dd><ul>
<li><strong>Interval data:</strong>
Data values are ranged in a real interval, which can be as large as
from negative infinity to positive infinity. The difference between two
values are meaningful, however, the ratio of two interval data is not
meaningful. For example temperature, IQ. </li>
<li><strong>Ratio data:</strong>
Both difference and ratio of two values are meaningful. For example,
salary, weight.</li>
</ul></dd>
</dl>
<p>Many machine learning algorithms can only handle numeric attributes while a few
such as decision trees can process nominal attribute directly. Date attribute
is useful in plotting. With some feature engineering, values like day of week
can be used as nominal attribute. String attribute could be used in text mining
and natural language processing.</p>
<h2 id="DataFrame">DataFrame</h2>
<p>Many Smile algorithms take simple <code>double[]</code> as input. But we also use
the encapsulation class <a href="api/java/smile/data/DataFrame.html">DataFrame</a>.
In fact, the output of most Smile data parsers is a DataFrame object.
DataFrames are immutable and contain a fixed number of named columns.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_1" data-toggle="tab">Scala</a></li>
<li><a href="#java_1" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_1" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_1">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> val iris = read.arff("data/weka/iris.arff")
[main] INFO smile.io.Arff - Read ARFF relation iris
iris: DataFrame =
+-----------+----------+-----------+----------+-----------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+-----------+
| 5.1| 3.5| 1.4| 0.2|Iris-setosa|
| 4.9| 3| 1.4| 0.2|Iris-setosa|
| 4.7| 3.2| 1.3| 0.2|Iris-setosa|
| 4.6| 3.1| 1.5| 0.2|Iris-setosa|
| 5| 3.6| 1.4| 0.2|Iris-setosa|
| 5.4| 3.9| 1.7| 0.4|Iris-setosa|
| 4.6| 3.4| 1.4| 0.3|Iris-setosa|
| 5| 3.4| 1.5| 0.2|Iris-setosa|
| 4.4| 2.9| 1.4| 0.2|Iris-setosa|
| 4.9| 3.1| 1.5| 0.1|Iris-setosa|
+-----------+----------+-----------+----------+-----------+
140 more rows...
smile> iris.summary
res1: DataFrame =
+-----------+-----+---+--------+---+
| column|count|min| avg|max|
+-----------+-----+---+--------+---+
|sepallength| 150|4.3|5.843333|7.9|
| sepalwidth| 150| 2| 3.054|4.4|
|petallength| 150| 1|3.758667|6.9|
| petalwidth| 150|0.1|1.198667|2.5|
+-----------+-----+---+--------+---+
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_1">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> import smile.data.*
jshell> import smile.io.*
jshell> var iris = Read.arff("data/weka/iris.arff")
[main] INFO smile.io.Arff - Read ARFF relation iris
iris ==> [sepallength: float, sepalwidth: float, petalleng ... -------+
140 more rows...
jshell> iris
[main] INFO smile.io.Arff - Read ARFF relation iris
$3 ==> [sepallength: float, sepalwidth: float, petallength: float, petalwidth: float, class: byte nominal[Iris-setosa, Iris-versicolor, Iris-virginica]]
+-----------+----------+-----------+----------+-----------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+-----------+
| 5.1| 3.5| 1.4| 0.2|Iris-setosa|
| 4.9| 3| 1.4| 0.2|Iris-setosa|
| 4.7| 3.2| 1.3| 0.2|Iris-setosa|
| 4.6| 3.1| 1.5| 0.2|Iris-setosa|
| 5| 3.6| 1.4| 0.2|Iris-setosa|
| 5.4| 3.9| 1.7| 0.4|Iris-setosa|
| 4.6| 3.4| 1.4| 0.3|Iris-setosa|
| 5| 3.4| 1.5| 0.2|Iris-setosa|
| 4.4| 2.9| 1.4| 0.2|Iris-setosa|
| 4.9| 3.1| 1.5| 0.1|Iris-setosa|
+-----------+----------+-----------+----------+-----------+
140 more rows...
jshell> iris.summary()
$5 ==> [column: String, count: long, min: double, avg: double, max: double]
+-----------+-----+---+--------+---+
| column|count|min| avg|max|
+-----------+-----+---+--------+---+
|sepallength| 150|4.3|5.843333|7.9|
| sepalwidth| 150| 2| 3.054|4.4|
|petallength| 150| 1|3.758667|6.9|
| petalwidth| 150|0.1|1.198667|2.5|
+-----------+-----+---+--------+---+
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_1">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> import smile.*
>>> import smile.data.*
>>> import smile.io.*
>>> val iris = Read.arff("data/weka/iris.arff")
[main] INFO smile.io.Arff - Read ARFF relation iris
>>> iris
res3: smile.data.DataFrame! = [sepallength: float, sepalwidth: float, petallength: float, petalwidth: float, class: byte nominal[Iris-setosa, Iris-versicolor, Iris-virginica]]
+-----------+----------+-----------+----------+-----------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+-----------+
| 5.1| 3.5| 1.4| 0.2|Iris-setosa|
| 4.9| 3| 1.4| 0.2|Iris-setosa|
| 4.7| 3.2| 1.3| 0.2|Iris-setosa|
| 4.6| 3.1| 1.5| 0.2|Iris-setosa|
| 5| 3.6| 1.4| 0.2|Iris-setosa|
| 5.4| 3.9| 1.7| 0.4|Iris-setosa|
| 4.6| 3.4| 1.4| 0.3|Iris-setosa|
| 5| 3.4| 1.5| 0.2|Iris-setosa|
| 4.4| 2.9| 1.4| 0.2|Iris-setosa|
| 4.9| 3.1| 1.5| 0.1|Iris-setosa|
+-----------+----------+-----------+----------+-----------+
140 more rows...
>>> iris.summary()
res4: smile.data.DataFrame! = [column: String, count: long, min: double, avg: double, max: double]
+-----------+-----+---+--------+---+
| column|count|min| avg|max|
+-----------+-----+---+--------+---+
|sepallength| 150|4.3|5.843333|7.9|
| sepalwidth| 150| 2| 3.054|4.4|
|petallength| 150| 1|3.758667|6.9|
| petalwidth| 150|0.1|1.198667|2.5|
+-----------+-----+---+--------+---+
</code></pre>
</div>
</div>
</div>
<p>We can get a row with the array syntax or refer a column by its name.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_2" data-toggle="tab">Scala</a></li>
<li><a href="#java_2" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_2" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_2">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> iris(0)
res5: Tuple = {
sepallength: 5.1,
sepalwidth: 3.5,
petallength: 1.4,
petalwidth: 0.2,
class: Iris-setosa
}
smile> iris("sepallength")
res6: vector.BaseVector[T, TS, S] = [5.099999904632568, 4.900000095367432, 4.699999809265137, 4.599999904632568, 5.0, 5.400000095367432, 4.599999904632568, 5.0, 4.400000095367432, 4.900000095367432, ... 140 more]
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_2">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> iris.get(0)
$7 ==> {
sepallength: 5.1,
sepalwidth: 3.5,
petallength: 1.4,
petalwidth: 0.2,
class: Iris-setosa
}
jshell> iris.column("sepallength")
$8 ==> [5.099999904632568, 4.900000095367432, 4.699999809265137, 4.599999904632568, 5.0, 5.400000095367432, 4.599999904632568, 5.0, 4.400000095367432, 4.900000095367432, ... 140 more]
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_2">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> iris[0]
res6: smile.data.Tuple! = {
sepallength: 5.1,
sepalwidth: 3.5,
petallength: 1.4,
petalwidth: 0.2,
class: Iris-setosa
}
>>> iris.column("sepallength")
res7: smile.data.vector.BaseVector<(raw) kotlin.Any!, (raw) kotlin.Any!, (raw) java.util.stream.BaseStream<*, *>!>! = [5.099999904632568, 4.900000095367432, 4.699999809265137, 4.599999904632568, 5.0, 5.400000095367432, 4.599999904632568, 5.0, 4.400000095367432, 4.900000095367432, ... 140 more]
</code></pre>
</div>
</div>
</div>
<p>Similarly, we can select a few columns to create a new data frame. </p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_3" data-toggle="tab">Scala</a></li>
<li><a href="#java_3" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_3" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_3">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> iris.select("sepallength", "sepalwidth")
res8: DataFrame =
+-----------+----------+
|sepallength|sepalwidth|
+-----------+----------+
| 5.1| 3.5|
| 4.9| 3|
| 4.7| 3.2|
| 4.6| 3.1|
| 5| 3.6|
| 5.4| 3.9|
| 4.6| 3.4|
| 5| 3.4|
| 4.4| 2.9|
| 4.9| 3.1|
+-----------+----------+
140 more rows...
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_3">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> iris.select("sepallength", "sepalwidth")
$9 ==> [sepallength: float, sepalwidth: float]
+-----------+----------+
|sepallength|sepalwidth|
+-----------+----------+
| 5.1| 3.5|
| 4.9| 3|
| 4.7| 3.2|
| 4.6| 3.1|
| 5| 3.6|
| 5.4| 3.9|
| 4.6| 3.4|
| 5| 3.4|
| 4.4| 2.9|
| 4.9| 3.1|
+-----------+----------+
140 more rows...
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_3">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> iris.select("sepallength", "sepalwidth")
res8: smile.data.DataFrame! = [sepallength: float, sepalwidth: float]
+-----------+----------+
|sepallength|sepalwidth|
+-----------+----------+
| 5.1| 3.5|
| 4.9| 3|
| 4.7| 3.2|
| 4.6| 3.1|
| 5| 3.6|
| 5.4| 3.9|
| 4.6| 3.4|
| 5| 3.4|
| 4.4| 2.9|
| 4.9| 3.1|
+-----------+----------+
140 more rows...
</code></pre>
</div>
</div>
</div>
<p>Advanced operations such as <code>exists</code>, <code>forall</code>,
<code>find</code>, <code>filter</code> are also supported. In Java API,
all these operations are on <code>Stream</code>. The corresponding methods
are <code>anyMatch</code>, <code>allMatch</code>, <code>findAny</code>,
and <code>filter</code>.
The <code>predicate</code> of these functions expect a <code>Tuple</code></p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_4" data-toggle="tab">Scala</a></li>
<li><a href="#java_4" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_4" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_4">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> iris.exists(_.getDouble(0) > 4.5)
res16: Boolean = true
smile> iris.forall(_.getDouble(0) < 10)
res17: Boolean = true
smile> iris.find(_("class") == 1)
res18: java.util.Optional[Tuple] = Optional[{
sepallength: 6.2,
sepalwidth: 2.9,
petallength: 4.3,
petalwidth: 1.3,
class: Iris-versicolor
}]
smile> iris.find(_.getString("class").equals("Iris-versicolor"))
res19: java.util.Optional[Tuple] = Optional[{
sepallength: 6.2,
sepalwidth: 2.9,
petallength: 4.3,
petalwidth: 1.3,
class: Iris-versicolor
}]
smile> iris.filter { row => row.getDouble(1) > 3 && row("class") != 0 }
res20: DataFrame =
+-----------+----------+-----------+----------+---------------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+---------------+
| 7| 3.2| 4.7| 1.4|Iris-versicolor|
| 6.4| 3.2| 4.5| 1.5|Iris-versicolor|
| 6.9| 3.1| 4.9| 1.5|Iris-versicolor|
| 6.3| 3.3| 4.7| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.4| 1.4|Iris-versicolor|
| 5.9| 3.2| 4.8| 1.8|Iris-versicolor|
| 6| 3.4| 4.5| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.7| 1.5|Iris-versicolor|
| 6.3| 3.3| 6| 2.5| Iris-virginica|
| 7.2| 3.6| 6.1| 2.5| Iris-virginica|
+-----------+----------+-----------+----------+---------------+
15 more rows...
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_4">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> iris.stream().anyMatch(row -> row.getDouble(0) > 4.5)
$14 ==> true
jshell> iris.stream().allMatch(row -> row.getDouble(0) < 10)
$15 ==> true
jshell> iris.stream().filter(row -> row.getByte("class") == 1).findAny()
$17 ==> Optional[{
sepallength: 6.2,
sepalwidth: 2.9,
petallength: 4.3,
petalwidth: 1.3,
class: Iris-versicolor
}]
jshell> iris.stream().filter(row -> row.getString("class").equals("Iris-versicolor")).findAny()
$18 ==> Optional[{
sepallength: 6.2,
sepalwidth: 2.9,
petallength: 4.3,
petalwidth: 1.3,
class: Iris-versicolor
}]
jshell> DataFrame.of(iris.stream().filter(row -> row.getDouble(1) > 3 && row.getByte("class") != 0))
$20 ==> [sepallength: float, sepalwidth: float, petallength: float, petalwidth: float, class: byte nominal[Iris-setosa, Iris-versicolor, Iris-virginica]]
+-----------+----------+-----------+----------+---------------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+---------------+
| 7| 3.2| 4.7| 1.4|Iris-versicolor|
| 6.4| 3.2| 4.5| 1.5|Iris-versicolor|
| 6.9| 3.1| 4.9| 1.5|Iris-versicolor|
| 6.3| 3.3| 4.7| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.4| 1.4|Iris-versicolor|
| 6| 3.4| 4.5| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.7| 1.5|Iris-versicolor|
| 6.3| 3.3| 6| 2.5| Iris-virginica|
| 7.2| 3.6| 6.1| 2.5| Iris-virginica|
+-----------+----------+-----------+----------+---------------+
15 more rows...
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_4">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> iris.stream().anyMatch({row -> row.getDouble(0) > 4.5})
res10: kotlin.Boolean = true
>>> iris.stream().allMatch({row -> row.getDouble(0) < 10})
res11: kotlin.Boolean = true
>>> iris.stream().filter({row -> row.getByte("class") == 1.toByte()}).findAny()
res14: java.util.Optional<smile.data.Tuple!>! = Optional[{
sepallength: 6.2,
sepalwidth: 2.9,
petallength: 4.3,
petalwidth: 1.3,
class: Iris-versicolor
}]
>>> iris.stream().filter({row -> row.getString("class").equals("Iris-versicolor")}).findAny()
res15: java.util.Optional<smile.data.Tuple!>! = Optional[{
sepallength: 5.4,
sepalwidth: 3,
petallength: 4.5,
petalwidth: 1.5,
class: Iris-versicolor
}]
>>> DataFrame.of(iris.stream().filter({row -> row.getDouble(1) > 3 && row.getByte("class") != 0.toByte()}))
res22: smile.data.DataFrame! = [sepallength: float, sepalwidth: float, petallength: float, petalwidth: float, class: byte nominal[Iris-setosa, Iris-versicolor, Iris-virginica]]
+-----------+----------+-----------+----------+---------------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+---------------+
| 7| 3.2| 4.7| 1.4|Iris-versicolor|
| 6.4| 3.2| 4.5| 1.5|Iris-versicolor|
| 6.9| 3.1| 4.9| 1.5|Iris-versicolor|
| 6.3| 3.3| 4.7| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.4| 1.4|Iris-versicolor|
| 5.9| 3.2| 4.8| 1.8|Iris-versicolor|
| 6| 3.4| 4.5| 1.6|Iris-versicolor|
| 6.7| 3.1| 4.7| 1.5|Iris-versicolor|
| 6.3| 3.3| 6| 2.5| Iris-virginica|
| 7.2| 3.6| 6.1| 2.5| Iris-virginica|
+-----------+----------+-----------+----------+---------------+
15 more rows...
</code></pre>
</div>
</div>
</div>
<p>Besides numeric and nominal values, many other data types
are also supported.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_5" data-toggle="tab">Scala</a></li>
<li><a href="#java_5" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_5" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_5">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> val strings = read.arff("data/weka/string.arff")
[main] INFO smile.io.Arff - Read ARFF relation LCCvsLCSH
strings: DataFrame =
+-----+--------------------------------------+
| LCC| LCSH|
+-----+--------------------------------------+
| AG5|Encyclopedias and dictionaries.;Twe...|
|AS262| Science -- Soviet Union -- History.|
| AE5| Encyclopedias and dictionaries.|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
+-----+--------------------------------------+
smile> strings.filter(_.getString(0).startsWith("AS"))
res21: DataFrame =
+-----+--------------------------------------+
| LCC| LCSH|
+-----+--------------------------------------+
|AS262| Science -- Soviet Union -- History.|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
+-----+--------------------------------------+
smile> val dates = read.arff("data/weka/date.arff")
[main] INFO smile.io.Arff - Read ARFF relation Timestamps
dates: DataFrame =
+-------------------+
| timestamp|
+-------------------+
|2001-04-03 12:12:12|
|2001-05-03 12:59:55|
+-------------------+
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_5">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> var strings = Read.arff("data/weka/string.arff")
[main] INFO smile.io.Arff - Read ARFF relation LCCvsLCSH
strings ==> [LCC: String, LCSH: String]
+-----+--------------------------------------+
| LCC| LCSH|
+-----+--------------------------------------+
| AG5|Encyclopedias and dictionaries.;Twe...|
|AS262| Science -- Soviet Union -- History.|
| AE5| Encyclopedias and dictionaries.|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
+-----+--------------------------------------+
jshell> var dates = Read.arff("data/weka/date.arff")
[main] INFO smile.io.Arff - Read ARFF relation Timestamps
dates ==> [timestamp: DateTime]
+-------------------+
| timestamp|
+-------------------+
|2001-04-03 12:12:12|
|2001-05-03 12:59:55|
+-------------------+
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_5">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> val strings = read.arff("data/weka/string.arff")
[main] INFO smile.io.Arff - Read ARFF relation LCCvsLCSH
>>> strings
res26: smile.data.DataFrame = [LCC: String, LCSH: String]
+-----+--------------------------------------+
| LCC| LCSH|
+-----+--------------------------------------+
| AG5|Encyclopedias and dictionaries.;Twe...|
|AS262| Science -- Soviet Union -- History.|
| AE5| Encyclopedias and dictionaries.|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
|AS281|Astronomy, Assyro-Babylonian.;Moon ...|
+-----+--------------------------------------+
>>> val dates = read.arff("data/weka/date.arff")
[main] INFO smile.io.Arff - Read ARFF relation Timestamps
>>> dates
res28: smile.data.DataFrame = [timestamp: DateTime]
+-------------------+
| timestamp|
+-------------------+
|2001-04-03 12:12:12|
|2001-05-03 12:59:55|
+-------------------+
</code></pre>
</div>
</div>
</div>
<p>For data wrangling, the most important functions of <code>DataFrame</code>
are <code>map</code> and <code>groupBy</code>.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_6" data-toggle="tab">Scala</a></li>
<li><a href="#java_6" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_6" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_6">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> iris.map { row =>
val x = new Array[Double](6)
for (i <- 0 until 4) x(i) = row.getDouble(i)
x(4) = x(0) * x(1)
x(5) = x(2) * x(3)
x
}
res22: Iterable[Array[Double]] = ArrayBuffer(
Array(5.1, 3.5, 1.4, 0.2, 17.849999999999998, 0.27999999999999997),
Array(4.9, 3.0, 1.4, 0.2, 14.700000000000001, 0.27999999999999997),
Array(4.7, 3.2, 1.3, 0.2, 15.040000000000001, 0.26),
Array(4.6, 3.1, 1.5, 0.2, 14.26, 0.30000000000000004),
Array(5.0, 3.6, 1.4, 0.2, 18.0, 0.27999999999999997),
Array(5.4, 3.9, 1.7, 0.4, 21.060000000000002, 0.68),
Array(4.6, 3.4, 1.4, 0.3, 15.639999999999999, 0.42),
Array(5.0, 3.4, 1.5, 0.2, 17.0, 0.30000000000000004),
Array(4.4, 2.9, 1.4, 0.2, 12.76, 0.27999999999999997),
Array(4.9, 3.1, 1.5, 0.1, 15.190000000000001, 0.15000000000000002),
Array(5.4, 3.7, 1.5, 0.2, 19.980000000000004, 0.30000000000000004),
Array(4.8, 3.4, 1.6, 0.2, 16.32, 0.32000000000000006),
Array(4.8, 3.0, 1.4, 0.1, 14.399999999999999, 0.13999999999999999),
Array(4.3, 3.0, 1.1, 0.1, 12.899999999999999, 0.11000000000000001),
Array(5.8, 4.0, 1.2, 0.2, 23.2, 0.24),
Array(5.7, 4.4, 1.5, 0.4, 25.080000000000002, 0.6000000000000001),
Array(5.4, 3.9, 1.3, 0.4, 21.060000000000002, 0.52),
Array(5.1, 3.5, 1.4, 0.3, 17.849999999999998, 0.42),
Array(5.7, 3.8, 1.7, 0.3, 21.66, 0.51),
Array(5.1, 3.8, 1.5, 0.3, 19.38, 0.44999999999999996),
Array(5.4, 3.4, 1.7, 0.2, 18.36, 0.34),
Array(5.1, 3.7, 1.5, 0.4, 18.87, 0.6000000000000001),
Array(4.6, 3.6, 1.0, 0.2, 16.56, 0.2),
Array(5.1, 3.3, 1.7, 0.5, 16.83, 0.85),
...
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_6">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> var x6 = iris.stream().map(row -> {
...> var x = new double[6];
...> for (int i = 0; i < 4; i++) x[i] = row.getDouble(i);
...> x[4] = x[0] * x[1];
...> x[5] = x[2] * x[3];
...> return x;
...> })
x6 ==> java.util.stream.ReferencePipeline$3@32eff876
jshell> x6.forEach(xi -> System.out.println(Arrays.toString(xi)))
[6.199999809265137, 2.9000000953674316, 4.300000190734863, 1.2999999523162842, 17.980000038146954, 5.590000042915335]
[7.300000190734863, 2.9000000953674316, 6.300000190734863, 1.7999999523162842, 21.170001249313373, 11.340000042915335]
[7.699999809265137, 3.0, 6.099999904632568, 2.299999952316284, 23.09999942779541, 14.029999489784245]
[6.699999809265137, 2.5, 5.800000190734863, 1.7999999523162842, 16.749999523162842, 10.440000066757193]
[7.199999809265137, 3.5999999046325684, 6.099999904632568, 2.5, 25.919998626709003, 15.249999761581421]
[6.5, 3.200000047683716, 5.099999904632568, 2.0, 20.800000309944153, 10.199999809265137]
[6.400000095367432, 2.700000047683716, 5.300000190734863, 1.899999976158142, 17.28000056266785, 10.070000236034389]
[5.699999809265137, 2.5999999046325684, 3.5, 1.0, 14.819998960495013, 3.5]
[4.599999904632568, 3.5999999046325684, 1.0, 0.20000000298023224, 16.55999921798707, 0.20000000298023224]
[5.400000095367432, 3.0, 4.5, 1.5, 16.200000286102295, 6.75]
[6.699999809265137, 3.0999999046325684, 4.400000095367432, 1.399999976158142, 20.76999876976015, 6.160000028610227]
[5.099999904632568, 3.799999952316284, 1.600000023841858, 0.20000000298023224, 19.379999394416814, 0.32000000953674324]
[5.599999904632568, 3.0, 4.5, 1.5, 16.799999713897705, 6.75]
[6.0, 3.4000000953674316, 4.5, 1.600000023841858, 20.40000057220459, 7.200000107288361]
[5.099999904632568, 3.299999952316284, 1.7000000476837158, 0.5, 16.82999944210053, 0.8500000238418579]
[5.5, 2.4000000953674316, 3.799999952316284, 1.100000023841858, 13.200000524520874, 4.1800000381469715]
[7.099999904632568, 3.0, 5.900000095367432, 2.0999999046325684, 21.299999713897705, 12.38999963760375]
[6.300000190734863, 3.4000000953674316, 5.599999904632568, 2.4000000953674316, 21.420001249313373, 13.440000305175772]
[5.099999904632568, 2.5, 3.0, 1.100000023841858, 12.749999761581421, 3.3000000715255737]
[6.400000095367432, 3.0999999046325684, 5.5, 1.7999999523162842, 19.839999685287466, 9.899999737739563]
[6.300000190734863, 2.9000000953674316, 5.599999904632568, 1.7999999523162842, 18.27000115394594, 10.079999561309819]
[5.5, 2.4000000953674316, 3.700000047683716, 1.0, 13.200000524520874, 3.700000047683716]
[6.5, 3.0, 5.800000190734863, 2.200000047683716, 19.5, 12.76000069618226]
[7.599999904632568, 3.0, 6.599999904632568, 2.0999999046325684, 22.799999713897705, 13.859999170303354]
[4.900000095367432, 2.5, 4.5, 1.7000000476837158, 12.250000238418579, 7.650000214576721]
[5.0, 2.299999952316284, 3.299999952316284, 1.0, 11.499999761581421, 3.299999952316284]
[5.599999904632568, 2.700000047683716, 4.199999809265137, 1.2999999523162842, 15.120000009536739, 5.45999955177308]
...
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_6">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> val x6 = iris.stream().map({row ->
... val x = DoubleArray(6)
... for (i in 0..3) x[i] = row.getDouble(i)
... x[4] = x[0] * x[1]
... x[5] = x[2] * x[3]
... x
... })
>>> x6.forEach({xi: DoubleArray -> println(java.util.Arrays.toString(xi))})
[5.699999809265137, 2.5999999046325684, 3.5, 1.0, 14.819998960495013, 3.5]
[6.699999809265137, 3.0999999046325684, 4.400000095367432, 1.399999976158142, 20.76999876976015, 6.160000028610227]
[5.400000095367432, 3.0, 4.5, 1.5, 16.200000286102295, 6.75]
[5.5, 2.4000000953674316, 3.799999952316284, 1.100000023841858, 13.200000524520874, 4.1800000381469715]
[5.599999904632568, 3.0, 4.5, 1.5, 16.799999713897705, 6.75]
[4.900000095367432, 3.0999999046325684, 1.5, 0.10000000149011612, 15.189999828338614, 0.15000000223517418]
[4.599999904632568, 3.5999999046325684, 1.0, 0.20000000298023224, 16.55999921798707, 0.20000000298023224]
[7.699999809265137, 3.0, 6.099999904632568, 2.299999952316284, 23.09999942779541, 14.029999489784245]
[5.400000095367432, 3.700000047683716, 1.5, 0.20000000298023224, 19.980000610351567, 0.30000000447034836]
[5.800000190734863, 2.700000047683716, 4.099999904632568, 1.0, 15.660000791549692, 4.099999904632568]
[6.300000190734863, 3.4000000953674316, 5.599999904632568, 2.4000000953674316, 21.420001249313373, 13.440000305175772]
[6.0, 3.4000000953674316, 4.5, 1.600000023841858, 20.40000057220459, 7.200000107288361]
[6.199999809265137, 2.200000047683716, 4.5, 1.5, 13.63999987602233, 6.75]
[6.400000095367432, 3.0999999046325684, 5.5, 1.7999999523162842, 19.839999685287466, 9.899999737739563]
[6.699999809265137, 3.0999999046325684, 4.699999809265137, 1.5, 20.76999876976015, 7.049999713897705]
[5.5, 2.4000000953674316, 3.700000047683716, 1.0, 13.200000524520874, 3.700000047683716]
[5.099999904632568, 3.799999952316284, 1.600000023841858, 0.20000000298023224, 19.379999394416814, 0.32000000953674324]
[6.199999809265137, 2.9000000953674316, 4.300000190734863, 1.2999999523162842, 17.980000038146954, 5.590000042915335]
[6.300000190734863, 2.299999952316284, 4.400000095367432, 1.2999999523162842, 14.490000138282767, 5.719999914169307]
[5.800000190734863, 2.700000047683716, 3.9000000953674316, 1.2000000476837158, 15.660000791549692, 4.680000300407414]
[6.0, 3.0, 4.800000190734863, 1.7999999523162842, 18.0, 8.640000114440909]
[5.599999904632568, 2.5, 3.9000000953674316, 1.100000023841858, 13.999999761581421, 4.290000197887423]
[4.800000190734863, 3.4000000953674316, 1.600000023841858, 0.20000000298023224, 16.320001106262225, 0.32000000953674324]
[6.900000095367432, 3.0999999046325684, 5.400000095367432, 2.0999999046325684, 21.38999963760375, 11.339999685287466]
[5.900000095367432, 3.200000047683716, 4.800000190734863, 1.7999999523162842, 18.88000058650971, 8.640000114440909]
[4.800000190734863, 3.0, 1.399999976158142, 0.10000000149011612, 14.40000057220459, 0.13999999970197674]
[5.099999904632568, 3.299999952316284, 1.7000000476837158, 0.5, 16.82999944210053, 0.8500000238418579]
[6.099999904632568, 2.799999952316284, 4.0, 1.2999999523162842, 17.07999944210053, 5.199999809265137]
[7.900000095367432, 3.799999952316284, 6.400000095367432, 2.0, 30.01999998569488, 12.800000190734863]
[6.0, 2.700000047683716, 5.099999904632568, 1.600000023841858, 16.200000286102295, 8.159999969005582]
[6.400000095367432, 2.799999952316284, 5.599999904632568, 2.200000047683716, 17.919999961853023, 12.320000057220454]
[6.599999904632568, 3.0, 4.400000095367432, 1.399999976158142, 19.799999713897705, 6.160000028610227]
...
</code></pre>
</div>
</div>
</div>
<p>The <code>groupBy</code> operation groups elements according to a classification
function, and returning the results in a <code>Map</code>. The classification
function maps elements to some key type <code>K</code>. The collector produces
a map whose keys are the values resulting from applying the classification
function to the input elements, and whose corresponding values are Lists
containing the input elements which map to the associated key under the
classification function.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_7" data-toggle="tab">Scala</a></li>
<li><a href="#java_7" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_7" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_7">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> iris.groupBy(row => row.getString("class"))
res23: Map[String, DataFrame] = Map(
"Iris-virginica" ->
+-----------+----------+-----------+----------+--------------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+--------------+
| 6.3| 3.3| 6| 2.5|Iris-virginica|
| 5.8| 2.7| 5.1| 1.9|Iris-virginica|
| 7.1| 3| 5.9| 2.1|Iris-virginica|
| 6.3| 2.9| 5.6| 1.8|Iris-virginica|
| 6.5| 3| 5.8| 2.2|Iris-virginica|
| 7.6| 3| 6.6| 2.1|Iris-virginica|
| 4.9| 2.5| 4.5| 1.7|Iris-virginica|
| 7.3| 2.9| 6.3| 1.8|Iris-virginica|
| 6.7| 2.5| 5.8| 1.8|Iris-virginica|
| 7.2| 3.6| 6.1| 2.5|Iris-virginica|
+-----------+----------+-----------+----------+--------------+
40 more rows...
,
"Iris-versicolor" ->
+-----------+----------+-----------+----------+---------------+
|sepallength|sepalwidth|petallength|petalwidth| class|
+-----------+----------+-----------+----------+---------------+
| 7| 3.2| 4.7| 1.4|Iris-versicolor|
| 6.4| 3.2| 4.5| 1.5|Iris-versicolor|
| 6.9| 3.1| 4.9| 1.5|Iris-versicolor|
...
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_7">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> iris.stream().collect(java.util.stream.Collectors.groupingBy(row -> row.getString("class")))
$24 ==> {Iris-versicolor=[{
sepallength: 7,
sepalwidth: 3.2,
petallength: 4.7,
petalwidth: 1.4,
class: Iris-versicolor
}, {
sepallength: 6.4,
sepalwidth: 3.2,
petallength: 4.5,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 6.9,
sepalwidth: 3.1,
petallength: 4.9,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 5.5,
sepalwidth: 2.3,
petallength: 4,
petalwidth: 1.3,
class: Iris-versicolor
}, {
sepallength: 6.5,
sepalwidth: 2.8,
petallength: 4.6,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 5.7,
sepalwidth: 2.8,
petallength: 4.5,
petalwidth: 1.3,
class: Iris-versicolor
}, ... class: Iris-setosa
}, {
sepallength: 4.6,
sepalwidth: 3.2,
petallength: 1.4,
petalwidth: 0.2,
class: Iris-setosa
}, {
sepallength: 5.3,
sepalwidth: 3.7,
petallength: 1.5,
petalwidth: 0.2,
class: Iris-setosa
}, {
sepallength: 5,
sepalwidth: 3.3,
petallength: 1.4,
petalwidth: 0.2,
class: Iris-setosa
}]}
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_7">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> iris.stream().collect(java.util.stream.Collectors.groupingBy({row: Tuple -> row.getString("class")}))
res98: kotlin.collections.(Mutable)Map<kotlin.String!, kotlin.collections.(Mutable)List<smile.data.Tuple!>!>! = {Iris-versicolor=[{
sepallength: 7,
sepalwidth: 3.2,
petallength: 4.7,
petalwidth: 1.4,
class: Iris-versicolor
}, {
sepallength: 6.4,
sepalwidth: 3.2,
petallength: 4.5,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 6.9,
sepalwidth: 3.1,
petallength: 4.9,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 5.5,
sepalwidth: 2.3,
petallength: 4,
petalwidth: 1.3,
class: Iris-versicolor
}, {
sepallength: 6.5,
sepalwidth: 2.8,
petallength: 4.6,
petalwidth: 1.5,
class: Iris-versicolor
}, {
sepallength: 5.7,
sepalwidth: 2.8,
petallength: 4.5,
petalwidth: 1.3,
class: Iris-versicolor
}, {
sepallength: 6.3,
sepalwidth: 3.3,
petallength: 4.7,
petalwidth: 1.6,
class: Iris-versicolor
}, {
sepallength: 4.9,
sepalwidth: 2.4,
petallength: 3.3,
petalwidth: 1,
class: Iris-versicolor
}, {
...
</code></pre>
</div>
</div>
</div>
<h2 id="sparse">Sparse Dataset</h2>
<p>The feature vectors could be very sparse. To save space, <a href="api/java/smile/data/SparseDataset.html">SparseDataset</a>
stores data in a list of lists (LIL) sparse matrix format. SparseDataset stores one list
per row, where each entry stores a column index and value. Typically, these entries
are kept sorted by column index for faster lookup.</p>
<p>SparseDataset is often used to construct the data matrix. Once the matrix is constructed,
it is typically converted to a format, such as <a href="api/java/smile/math/matrix/SparseMatrix.html">Harwell-Boeing</a>
column-compressed sparse matrix format, which is more efficient for matrix operations.</p>
<p>The class <a href="api/java/smile/data/BinarySparseDataset.html">BinarySparseDataset</a> is more efficient for
binary sparse data. In BinarySparseDataset, each item is stored as an integer array, which are
the indices of nonzero elements in ascending order.</p>
<h2 id="parser">Parsers</h2>
<p>Smile provides a couple of parsers for popular data formats, such as Parquet, Avro, Arrow, SAS7BDAT, Weka's ARFF files,
LibSVM's file format, delimited text files, JSON, and binary sparse data. We will demonstrate
these parsers with the sample data in the <code>data</code> directory. In Scala API, the
parsing functions are in the <code>smile.read</code> object.</p>
<h3 id="read.parquet">Apache Parquet</h3>
<p><a href="https://parquet.apache.org/">Apache Parquet</a>
is a columnar storage format that supports
nested data structures. It uses the record shredding and
assembly algorithm described in the Dremel paper.</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#scala_8" data-toggle="tab">Scala</a></li>
<li><a href="#java_8" data-toggle="tab">Java</a></li>
<li><a href="#kotlin_8" data-toggle="tab">Kotlin</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="scala_8">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-scala"><code>
smile> val df = read.parquet("data/kylo/userdata1.parquet")
df: DataFrame = [registration_dttm: DateTime, id: Integer, first_name: String, last_name: String, email: String, gender: String, ip_address: String, cc: String, country: String, birthdate: String, salary: Double, title: String, comments: String]
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
| registration_dttm| id|first_name|last_name| email|gender| ip_address| cc| country| birthdate| salary| title|comments|
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
|2016-02-03T07:55:29| 1| Amanda| Jordan| ajordan0@com.com|Female| 1.197.201.2|6759521864920116| Indonesia| 3/8/1971| 49756.53| Internal Auditor| 1E+02|
|2016-02-03T17:04:03| 2| Albert| Freeman| afreeman1@is.gd| Male|218.111.175.34| | Canada| 1/16/1968|150280.17| Accountant IV| |
|2016-02-03T01:09:31| 3| Evelyn| Morgan|emorgan2@altervis...|Female| 7.161.136.94|6767119071901597| Russia| 2/1/1960|144972.51| Structural Engineer| |
|2016-02-03T00:36:21| 4| Denise| Riley| driley3@gmpg.org|Female| 140.35.109.83|3576031598965625| China| 4/8/1997| 90263.05|Senior Cost Accou...| |
|2016-02-03T05:05:31| 5| Carlos| Burns|cburns4@miitbeian...| |169.113.235.40|5602256255204850| South Africa| | null| | |
|2016-02-03T07:22:34| 6| Kathryn| White| kwhite5@google.com|Female|195.131.81.179|3583136326049310| Indonesia| 2/25/1983| 69227.11| Account Executive| |
|2016-02-03T08:33:08| 7| Samuel| Holmes|sholmes6@foxnews.com| Male|232.234.81.197|3582641366974690| Portugal|12/18/1987| 14247.62|Senior Financial ...| |
|2016-02-03T06:47:06| 8| Harry| Howell| hhowell7@eepurl.com| Male| 91.235.51.73| |Bosnia and Herzeg...| 3/1/1962|186469.43| Web Developer IV| |
...
</code></pre>
</div>
</div>
<div class="tab-pane" id="java_8">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-java"><code>
jshell> var df = Read.parquet("data/kylo/userdata1.parquet")
df ==> [registration_dttm: DateTime, id: Integer, first_name: String, last_name: String, email: String, gender: String, ip_address: String, cc: String, country: String, birthdate: String, salary: Double, title: String, comments: String]
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
| registration_dttm| id|first_name|last_name| email|gender| ip_address| cc| country| birthdate| salary| title|comments|
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
|2016-02-03T07:55:29| 1| Amanda| Jordan| ajordan0@com.com|Female| 1.197.201.2|6759521864920116| Indonesia| 3/8/1971| 49756.53| Internal Auditor| 1E+02|
|2016-02-03T17:04:03| 2| Albert| Freeman| afreeman1@is.gd| Male|218.111.175.34| | Canada| 1/16/1968|150280.17| Accountant IV| |
|2016-02-03T01:09:31| 3| Evelyn| Morgan|emorgan2@altervis...|Female| 7.161.136.94|6767119071901597| Russia| 2/1/1960|144972.51| Structural Engineer| |
|2016-02-03T00:36:21| 4| Denise| Riley| driley3@gmpg.org|Female| 140.35.109.83|3576031598965625| China| 4/8/1997| 90263.05|Senior Cost Accou...| |
|2016-02-03T05:05:31| 5| Carlos| Burns|cburns4@miitbeian...| |169.113.235.40|5602256255204850| South Africa| | null| | |
|2016-02-03T07:22:34| 6| Kathryn| White| kwhite5@google.com|Female|195.131.81.179|3583136326049310| Indonesia| 2/25/1983| 69227.11| Account Executive| |
|2016-02-03T08:33:08| 7| Samuel| Holmes|sholmes6@foxnews.com| Male|232.234.81.197|3582641366974690| Portugal|12/18/1987| 14247.62|Senior Financial ...| |
|2016-02-03T06:47:06| 8| Harry| Howell| hhowell7@eepurl.com| Male| 91.235.51.73| |Bosnia and Herzeg...| 3/1/1962|186469.43| Web Developer IV| |
...
</code></pre>
</div>
</div>
<div class="tab-pane" id="kotlin_8">
<div class="code" style="text-align: left;">
<pre class="prettyprint lang-kotlin"><code>
>>> val df = read.parquet("data/kylo/userdata1.parquet")
>>> df
res100: smile.data.DataFrame = [registration_dttm: DateTime, id: Integer, first_name: String, last_name: String, email: String, gender: String, ip_address: String, cc: String, country: String, birthdate: String, salary: Double, title: String, comments: String]
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
| registration_dttm| id|first_name|last_name| email|gender| ip_address| cc| country| birthdate| salary| title|comments|
+-------------------+---+----------+---------+--------------------+------+--------------+----------------+--------------------+----------+---------+--------------------+--------+
|2016-02-03T07:55:29| 1| Amanda| Jordan| ajordan0@com.com|Female| 1.197.201.2|6759521864920116| Indonesia| 3/8/1971| 49756.53| Internal Auditor| 1E+02|
|2016-02-03T17:04:03| 2| Albert| Freeman| afreeman1@is.gd| Male|218.111.175.34| | Canada| 1/16/1968|150280.17| Accountant IV| |
|2016-02-03T01:09:31| 3| Evelyn| Morgan|emorgan2@altervis...|Female| 7.161.136.94|6767119071901597| Russia| 2/1/1960|144972.51| Structural Engineer| |
|2016-02-03T00:36:21| 4| Denise| Riley| driley3@gmpg.org|Female| 140.35.109.83|3576031598965625| China| 4/8/1997| 90263.05|Senior Cost Accou...| |
|2016-02-03T05:05:31| 5| Carlos| Burns|cburns4@miitbeian...| |169.113.235.40|5602256255204850| South Africa| | null| | |
|2016-02-03T07:22:34| 6| Kathryn| White| kwhite5@google.com|Female|195.131.81.179|3583136326049310| Indonesia| 2/25/1983| 69227.11| Account Executive| |
|2016-02-03T08:33:08| 7| Samuel| Holmes|sholmes6@foxnews.com| Male|232.234.81.197|3582641366974690| Portugal|12/18/1987| 14247.62|Senior Financial ...| |
|2016-02-03T06:47:06| 8| Harry| Howell| hhowell7@eepurl.com| Male| 91.235.51.73| |Bosnia and Herzeg...| 3/1/1962|186469.43| Web Developer IV| |
|2016-02-03T03:52:53| 9| Jose| Foster| jfoster8@yelp.com| Male| 132.31.53.61| | South Korea| 3/27/1992|231067.84|Software Test Eng...| 1E+02|