├── .gitignore ├── LICENSE ├── README.md ├── dataframe.go ├── dataframe_test.go ├── doc.go └── example ├── data ├── coil99-1.json ├── coil99-2.json └── coil99-3.json ├── dataset.yaml └── main.go /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files, Static and Dynamic libs (Shared Objects) 2 | *.o 3 | *.a 4 | *.so 5 | *.out 6 | *.test 7 | 8 | # Folders 9 | _obj 10 | _test 11 | tmp 12 | old 13 | 14 | *.cgo1.go 15 | *.cgo2.c 16 | _cgo_defun.c 17 | _cgo_gotypes.go 18 | _cgo_export.* 19 | 20 | _testmain.go 21 | 22 | *.exe 23 | *.bak 24 | *~ 25 | *.sublime-workspace 26 | 27 | darwin 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 AKUALAB INC. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of AKUALAB INC. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | dataframe 2 | ========= 3 | 4 | **This is an experimental package, please post feedback at the [gonum forum](https://groups.google.com/forum/#!forum/gonum-dev).** 5 | 6 | A package to manage R-like data frames written in Go. 7 | 8 | Installation 9 | 10 | $ go get github.com/akualab/dataframe 11 | 12 | Documentation: [godoc.org/github.com/akualab/dataframe](http://godoc.org/github.com/akualab/dataframe) 13 | 14 | For an example, visit the example sub-directory. 15 | -------------------------------------------------------------------------------- /dataframe.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 AKUALAB INC. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package dataframe 7 | 8 | import ( 9 | "encoding/json" 10 | "fmt" 11 | "io" 12 | "io/ioutil" 13 | "os" 14 | "reflect" 15 | 16 | "github.com/golang/glog" 17 | "launchpad.net/goyaml" 18 | ) 19 | 20 | const ( 21 | BUFFER_SIZE = 1000 22 | ) 23 | 24 | // A list of dataframe files. Each file must have the same dataframe schema. 25 | type DataSet struct { 26 | Path string `yaml:"path"` 27 | Files []string `yaml:"files"` 28 | index int 29 | } 30 | 31 | // A DataFrame is a table where columns are variables and rows are measurements. 32 | // Each row contains an instance. Each variable can have a different type. 33 | type DataFrame struct { 34 | 35 | // Describes the data. 36 | Description string `json:"description"` 37 | 38 | // Identifies the batch or data. For example: a session, a file, etc. 39 | BatchID string `json:"batchid"` 40 | 41 | // Ordered list of variable names. 42 | VarNames []string `json:"var_names"` 43 | 44 | // Ordered list of variables. 45 | Data [][]interface{} `json:"data"` 46 | 47 | // Can be used to store custom properties related to the data frame. 48 | Properties map[string]string `json:"properties"` 49 | 50 | // maps var name to var index for faster access. 51 | varMap map[string]int 52 | } 53 | 54 | // Reads a list of filenames from a file. See ReadDataSetReader() 55 | func ReadDataSetFile(fn string) (ds *DataSet, e error) { 56 | 57 | f, e := os.Open(fn) 58 | if e != nil { 59 | return 60 | } 61 | ds, e = ReadDataSet(f) 62 | return 63 | } 64 | 65 | // Reads a list of filenames from an io.Reader. 66 | func ReadDataSet(r io.Reader) (ds *DataSet, e error) { 67 | 68 | var b []byte 69 | b, e = ioutil.ReadAll(r) 70 | if e != nil { 71 | return 72 | } 73 | e = goyaml.Unmarshal(b, &ds) 74 | if e != nil { 75 | return 76 | } 77 | 78 | return 79 | } 80 | 81 | // Go back to the beginning of the data set. 82 | func (ds *DataSet) Reset() { 83 | ds.index = 0 84 | } 85 | 86 | // Reads attributes from the next file in the data set. 87 | // The error returns io.EOF when no more files are available. 88 | func (ds *DataSet) Next() (df *DataFrame, e error) { 89 | 90 | if ds.index == len(ds.Files) { 91 | ds.index = 0 92 | return nil, io.EOF 93 | } 94 | sep := string(os.PathSeparator) 95 | glog.V(2).Infof("feature file: %s", ds.Path+sep+ds.Files[ds.index]) 96 | df, e = ReadDataFrameFile(ds.Path + sep + ds.Files[ds.index]) 97 | if e != nil { 98 | return 99 | } 100 | ds.index++ 101 | return 102 | } 103 | 104 | // Reads feature from file. 105 | func ReadDataFrameFile(fn string) (df *DataFrame, e error) { 106 | 107 | f, e := os.Open(fn) 108 | if e != nil { 109 | return 110 | } 111 | return ReadDataFrame(f) 112 | } 113 | 114 | // Reads features from io.Reader. 115 | func ReadDataFrame(r io.Reader) (df *DataFrame, e error) { 116 | 117 | var b []byte 118 | b, e = ioutil.ReadAll(r) 119 | if e != nil { 120 | return 121 | } 122 | df = &DataFrame{} 123 | e = json.Unmarshal(b, df) 124 | if e != nil { 125 | return nil, e 126 | } 127 | 128 | m := make(map[string]int) 129 | for k, v := range df.VarNames { 130 | m[v] = k 131 | } 132 | df.varMap = m 133 | return 134 | } 135 | 136 | // Joins float64 and []float64 variables and returns them as a []float64. 137 | func (df *DataFrame) Float64Slice(frame int, names ...string) (floats []float64, err error) { 138 | 139 | if len(names) == 0 { 140 | return nil, fmt.Errorf("No variable names were specified, must provide at least one var name.") 141 | } 142 | 143 | floats = make([]float64, 0) 144 | 145 | var indices []int 146 | indices, err = df.indices(names...) 147 | if err != nil { 148 | return 149 | } 150 | for _, v := range indices { 151 | value := df.Data[frame][v] 152 | switch i := value.(type) { 153 | case nil: 154 | return nil, fmt.Errorf("variable for index %d is nil.", v) 155 | case float64: 156 | floats = append(floats, i) 157 | case []interface{}: 158 | for _, v := range i { 159 | floats = append(floats, v.(float64)) 160 | } 161 | default: 162 | return nil, fmt.Errorf("In frame %d, Vector of type %s in not supported.", 163 | frame, reflect.TypeOf(i).String()) 164 | } 165 | } 166 | return 167 | } 168 | 169 | // Joins float64 and []float64 variables. Returns a channel of []float64 frames. 170 | func (df *DataFrame) Float64SliceChannel(names ...string) (ch chan []float64) { 171 | 172 | ch = make(chan []float64, BUFFER_SIZE) 173 | go func() { 174 | // Iterate through all the rows. 175 | for i := 0; i < df.N(); i++ { 176 | sl, err := df.Float64Slice(i, names...) 177 | if err != nil { 178 | glog.Fatalf("Reading float64 vector failed: %s", err) 179 | } 180 | ch <- sl 181 | } 182 | close(ch) 183 | }() 184 | 185 | return 186 | } 187 | 188 | // Returns value of a string variable. 189 | func (df *DataFrame) String(frame int, name string) (value string, err error) { 190 | 191 | var indices []int 192 | indices, err = df.indices(name) 193 | if err != nil { 194 | return 195 | } 196 | if len(indices) == 0 { 197 | err = fmt.Errorf("Failed to find a variable with name: [%s]", name) 198 | return 199 | } 200 | 201 | var ok bool 202 | v := df.Data[frame][indices[0]] 203 | value, ok = v.(string) 204 | if ok { 205 | return 206 | } 207 | 208 | err = fmt.Errorf("In frame %d, variable [%d] is of type [%s]. Must be of type string.", 209 | frame, name, reflect.TypeOf(v).String()) 210 | return 211 | } 212 | 213 | // Resets data set and starts reading data. Returns a channel to be used to 214 | // get all the frames. 215 | func (ds *DataSet) Float64SliceChannel(names ...string) (ch chan []float64) { 216 | 217 | ch = make(chan []float64, BUFFER_SIZE) 218 | go func() { 219 | for { 220 | // Get a data frame. 221 | df, e := ds.Next() 222 | if e == io.EOF { 223 | close(ch) 224 | break 225 | } 226 | if e != nil { 227 | glog.Fatalf("Getting data frame failed: %s", e) 228 | } 229 | 230 | // Iterate through all the rows. 231 | for i := 0; i < len(df.Data); i++ { 232 | sl, err := df.Float64Slice(i, names...) 233 | if err != nil { 234 | glog.Fatalf("Reading float64 vector failed: %s", err) 235 | } 236 | ch <- sl 237 | } 238 | } 239 | }() 240 | 241 | return 242 | } 243 | 244 | // Returns number of data instances (rows) in data frame. 245 | func (df *DataFrame) N() int { 246 | 247 | return len(df.Data) 248 | } 249 | 250 | // Returns number of variables (columns) in data frame. 251 | func (df *DataFrame) NumVariables() int { 252 | 253 | return len(df.Data[0]) 254 | } 255 | 256 | // Returns the indices for the variable names. 257 | func (df *DataFrame) indices(names ...string) (indices []int, err error) { 258 | 259 | indices = make([]int, 0) 260 | var idx int 261 | var ok bool 262 | for _, v := range names { 263 | if idx, ok = df.varMap[v]; !ok { 264 | err = fmt.Errorf("There is no variable [%s] in the data frame.") 265 | return 266 | } 267 | indices = append(indices, idx) 268 | } 269 | return 270 | } 271 | -------------------------------------------------------------------------------- /dataframe_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 AKUALAB INC. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | package dataframe 7 | 8 | import ( 9 | "io" 10 | "io/ioutil" 11 | "os" 12 | "testing" 13 | 14 | "github.com/gonum/floats" 15 | ) 16 | 17 | func getTempDir() string { 18 | 19 | // Prepare dirs. 20 | tempDir := os.TempDir() 21 | os.MkdirAll(tempDir+"data", 0755) 22 | return tempDir 23 | } 24 | 25 | func createFileList(t *testing.T, tmpDir string) string { 26 | 27 | // Create file list yaml file. 28 | fn := tmpDir + "filelist.yaml" 29 | t.Logf("File List: %s.", fn) 30 | err := ioutil.WriteFile(fn, []byte(filelistData), 0644) 31 | CheckError(t, err) 32 | return fn 33 | } 34 | 35 | func createDataFiles(t *testing.T, tmpDir string) (f1, f2 string) { 36 | 37 | // Create data file 1. 38 | f1 = tmpDir + "data" + string(os.PathSeparator) + "file1.json" 39 | t.Logf("Data File 1: %s.", f1) 40 | e := ioutil.WriteFile(f1, []byte(file1), 0644) 41 | CheckError(t, e) 42 | 43 | // Create data file 2. 44 | f2 = tmpDir + "data" + string(os.PathSeparator) + "file2.json" 45 | t.Logf("Data File 2: %s.", f2) 46 | e = ioutil.WriteFile(f2, []byte(file2), 0644) 47 | CheckError(t, e) 48 | 49 | return f1, f2 50 | } 51 | 52 | func TestDataSet(t *testing.T) { 53 | 54 | tmpDir := getTempDir() 55 | fn := createFileList(t, tmpDir) 56 | 57 | // Read file list. 58 | ds, e := ReadDataSetFile(fn) 59 | CheckError(t, e) 60 | 61 | // Check DataSet content. 62 | t.Logf("DataSet: %+v", ds) 63 | 64 | if ds.Path != "data" { 65 | t.Fatalf("Path is [%s]. Expected \"data\".", ds.Path) 66 | } 67 | if ds.Files[0] != "file1.json" { 68 | t.Fatalf("Files[0] is [%s]. Expected \"file1\".", ds.Files[0]) 69 | } 70 | if ds.Files[1] != "file2.json" { 71 | t.Fatalf("Files[1] is [%s]. Expected \"file2\".", ds.Files[1]) 72 | } 73 | 74 | os.Chdir(tmpDir) 75 | //var n int 76 | for { 77 | features, e := ds.Next() 78 | if e == io.EOF { 79 | break 80 | } 81 | CheckError(t, e) 82 | t.Logf("data: \n%+v\n", features) 83 | } 84 | } 85 | 86 | func TestDimensions(t *testing.T) { 87 | 88 | tmpDir := getTempDir() 89 | f1, _ := createDataFiles(t, tmpDir) 90 | 91 | // Get a vector for a frame id in a data frame. 92 | df, dfe := ReadDataFrameFile(f1) 93 | CheckError(t, dfe) 94 | 95 | if df.N() != 6 { 96 | t.Fatalf("N must be 6, not %d.", df.N()) 97 | } 98 | 99 | if df.NumVariables() != 3 { 100 | t.Fatalf("NumVariables must be 3, not %d.", df.NumVariables()) 101 | } 102 | 103 | } 104 | 105 | func TestNext(t *testing.T) { 106 | 107 | tmpDir := getTempDir() 108 | f1, _ := createDataFiles(t, tmpDir) 109 | 110 | // Get a vector for a frame id in a data frame. 111 | df, dfe := ReadDataFrameFile(f1) 112 | CheckError(t, dfe) 113 | sl, sle := df.Float64Slice(1, "wifi", "acceleration") 114 | CheckError(t, sle) 115 | t.Logf("float slice for frame 1: %+v", sl) 116 | 117 | if !floats.Equal(sl, []float64{-41.8, -41.1, 1.4}) { 118 | t.Fatalf("vector %v doesn't match.", sl) 119 | } 120 | 121 | } 122 | 123 | func TestDataFrameChan(t *testing.T) { 124 | 125 | tmpDir := getTempDir() 126 | f1, _ := createDataFiles(t, tmpDir) 127 | 128 | df, dfe := ReadDataFrameFile(f1) 129 | CheckError(t, dfe) 130 | 131 | sl, sle := df.Float64Slice(1, "wifi", "acceleration") 132 | CheckError(t, sle) 133 | t.Logf("float slice for frame 1: %+v", sl) 134 | 135 | if !floats.Equal(sl, []float64{-41.8, -41.1, 1.4}) { 136 | t.Fatalf("vector %v doesn't match.", sl) 137 | } 138 | 139 | ch := df.Float64SliceChannel("wifi", "acceleration") 140 | 141 | var count int 142 | for v := range ch { 143 | t.Logf("k: %d, v: %+v", count, v) 144 | 145 | // Compare slice. 146 | sl, sle := df.Float64Slice(count, "wifi", "acceleration") 147 | CheckError(t, sle) 148 | 149 | if !floats.Equal(sl, v) { 150 | t.Fatalf("Mismatch in row %d: chan is %v, slice is %v.", count, v, sl) 151 | } 152 | count++ 153 | } 154 | } 155 | 156 | func CheckError(t *testing.T, e error) { 157 | 158 | if e != nil { 159 | t.Fatal(e) 160 | } 161 | } 162 | 163 | const filelistData string = ` 164 | path: data 165 | files: 166 | - file1.json 167 | - file2.json 168 | ` 169 | const file1 string = `{ 170 | "description": "An indoor positioning data set.", 171 | "batchid": "24001-015", 172 | "var_names": ["room", "wifi", "acceleration"], 173 | "data": [ 174 | ["BED5",[-40.8,-41.2],1.3], 175 | ["BED5",[-41.8,-41.1],1.4], 176 | ["BED5",[-42.8,-40.34],1.5], 177 | ["DINING",[-42.9,-40.11],1.6], 178 | ["DINING",[-42.764,-39.98],1.7], 179 | ["DINING",[-42.209,-39.6],1.8] 180 | ] 181 | } 182 | ` 183 | const file2 string = `{ 184 | "description": "An indoor positioning data set.", 185 | "batchid": "24001-016", 186 | "var_names": ["room", "wifi", "acceleration"], 187 | "data": [ 188 | ["KITCHEN",[-20.1,-31.3],1.3], 189 | ["KITCHEN",[-21.8,-31.1],1.4], 190 | ["KITCHEN",[-22.8,-30.21],1.5], 191 | ["DINING",[-22.9,-30.99],1.6], 192 | ["DINING",[-22.22,-29.76],1.7], 193 | ["DINING",[-22.345,-29.6],1.8] 194 | ] 195 | } 196 | ` 197 | -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 AKUALAB INC. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | /* 7 | A package to manage R-like data frames. 8 | 9 | DataFrame 10 | 11 | A DataFrame is a table where columns are variables and rows are measurements. 12 | For example: 13 | 14 | row room wifi acceleration 15 | 0 KITCHEN [-56.1, -78.9, -44.12] 1.3 16 | 1 BATH [-58, -71.1, -39.8] 1.8 17 | ... 18 | 19 | Each column correspond to a variable. Each variable can have a different type. In this case, 20 | room is a string, wifi is an array of numbers, and acceleration is a number. In JSON: 21 | 22 | { 23 | "description": "An indoor positioning data set.", 24 | "batchid": "24001-015", 25 | "var_names": ["room", "wifi", "acceleration"], 26 | "properties": {"url": "http://akualab.com", "status": "experimental"}, 27 | "data": [ 28 | ["KITCHEN", [-56.1, -78.9, -44.12], 1.3], 29 | ["BATH" , [-58, -71.1, -39.8], 1.8] 30 | ] 31 | } 32 | 33 | DataSet 34 | 35 | A DataSet is a collection of DataFrame files. All files must have the same schema. 36 | The API provides methods to iterate over the DataSet which hides teh details about files from 37 | the end user. 38 | */ 39 | package dataframe 40 | -------------------------------------------------------------------------------- /example/data/coil99-1.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "COIL 1999 Competition Data.", 3 | "batchid": "analysis_1", 4 | "var_names": ["season", "river_size", "fluid_velocity", "chemical_concentrations", "algae"], 5 | "var_types": ["string", "string", "string", "[]float64", "[]float64"], 6 | "properties": {"url": "http://archive.ics.uci.edu/ml/machine-learning-databases/coil-mld/coil.data.html"}, 7 | "data": [ 8 | ["winter","small_","medium",[8.00000,9.80000,60.80000,6.23800,578.00000,105.00000,170.00000,50.00000],[0.00000,0.00000,0.00000,0.00000,34.20000,8.30000,0.00000]], 9 | ["spring","small_","medium",[8.35000,8.00000,57.75000,1.28800,370.00000,428.75000,558.75000,1.30000],[1.40000,7.60000,4.80000,1.90000,6.70000,0.00000,2.10000]], 10 | ["autumn","small_","medium",[8.10000,11.40000,40.02000,5.33000,346.66699,125.66700,187.05701,15.60000],[3.30000,53.60000,1.90000,0.00000,0.00000,0.00000,9.70000]], 11 | ["spring","small_","medium",[8.07000,4.80000,77.36400,2.30200,98.18200,61.18200,138.70000,1.40000],[3.10000,41.00000,18.90000,0.00000,1.40000,0.00000,1.40000]], 12 | ["autumn","small_","medium",[8.06000,9.00000,55.35000,10.41600,233.70000,58.22200,97.58000,10.50000],[9.20000,2.90000,7.50000,0.00000,7.50000,4.10000,1.00000]], 13 | ["winter","small_","high__",[8.25000,13.10000,65.75000,9.24800,430.00000,18.25000,56.66700,28.40000],[15.10000,14.60000,1.40000,0.00000,22.50000,12.60000,2.90000]], 14 | ["summer","small_","high__",[8.15000,10.30000,73.25000,1.53500,110.00000,61.25000,111.75000,3.20000],[2.40000,1.20000,3.20000,3.90000,5.80000,6.80000,0.00000]], 15 | ["autumn","small_","high__",[8.05000,10.60000,59.06700,4.99000,205.66701,44.66700,77.43400,6.90000],[18.20000,1.60000,0.00000,0.00000,5.50000,8.70000,0.00000]], 16 | ["winter","small_","medium",[8.70000,3.40000,21.95000,0.88600,102.75000,36.30000,71.00000,5.54400],[25.40000,5.40000,2.50000,0.00000,0.00000,0.00000,0.00000]], 17 | ["winter","small_","high__",[7.93000,9.90000,8.00000,1.39000,5.80000,27.25000,46.60000,0.80000],[17.00000,0.00000,0.00000,2.90000,0.00000,0.00000,1.70000]], 18 | ["spring","small_","high__",[7.70000,10.20000,8.00000,1.52700,21.57100,12.75000,20.75000,0.80000],[16.60000,0.00000,0.00000,0.00000,1.20000,0.00000,6.00000]], 19 | ["summer","small_","high__",[7.45000,11.70000,8.69000,1.58800,18.42900,10.66700,19.00000,0.60000],[32.10000,0.00000,0.00000,0.00000,0.00000,0.00000,1.50000]], 20 | ["winter","small_","high__",[7.74000,9.60000,5.00000,1.22300,27.28600,12.00000,17.00000,41.00000],[43.50000,0.00000,2.10000,0.00000,1.20000,0.00000,2.10000]], 21 | ["summer","small_","high__",[7.72000,11.80000,6.30000,1.47000,8.00000,16.00000,15.00000,0.50000],[31.10000,1.00000,3.40000,0.00000,1.90000,0.00000,4.10000]], 22 | ["winter","small_","high__",[7.90000,9.60000,3.00000,1.44800,46.20000,13.00000,61.60000,0.30000],[52.20000,5.00000,7.80000,0.00000,4.00000,0.00000,0.00000]], 23 | ["autumn","small_","high__",[7.55000,11.50000,4.70000,1.32000,14.75000,4.25000,98.25000,1.10000],[69.90000,0.00000,1.70000,0.00000,0.00000,0.00000,0.00000]], 24 | ["winter","small_","high__",[7.78000,12.00000,7.00000,1.42000,34.33300,18.66700,50.00000,1.10000],[46.20000,0.00000,0.00000,1.20000,0.00000,0.00000,0.00000]], 25 | ["spring","small_","high__",[7.61000,9.80000,7.00000,1.44300,31.33300,20.00000,57.83300,0.40000],[31.80000,0.00000,3.10000,4.80000,7.70000,1.40000,7.20000]], 26 | ["summer","small_","high__",[7.35000,10.40000,7.00000,1.71800,49.00000,41.50000,61.50000,0.80000],[50.60000,0.00000,9.90000,4.30000,3.60000,8.20000,2.20000]], 27 | ["spring","small_","high__",[7.20000,9.20000,0.80000,0.64200,81.00000,15.60000,18.00000,0.50000],[15.50000,0.00000,0.00000,2.30000,0.00000,0.00000,0.00000]], 28 | ["autumn","small_","high__",[7.75000,10.30000,32.92000,2.94200,42.00000,16.00000,40.00000,7.60000],[23.20000,0.00000,0.00000,0.00000,27.60000,11.10000,0.00000]], 29 | ["winter","small_","high__",[7.62000,8.50000,11.86700,1.71500,208.33299,3.00000,27.50000,1.70000],[74.20000,0.00000,0.00000,3.70000,0.00000,0.00000,0.00000]], 30 | ["spring","small_","high__",[7.84000,9.40000,10.97500,1.51000,12.50000,3.00000,11.50000,1.50000],[13.00000,8.60000,1.20000,3.50000,1.20000,1.60000,1.90000]], 31 | ["summer","small_","high__",[7.77000,10.70000,12.53600,3.97600,58.50000,9.00000,44.13600,3.00000],[4.10000,0.00000,0.00000,0.00000,9.20000,10.10000,0.00000]], 32 | ["winter","small_","high__",[7.09000,8.40000,10.50000,1.57200,28.00000,4.00000,13.60000,0.50000],[29.70000,0.00000,0.00000,4.90000,0.00000,0.00000,0.00000]], 33 | ["winter","small_","high__",[8.00000,9.80000,16.00000,0.73000,20.00000,26.00000,45.00000,0.80000],[17.10000,0.00000,19.60000,0.00000,0.00000,0.00000,2.50000]], 34 | ["spring","small_","high__",[7.20000,11.30000,9.00000,0.23000,120.00000,12.00000,19.00000,0.50000],[33.90000,1.00000,14.60000,0.00000,0.00000,0.00000,0.00000]], 35 | ["autumn","small_","high__",[7.40000,12.50000,13.00000,3.33000,60.00000,72.00000,142.00000,4.90000],[3.40000,16.00000,1.20000,0.00000,15.30000,15.80000,0.00000]], 36 | ["winter","small_","high__",[8.10000,10.30000,26.00000,3.78000,60.00000,246.00000,304.00000,2.80000],[6.90000,17.10000,20.20000,0.00000,4.00000,0.00000,2.90000]], 37 | ["winter","small_","high__",[8.30000,10.90000,1.17000,0.73500,13.50000,1.62500,3.00000,0.20000],[66.00000,0.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 38 | ["winter","small_","medium",[8.30000,8.90000,20.62500,3.41400,228.75000,196.62000,253.25000,12.32000],[2.00000,38.50000,4.10000,2.20000,0.00000,0.00000,10.20000]], 39 | ["spring","small_","medium",[8.10000,10.50000,22.28600,4.07100,178.57001,182.42000,255.28000,8.95700],[2.20000,2.70000,1.00000,3.70000,2.70000,0.00000,0.00000]], 40 | ["winter","small_","medium",[8.00000,5.50000,77.00000,6.09600,122.85000,143.71001,296.00000,3.70000],[0.00000,5.90000,10.60000,1.70000,0.00000,0.00000,7.10000]], 41 | ["summer","small_","medium",[8.15000,7.10000,54.19000,3.82900,647.57001,59.42900,175.04601,13.20000],[0.00000,0.00000,0.00000,5.70000,11.30000,17.00000,1.60000]], 42 | ["winter","small_","high__",[8.30000,7.70000,50.00000,8.54300,76.00000,264.89999,344.60001,22.50000],[0.00000,40.90000,7.50000,0.00000,2.40000,1.50000,0.00000]], 43 | ["spring","small_","high__",[8.30000,8.80000,54.14300,7.83000,51.42900,276.85001,326.85699,11.84000],[4.10000,3.10000,0.00000,0.00000,19.70000,17.00000,0.00000]], 44 | ["winter","small_","high__",[8.40000,13.40000,69.75000,4.55500,37.50000,10.00000,40.66700,3.90000],[51.80000,4.10000,0.00000,0.00000,3.10000,5.50000,0.00000]], 45 | ["spring","small_","high__",[8.30000,12.50000,87.00000,4.87000,22.50000,27.00000,43.50000,3.30000],[29.50000,1.00000,2.70000,3.20000,2.90000,9.60000,0.00000]], 46 | ["autumn","small_","high__",[8.00000,12.10000,66.30000,4.53500,39.00000,16.00000,39.00000,0.80000],[54.40000,3.40000,1.20000,0.00000,18.70000,2.00000,0.00000]], 47 | ["spring","small_","medium",[7.60000,9.60000,15.00000,3.02000,40.00000,27.00000,121.00000,2.80000],[89.80000,0.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 48 | ["autumn","small_","medium",[7.29000,11.21000,17.75000,3.07000,35.00000,13.00000,20.81200,12.10000],[24.80000,7.40000,0.00000,2.50000,10.60000,17.10000,3.20000]], 49 | ["winter","small_","medium",[7.60000,10.20000,32.30000,4.50800,192.50000,12.75000,49.33300,7.90000],[0.00000,0.00000,0.00000,4.60000,1.20000,0.00000,3.90000]], 50 | ["summer","small_","medium",[8.00000,7.90000,27.23300,1.65100,28.33300,7.30000,22.90000,4.50000],[39.10000,0.00000,1.20000,2.20000,5.40000,1.50000,3.20000]], 51 | ["winter","small_","high__",[7.90000,11.00000,6.16700,1.17200,18.33300,7.75000,11.80000,0.50000],[81.90000,0.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 52 | ["spring","small_","high__",[7.90000,9.00000,5.27300,0.91000,33.63600,9.00000,11.81800,0.80000],[54.00000,0.00000,0.00000,2.40000,0.00000,0.00000,0.00000]], 53 | ["spring","small_","high__",[7.57000,10.80000,4.57500,1.20300,27.50000,2.00000,6.75000,1.00000],[20.30000,4.30000,5.50000,0.00000,0.00000,0.00000,1.40000]], 54 | ["summer","small_","high__",[7.19000,11.70000,4.32600,1.47400,160.00000,2.50000,7.20000,0.30000],[15.80000,1.70000,7.80000,0.00000,0.00000,2.40000,1.40000]], 55 | ["winter","small_","high__",[7.44000,10.10000,2.93300,0.77000,15.00000,1.33300,6.00000,0.60000],[55.50000,0.00000,1.70000,1.40000,0.00000,0.00000,0.00000]], 56 | ["spring","small_","high__",[7.14000,9.80000,3.27500,0.92300,15.00000,1.25000,10.75000,2.50000],[10.30000,0.00000,42.80000,2.20000,0.00000,0.00000,0.00000]], 57 | ["summer","small_","high__",[7.00000,12.10000,3.13600,1.20800,16.20000,1.80000,2.50000,0.50000],[64.20000,0.00000,3.00000,0.00000,0.00000,0.00000,0.00000]], 58 | ["autumn","medium","medium",[8.50000,8.10000,38.12500,3.85000,225.00000,45.00000,152.33299,5.20000],[11.30000,1.70000,2.00000,2.20000,13.30000,10.60000,0.00000]], 59 | ["summer","medium","medium",[7.92500,10.20000,34.03700,9.08000,109.00000,55.00000,58.62300,11.60000],[4.40000,4.00000,3.30000,0.00000,11.70000,21.40000,1.20000]], 60 | ["winter","medium","medium",[8.10000,8.10000,136.00000,3.77300,245.00000,136.75000,249.25000,20.87000],[1.90000,5.80000,24.80000,4.60000,9.50000,5.10000,1.20000]], 61 | ["spring","medium","medium",[8.20000,6.80000,129.37500,3.31600,271.25000,100.00000,233.50000,13.00000],[1.60000,8.00000,17.60000,3.70000,11.50000,7.00000,0.00000]], 62 | ["spring","medium","high__",[9.10000,9.40000,35.75000,5.16400,32.50000,85.50000,215.50000,18.37000],[2.20000,9.60000,5.00000,1.00000,8.60000,7.90000,2.20000]], 63 | ["autumn","medium","medium",[8.10000,9.80000,29.50000,1.28700,224.28600,25.16700,102.33300,3.60000],[64.90000,1.00000,0.00000,1.00000,2.90000,1.40000,1.00000]], 64 | ["winter","medium","medium",[8.00000,5.90000,27.40000,0.73500,133.63600,36.00000,105.72700,3.00000],[15.10000,7.30000,23.20000,3.40000,4.10000,0.00000,0.00000]], 65 | ["spring","medium","medium",[8.00000,3.30000,26.76000,0.65800,165.00000,37.37500,111.37500,3.00000],[14.40000,0.00000,11.80000,11.30000,5.50000,0.00000,0.00000]] 66 | ] 67 | } 68 | -------------------------------------------------------------------------------- /example/data/coil99-2.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "COIL 1999 Competition Data.", 3 | "batchid": "analysis_2", 4 | "var_names": ["season", "river_size", "fluid_velocity", "chemical_concentrations", "algae"], 5 | "var_types": ["string", "string", "string", "[]float64", "[]float64"], 6 | "properties": {"url": "http://archive.ics.uci.edu/ml/machine-learning-databases/coil-mld/coil.data.html"}, 7 | "data": [ 8 | ["winter","medium","high__",[7.50000,9.20000,11.00000,3.31000,101.00000,26.60000,108.00000,1.30000],[6.70000,0.00000,5.40000,3.40000,4.90000,6.90000,10.80000]], 9 | ["spring","medium","high__",[7.40000,9.80000,11.00000,3.23500,255.00000,38.75000,56.66700,2.00000],[10.80000,0.00000,0.00000,4.60000,6.50000,2.20000,1.40000]], 10 | ["autumn","medium","high__",[7.30000,11.70000,10.40000,4.93000,130.00000,10.80000,60.00000,4.30000],[1.20000,0.00000,1.70000,0.00000,7.50000,17.70000,14.40000]], 11 | ["winter","medium","high__",[7.40000,8.90000,13.50000,5.44200,123.33300,27.66700,104.00000,21.00000],[12.60000,4.30000,21.90000,1.00000,2.40000,3.30000,22.10000]], 12 | ["summer","medium","high__",[7.40000,11.17000,12.14600,6.18800,89.60000,32.00000,69.93000,3.10000],[14.70000,4.10000,1.00000,0.00000,7.70000,8.50000,31.20000]], 13 | ["autumn","medium","medium",[7.50000,10.80000,31.00000,4.40800,737.50000,111.25000,214.00000,2.90000],[3.30000,0.00000,0.00000,5.00000,1.90000,6.20000,25.60000]], 14 | ["winter","medium","medium",[7.60000,6.00000,53.00000,3.73400,914.00000,137.60001,254.60001,4.30000],[0.00000,0.00000,0.00000,4.60000,9.00000,13.10000,30.10000]], 15 | ["summer","medium","medium",[7.40000,10.77000,36.24800,3.73000,429.20001,57.60000,169.00101,3.20000],[2.80000,0.00000,0.00000,2.60000,5.20000,13.20000,16.70000]], 16 | ["winter","medium","medium",[8.50000,8.60000,125.60000,3.77800,124.16700,197.83299,303.33301,40.00000],[0.00000,15.20000,8.80000,0.00000,8.60000,5.10000,2.70000]], 17 | ["spring","medium","medium",[8.70000,9.40000,173.75000,3.31800,101.25000,267.75000,391.75000,3.50000],[0.00000,5.50000,3.30000,0.00000,20.80000,12.40000,0.00000]], 18 | ["summer","medium","medium",[8.10000,10.70000,94.40500,4.69800,153.00000,191.75000,265.25000,7.30000],[0.00000,2.10000,1.60000,0.00000,20.80000,32.90000,0.00000]], 19 | ["winter","medium","high__",[8.80000,8.50000,53.33300,5.13200,96.66700,120.50000,232.83299,31.00000],[1.20000,5.60000,6.30000,1.70000,1.20000,0.00000,1.00000]], 20 | ["spring","medium","high__",[7.80000,10.50000,70.00000,2.44300,98.33300,144.66701,244.00000,9.00000],[0.00000,3.10000,3.50000,1.60000,8.20000,9.90000,0.00000]], 21 | ["summer","medium","high__",[7.90000,11.80000,63.51000,4.94000,137.00000,159.50000,218.00000,6.50000],[0.00000,5.20000,0.00000,0.00000,28.80000,20.40000,1.00000]], 22 | ["autumn","medium","low___",[8.50000,10.50000,56.71700,0.33000,215.71400,23.00000,138.50000,20.82900],[5.70000,0.00000,0.00000,4.40000,12.40000,8.30000,7.80000]], 23 | ["winter","medium","low___",[9.10000,5.40000,61.05000,0.30800,105.55600,104.22200,239.00000,72.47800],[3.60000,31.90000,2.40000,0.00000,0.00000,0.00000,2.20000]], 24 | ["spring","medium","low___",[8.90000,4.50000,57.75000,0.26700,155.00000,97.33300,235.66701,98.81700],[1.20000,16.20000,0.00000,0.00000,0.00000,0.00000,1.00000]], 25 | ["winter","medium","high__",[7.90000,6.30000,101.87500,3.97800,153.75000,51.75000,205.87500,2.00000],[4.00000,2.10000,35.10000,6.80000,7.30000,0.00000,0.00000]], 26 | ["summer","medium","high__",[7.80000,8.20000,85.98200,6.20000,421.66699,31.33300,211.66701,21.90000],[5.90000,3.40000,1.00000,1.20000,17.80000,49.40000,1.00000]], 27 | ["winter","medium","medium",[7.70000,7.10000,63.62500,3.14000,122.50000,28.62500,186.50000,30.00000],[16.50000,2.10000,19.50000,3.50000,5.30000,1.20000,3.20000]], 28 | ["spring","medium","medium",[7.80000,6.50000,82.11100,2.60300,215.55600,12.88900,154.12500,5.20000],[7.00000,0.00000,13.50000,4.30000,8.70000,0.00000,4.30000]], 29 | ["winter","medium","low___",[7.70000,5.30000,65.33300,2.89900,371.11099,51.11100,183.66701,17.20000],[58.70000,0.00000,11.50000,6.60000,0.00000,0.00000,0.00000]], 30 | ["summer","medium","low___",[7.50000,8.80000,58.33100,8.68800,758.75000,104.50000,292.62500,3.00000],[8.70000,0.00000,3.00000,5.30000,9.40000,33.20000,0.00000]], 31 | ["autumn","medium","low___",[7.60000,10.00000,49.62500,5.45600,308.75000,38.62500,285.71399,75.00000],[17.00000,21.60000,1.60000,1.40000,10.20000,3.60000,1.10000]], 32 | ["winter","medium","low___",[8.70000,7.40000,47.77800,2.31600,38.11100,24.66700,201.77800,3.00000],[12.30000,5.40000,1.90000,0.00000,1.40000,0.00000,1.90000]], 33 | ["summer","medium","low___",[7.70000,11.10000,47.22900,8.75900,239.00000,54.00000,275.14301,65.70000],[8.80000,19.60000,4.70000,0.00000,0.00000,0.00000,2.70000]], 34 | ["autumn","medium","high__",[8.30000,11.10000,41.50000,4.66500,931.83301,39.00000,124.20000,13.10000],[23.70000,13.70000,0.00000,1.70000,6.40000,2.60000,0.00000]], 35 | ["winter","medium","high__",[8.43000,6.00000,40.16700,2.67000,723.66699,60.83300,141.83299,25.00000],[0.00000,6.40000,7.30000,12.70000,0.00000,0.00000,4.20000]], 36 | ["summer","medium","high__",[8.16000,11.10000,32.05600,5.69400,461.87500,71.00000,132.54601,15.00000],[3.60000,38.80000,0.00000,0.00000,1.20000,0.00000,2.40000]], 37 | ["winter","medium","high__",[8.70000,9.80000,5.88900,1.53400,51.11100,9.66700,17.33300,1.00000],[64.30000,1.50000,8.00000,0.00000,0.00000,0.00000,0.00000]], 38 | ["spring","medium","high__",[8.20000,11.30000,7.25000,1.87500,25.00000,6.50000,26.00000,0.30000],[46.60000,0.00000,2.50000,0.00000,0.00000,0.00000,0.00000]], 39 | ["summer","medium","high__",[8.50000,11.80000,7.83800,1.73200,206.53799,8.69200,16.66200,2.10000],[24.00000,0.00000,1.00000,0.00000,0.00000,0.00000,0.00000]], 40 | ["spring","medium","medium",[7.80000,6.00000,53.42500,0.38100,118.57100,37.85700,102.57100,1.20000],[3.70000,1.40000,1.10000,2.10000,3.20000,6.40000,0.00000]], 41 | ["summer","medium","medium",[8.00000,9.70000,57.84800,0.46100,217.75000,37.00000,86.99700,3.00000],[18.10000,14.50000,0.00000,0.00000,11.50000,22.30000,0.00000]], 42 | ["summer","medium","high__",[8.60000,11.62000,1.54900,0.44500,25.83300,16.83300,18.29300,1.40000],[43.70000,0.00000,1.20000,0.00000,0.00000,4.70000,0.00000]], 43 | ["autumn","medium","medium",[8.30000,11.60000,5.83000,0.70100,12.72700,3.54500,13.20000,3.20000],[86.60000,0.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 44 | ["spring","medium","low___",[8.40000,5.30000,74.66700,3.90000,131.66701,261.60001,432.90900,24.91700],[1.90000,12.70000,25.90000,0.00000,0.00000,0.00000,6.80000]], 45 | ["summer","medium","low___",[8.20000,6.60000,131.39999,4.18800,92.00000,238.20000,320.39999,6.80000],[1.20000,1.90000,22.90000,0.00000,8.10000,0.00000,0.00000]], 46 | ["winter","medium","medium",[8.20000,9.40000,45.27300,7.19500,345.45499,144.00000,287.00000,9.88200],[1.40000,18.40000,0.00000,0.00000,20.00000,29.50000,0.00000]], 47 | ["spring","medium","medium",[8.10000,7.10000,42.63600,5.07800,56.36400,166.72701,262.72699,17.20000],[1.60000,8.90000,6.60000,0.00000,9.20000,1.60000,1.40000]], 48 | ["summer","medium","medium",[8.10000,9.00000,48.42900,6.64000,128.57100,181.00000,222.28600,6.42900],[3.30000,11.60000,7.00000,0.00000,17.90000,4.70000,0.00000]], 49 | ["winter","medium","high__",[7.40000,10.70000,11.81800,2.16300,170.90900,36.90900,122.00000,5.55500],[14.60000,0.00000,0.00000,1.90000,22.10000,12.70000,1.40000]], 50 | ["spring","medium","high__",[8.30000,9.70000,10.55600,1.92100,65.55600,61.55600,127.22200,5.23300],[1.70000,0.00000,10.30000,2.60000,8.90000,6.70000,0.00000]], 51 | ["summer","medium","high__",[8.60000,10.70000,12.00000,2.23100,43.75000,62.62500,89.62500,2.15000],[3.30000,0.00000,0.00000,1.90000,34.30000,7.10000,6.00000]], 52 | ["winter","medium","medium",[9.10000,11.60000,31.09100,5.09900,246.36400,55.00000,284.00000,88.25500],[0.00000,36.60000,4.10000,0.00000,1.20000,16.70000,6.10000]], 53 | ["spring","medium","medium",[9.00000,6.90000,28.33300,2.95400,76.66700,102.33300,277.33301,110.45600],[0.00000,16.40000,10.10000,0.00000,0.00000,0.00000,6.60000]], 54 | ["summer","medium","medium",[8.30000,10.00000,30.12500,3.72600,102.50000,75.87500,177.62500,50.22500],[1.50000,32.80000,1.00000,4.10000,0.00000,15.80000,2.40000]], 55 | ["winter","medium","high__",[8.50000,10.10000,10.93600,1.33500,236.00000,34.63600,72.90000,11.10000],[4.20000,0.00000,1.40000,1.90000,16.20000,0.00000,1.40000]], 56 | ["spring","medium","high__",[8.30000,7.70000,10.07800,1.21200,103.33300,48.66700,82.44400,2.00000],[4.10000,0.00000,25.30000,2.10000,8.00000,0.00000,18.60000]], 57 | ["summer","medium","high__",[7.30000,10.50000,11.08800,1.37400,92.37500,48.62500,66.75000,3.30000],[1.20000,0.00000,2.30000,0.00000,44.40000,7.50000,1.90000]], 58 | ["spring","medium","medium",[7.90000,8.30000,391.50000,6.04500,380.00000,173.00000,317.00000,5.50000],[2.40000,1.70000,4.20000,8.30000,1.70000,0.00000,2.40000]], 59 | ["autumn","medium","medium",[8.00000,11.90000,130.67000,6.54000,196.00000,75.00000,84.00000,4.50000],[7.80000,8.70000,2.10000,0.00000,14.90000,22.90000,2.40000]], 60 | ["spring","medium","medium",[8.00000,9.20000,39.00000,4.86000,120.00000,187.00000,213.00000,2.00000],[10.30000,26.50000,6.10000,0.00000,5.60000,1.50000,2.20000]], 61 | ["autumn","medium","medium",[8.10000,11.70000,35.66000,5.13000,46.50000,49.00000,88.50000,2.50000],[1.50000,72.60000,0.00000,0.00000,3.40000,6.80000,3.40000]], 62 | ["winter","medium","low___",[8.43000,9.90000,37.60000,0.82600,124.00000,32.50000,115.00000,11.70000],[9.20000,2.90000,2.00000,1.30000,2.50000,0.00000,0.00000]], 63 | ["summer","medium","low___",[8.10000,6.20000,39.00000,0.67300,112.85700,60.00000,98.14300,2.00000],[28.10000,0.00000,0.00000,4.00000,1.20000,0.00000,0.00000]], 64 | ["winter","medium","medium",[7.90000,11.20000,49.90000,9.77300,505.00000,67.50000,143.75000,5.45000],[2.10000,2.60000,0.00000,0.00000,15.00000,15.70000,0.00000]], 65 | ["summer","medium","medium",[8.10000,6.20000,51.11300,5.09900,175.00000,132.50000,197.14301,6.40000],[1.40000,15.70000,1.40000,0.00000,3.50000,0.00000,1.60000]], 66 | ["spring","medium","high__",[7.80000,9.50000,8.30000,1.67000,34.00000,16.80000,35.20000,1.00000],[19.00000,0.00000,22.00000,5.00000,1.10000,5.40000,0.00000]], 67 | ["autumn","medium","high__",[7.90000,10.50000,10.20700,2.30400,132.25000,10.58300,23.48500,2.00000],[42.50000,0.00000,2.20000,1.00000,0.00000,0.00000,0.00000]], 68 | ["winter","medium","low___",[8.00000,4.50000,79.07700,8.98400,920.00000,70.00000,200.23100,19.40000],[2.50000,1.40000,1.40000,6.20000,4.10000,1.80000,3.90000]] 69 | ] 70 | } 71 | -------------------------------------------------------------------------------- /example/data/coil99-3.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "COIL 1999 Competition Data.", 3 | "batchid": "analysis_3", 4 | "var_names": ["season", "river_size", "fluid_velocity", "chemical_concentrations", "algae"], 5 | "var_types": ["string", "string", "string", "[]float64", "[]float64"], 6 | "properties": {"url": "http://archive.ics.uci.edu/ml/machine-learning-databases/coil-mld/coil.data.html"}, 7 | "data": [ 8 | ["spring","medium","low___",[7.60000,6.30000,81.33300,9.71500,196.66701,77.33300,147.83299,3.00000],[4.40000,11.20000,6.80000,0.00000,1.00000,0.00000,31.60000]], 9 | ["winter","medium","high__",[8.22000,8.10000,41.25000,1.41500,172.50000,46.66700,123.33300,30.40000],[39.70000,12.70000,0.00000,1.10000,2.70000,0.00000,1.60000]], 10 | ["autumn","medium","high__",[8.30000,9.90000,40.22600,1.58700,235.00000,33.80000,75.20700,23.80000],[32.80000,28.00000,2.00000,3.50000,1.00000,0.00000,1.50000]], 11 | ["winter","medium","high__",[8.47000,9.00000,46.16700,2.10200,84.66700,48.00000,116.20000,7.30000],[12.20000,16.00000,1.00000,1.40000,1.90000,1.20000,0.00000]], 12 | ["spring","medium","high__",[8.40000,4.90000,47.00000,0.53600,91.83300,109.00000,188.66701,32.00000],[1.90000,25.40000,21.70000,0.00000,0.00000,1.00000,0.00000]], 13 | ["autumn","medium","high__",[8.87000,11.00000,41.16300,2.27300,54.75000,39.00000,72.69600,22.70000],[0.00000,5.60000,1.20000,0.00000,8.00000,2.70000,0.00000]], 14 | ["summer","medium","high__",[7.70000,4.40000,53.00000,2.31000,90.00000,22.20000,116.20000,16.00000],[0.00000,0.00000,0.00000,1.20000,5.70000,32.10000,0.00000]], 15 | ["spring","medium","medium",[7.90000,6.00000,127.83300,2.68000,176.66701,27.50000,76.33300,2.10000],[3.40000,21.50000,14.00000,1.80000,3.90000,0.00000,0.00000]], 16 | ["autumn","medium","medium",[7.80000,10.53000,100.83000,5.41000,486.50000,24.00000,58.37400,27.50000],[2.80000,1.90000,0.00000,1.20000,19.00000,4.50000,0.00000]], 17 | ["spring","large_","low___",[8.60000,3.60000,50.00000,0.37600,134.00000,54.10000,125.80000,26.80000],[0.00000,28.00000,0.00000,0.00000,0.00000,0.00000,15.10000]], 18 | ["autumn","large_","low___",[8.40000,10.60000,19.22000,1.65500,96.83300,20.66700,54.91600,20.60000],[0.00000,11.30000,1.80000,0.00000,2.50000,0.00000,1.40000]], 19 | ["winter","large_","low___",[8.30000,11.50000,26.00000,1.87000,62.50000,30.75000,75.33300,34.75000],[0.00000,20.10000,0.00000,0.00000,0.00000,0.00000,0.00000]], 20 | ["spring","large_","low___",[9.50000,5.70000,44.00000,0.10200,146.66701,151.33299,252.50000,93.68300],[12.30000,21.70000,3.90000,0.00000,0.00000,0.00000,3.90000]], 21 | ["summer","large_","low___",[8.80000,8.80000,43.00000,0.13000,103.33300,180.66701,269.66699,92.66700],[7.20000,28.20000,0.00000,0.00000,0.00000,0.00000,3.30000]], 22 | ["autumn","large_","low___",[8.84000,12.90000,43.09000,0.84600,52.20000,8.60000,46.43800,81.54000],[3.40000,21.50000,0.00000,0.00000,0.00000,0.00000,2.70000]], 23 | ["winter","large_","high__",[7.30000,9.90000,16.00000,4.82000,101.66700,14.66700,85.00000,2.00000],[0.00000,0.00000,0.00000,2.40000,0.00000,17.80000,3.60000]], 24 | ["autumn","large_","high__",[7.40000,10.68000,22.35000,5.41400,244.60001,66.40000,171.27200,3.80000],[1.10000,0.00000,1.40000,0.00000,6.60000,42.10000,5.20000]], 25 | ["spring","large_","low___",[9.10000,4.30000,82.85700,0.86000,137.27299,102.36400,232.89999,54.36700],[0.00000,6.00000,2.90000,0.00000,0.00000,0.00000,2.90000]], 26 | ["autumn","large_","low___",[8.53000,11.10000,63.29200,1.72600,227.60001,84.30000,146.45200,21.22000],[1.40000,14.70000,2.50000,0.00000,0.00000,0.00000,2.00000]], 27 | ["winter","large_","low___",[8.56000,8.70000,43.97000,4.05300,643.00000,221.89999,246.66701,14.70000],[12.50000,2.10000,0.00000,1.20000,6.40000,4.50000,1.70000]], 28 | ["autumn","large_","low___",[8.06000,8.30000,38.90200,3.67800,627.27301,205.63600,219.90900,6.20900],[0.00000,0.00000,0.00000,0.00000,8.60000,52.50000,0.00000]], 29 | ["winter","large_","medium",[8.21000,9.30000,104.81800,3.90800,124.36400,82.22200,167.89999,5.60900],[1.40000,4.60000,10.80000,2.20000,5.50000,42.40000,0.00000]], 30 | ["spring","large_","medium",[8.50000,7.30000,71.44400,2.51200,66.66700,64.38900,137.77800,9.38400],[0.00000,3.80000,16.00000,4.00000,0.00000,0.00000,3.30000]], 31 | ["spring","large_","medium",[8.60000,10.60000,208.36400,4.45900,197.90900,87.33300,194.10001,27.61800],[0.00000,1.20000,0.00000,0.00000,11.30000,11.50000,0.00000]], 32 | ["winter","large_","medium",[9.06000,6.35000,187.18300,3.35100,54.77800,159.16701,221.27800,20.80000],[0.00000,21.10000,3.70000,0.00000,0.00000,0.00000,1.90000]], 33 | ["autumn","large_","high__",[8.70000,10.70000,4.54500,0.94100,32.72700,16.00000,21.30000,1.10000],[39.70000,0.00000,12.90000,0.00000,0.00000,0.00000,0.00000]], 34 | ["spring","large_","high__",[8.10000,10.70000,3.50000,1.01300,12.50000,12.75000,11.00000,0.60000],[37.30000,9.70000,13.60000,0.00000,2.20000,0.00000,1.20000]], 35 | ["summer","large_","high__",[8.40000,10.29000,5.32600,0.99600,53.84600,7.66700,14.35400,0.80000],[52.40000,7.50000,9.40000,0.00000,1.40000,1.90000,0.00000]], 36 | ["spring","large_","medium",[8.60000,10.10000,2.11100,0.66300,11.11100,3.22200,7.00000,1.30000],[48.30000,2.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 37 | ["summer","large_","medium",[8.20000,9.50000,2.20000,0.67200,10.00000,3.80000,6.20000,0.80000],[50.40000,3.80000,0.00000,0.00000,0.00000,0.00000,0.00000]], 38 | ["winter","large_","medium",[8.50000,10.50000,2.75000,0.75800,10.50000,4.00000,7.65400,4.00000],[56.80000,5.00000,0.00000,0.00000,0.00000,0.00000,0.00000]], 39 | ["summer","large_","medium",[8.30000,10.00000,3.86000,0.86600,32.00000,6.00000,16.00000,2.86000],[17.30000,6.70000,19.70000,0.00000,0.00000,0.00000,0.00000]], 40 | ["summer","large_","high__",[8.10000,10.20000,7.61300,0.69900,32.50000,26.62500,52.87500,2.00000],[18.10000,1.70000,2.00000,0.00000,1.70000,5.90000,0.00000]], 41 | ["winter","large_","low___",[8.70000,10.80000,39.10900,6.22500,161.81799,104.72700,228.36400,46.07500],[1.10000,3.90000,2.10000,0.00000,3.90000,4.60000,2.30000]], 42 | ["winter","large_","low___",[8.70000,11.70000,22.45500,3.76500,88.18200,41.30000,85.40000,17.49100],[0.00000,4.70000,0.00000,0.00000,2.60000,2.60000,0.00000]], 43 | ["summer","large_","low___",[8.40000,8.20000,23.25000,2.80500,43.75000,51.12500,87.12500,14.77500],[0.00000,12.00000,1.70000,0.00000,2.70000,0.00000,0.00000]], 44 | ["autumn","large_","low___",[8.55000,11.00000,22.32000,3.14000,82.10000,45.90000,101.45500,18.33000],[1.70000,7.00000,1.20000,0.00000,4.80000,3.10000,0.00000]], 45 | ["spring","large_","medium",[8.50000,7.60000,12.77800,1.87300,17.77800,50.88900,127.00000,24.55600],[0.00000,0.00000,10.20000,1.70000,1.20000,0.00000,5.50000]], 46 | ["autumn","large_","medium",[8.70000,11.40000,15.54100,2.32300,103.00000,34.50000,81.55800,5.62000],[7.60000,0.00000,1.20000,0.00000,15.90000,31.80000,5.90000]], 47 | ["winter","large_","medium",[8.40000,10.50000,12.18200,1.51900,65.45500,19.72700,50.45500,8.15500],[2.90000,4.60000,1.00000,0.00000,6.60000,16.60000,0.00000]], 48 | ["spring","large_","medium",[8.20000,8.20000,7.33300,1.00300,37.77800,19.11100,120.88900,5.11100],[2.20000,12.70000,8.80000,0.00000,0.00000,0.00000,1.20000]], 49 | ["autumn","large_","medium",[8.58000,11.10000,23.82500,3.61700,72.60000,51.11100,91.11100,22.90000],[3.80000,22.00000,2.90000,0.00000,3.10000,5.50000,0.00000]], 50 | ["summer","large_","medium",[8.50000,7.90000,12.44400,2.58600,96.66700,19.11100,61.44400,6.16700],[18.90000,13.20000,5.00000,0.00000,6.10000,0.00000,0.00000]], 51 | ["autumn","large_","medium",[8.40000,8.40000,17.37500,3.83300,83.75000,53.62500,79.75000,2.33800],[12.70000,21.70000,5.60000,0.00000,1.00000,0.00000,0.00000]], 52 | ["spring","large_","medium",[8.30000,10.60000,14.32000,3.20000,125.33300,35.33300,75.90400,4.66700],[18.00000,7.00000,1.70000,0.00000,4.80000,10.30000,1.00000]], 53 | ["autumn","large_","medium",[8.20000,7.00000,139.98900,2.97800,60.11000,78.33300,140.22000,31.73800],[0.00000,15.90000,2.40000,1.00000,0.00000,0.00000,0.00000]], 54 | ["summer","large_","medium",[8.50000,6.70000,82.85200,2.80000,27.06900,64.00000,140.51700,18.30000],[2.40000,10.50000,9.00000,7.80000,0.00000,0.00000,5.80000]] 55 | ] 56 | } 57 | -------------------------------------------------------------------------------- /example/dataset.yaml: -------------------------------------------------------------------------------- 1 | path: data 2 | files: 3 | - coil99-1.json 4 | - coil99-2.json 5 | - coil99-3.json 6 | -------------------------------------------------------------------------------- /example/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2013 AKUALAB INC. All Rights Reserved. 2 | // 3 | // Use of this source code is governed by a BSD-style 4 | // license that can be found in the LICENSE file. 5 | 6 | // Example program that uses the dataframe package. 7 | package main 8 | 9 | import ( 10 | "fmt" 11 | 12 | "github.com/akualab/dataframe" 13 | ) 14 | 15 | func main() { 16 | 17 | // Read a data frame from file. 18 | df, err := dataframe.ReadDataFrameFile("data/coil99-3.json") 19 | if err != nil { 20 | panic(err) 21 | } 22 | 23 | // Get the float variables as a single float64 slice. 24 | ch1 := df.GetChanFloat64("chemical_concentrations", "algae") 25 | 26 | // Print slices. 27 | var count int 28 | for v := range ch1 { 29 | fmt.Printf("n: %3d, values: %+v\n", count, v) 30 | count++ 31 | } 32 | 33 | // Read list of files. 34 | ds, e := dataframe.ReadDataSet("dataset.yaml") 35 | if e != nil { 36 | panic(e) 37 | } 38 | 39 | // Count total number of instances on all files. 40 | ch2 := ds.GetChanFloat64("chemical_concentrations", "algae") 41 | count = 0 42 | for _ = range ch2 { 43 | count++ 44 | } 45 | 46 | fmt.Printf("Total number of instances is %d.\n", count) 47 | } 48 | --------------------------------------------------------------------------------