├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── custom.md │ └── feature_request.md ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── doc └── logo.png ├── example ├── models │ ├── bernoullinb.json │ ├── dt.json │ ├── kneighbors.json │ ├── linearsvc.json │ ├── mlpclassifier.json │ ├── nbc.json │ ├── randomforest.json │ └── svc.json └── tests.dart ├── lib ├── SVM │ └── SVM.dart ├── base.dart ├── ensemble │ └── forest.dart ├── naivebayes │ └── naive_bayes.dart ├── neighbors │ └── neighbors.dart ├── neural_network │ └── neural_network.dart ├── pipeline │ └── pipeline.dart ├── tree │ └── tree.dart └── utils │ ├── exceptions.dart │ ├── io.dart │ └── mathutils.dart ├── pubspec.lock ├── pubspec.yaml └── test └── sklite_test.dart /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Custom issue template 3 | about: Describe this issue template's purpose here. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 20e59316b8b8474554b38493b8ca888794b0234a 8 | channel: beta 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.0.1] - Initial release 2 | 3 | ## [1.0.0] 4 | 5 | * Null safety. 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Alexander Ejbekov 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SkLite-dart 2 | 3 | [![SkLite Demo App](http://img.youtube.com/vi/K5D1T1VJBR8/0.jpg)](http://www.youtube.com/watch?v=K5D1T1VJBR8 "SkLite-dart demo") 4 | 5 | * Porting Scikit-Learn models to Flutter * 6 | 7 | ## Getting Started 8 | 9 | The library uses pre-trained models using scikit-learn and [sklite](https://github.com/axegon/SkLite) for python. Once built and exported, the models can be used in Flutter with ease. You need to load them inside your application and use them accordingly to your case: 10 | 11 | You need to setup a local static directory where you can store the generated JSON file using [sklite](https://github.com/axegon/SkLite). 12 | 13 | Put sklite in your pubspec.yaml file, import whichever model it is you intend to use and use the `predict` method as you would in scikit-learn. Use the 14 | `loadModel` in utils/dart.io for your application, the other functions are for development and testing only. 15 | 16 | ## Supported models 17 | 18 | | IMPLEMENTATION | STATUS | 19 | |------------------------------------|--------| 20 | | KNeighborsClassifier | ✓ | 21 | | SVC | ✓ | 22 | | GaussianProcessClassifier | | 23 | | DecisionTreeClassifier | ✓ | 24 | | RandomForestClassifier | ✓ | 25 | | MLPClassifier | ✓ | 26 | | AdaBoostClassifier | | 27 | | GaussianNB | ✓ | 28 | | QuadraticDiscriminantAnalysis | | 29 | | BernoulliNB | ✓ | 30 | | LinearSVC | ✓ | 31 | 32 | ## Usage 33 | 34 | You first need to add the library to your project's pubspec.yaml. For the time being the library hasn't been published to pub.dev (should be soon enough though). 35 | 36 | ``` 37 | dependencies: 38 | sklite: ^0.0.1 39 | ``` 40 | 41 | 42 | Add a static assets directory inside your Flutter project: 43 | 44 | ``` 45 | flutter: 46 | uses-material-design: true 47 | assets: 48 | - assets/ 49 | ``` 50 | 51 | Put the generated model using [sklite for python](https://github.com/axegon/SkLite) in the specified directory 52 | 53 | Import the library in your application and load the model: 54 | 55 | ``` 56 | import 'package:flutter/material.dart'; 57 | import 'package:sklite/SVM/SVM.dart'; 58 | import 'package:sklite/utils/io.dart'; 59 | import 'dart:convert'; 60 | 61 | void main() => runApp(new MaterialApp( 62 | home: new HomePage(), 63 | debugShowCheckedModeBanner: false) 64 | ); 65 | 66 | class HomePage extends StatefulWidget { 67 | @override 68 | _HomePageState createState() { 69 | return new _HomePageState(); 70 | } 71 | } 72 | 73 | class _HomePageState extends State { 74 | SVC svc; 75 | 76 | _HomePageState() { 77 | loadModel("assets/svcmnist.json").then((x) { 78 | this.svc = SVC.fromMap(json.decode(x)); 79 | }); 80 | } 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | return Scaffold( 85 | // add any widget with svc.predict() callback 86 | ); 87 | } 88 | ``` 89 | -------------------------------------------------------------------------------- /doc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/axegon/SkLite-dart/f6ecf42d2f671df0feba0fa471ebec9f15d2778d/doc/logo.png -------------------------------------------------------------------------------- /example/models/bernoullinb.json: -------------------------------------------------------------------------------- 1 | { 2 | "class_log_prior_": [ 3 | -1.0986122886681096, 4 | -1.0986122886681096, 5 | -1.0986122886681096 6 | ], 7 | "classes_": [ 8 | 0, 9 | 1, 10 | 2 11 | ], 12 | "neg_prob_": [ 13 | [ 14 | -3.9512437185814138, 15 | -3.9512437185814138, 16 | -3.9512437185814138, 17 | -3.9512437185814138 18 | ], 19 | [ 20 | -3.9512437185814138, 21 | -3.9512437185814138, 22 | -3.9512437185814138, 23 | -3.9512437185814138 24 | ], 25 | [ 26 | -3.9512437185814138, 27 | -3.9512437185814138, 28 | -3.9512437185814138, 29 | -3.9512437185814138 30 | ] 31 | ], 32 | "delta_probs_": [ 33 | [ 34 | 3.931825632724312, 35 | 3.931825632724312, 36 | 3.931825632724312 37 | ], 38 | [ 39 | 3.931825632724312, 40 | 3.931825632724312, 41 | 3.931825632724312 42 | ], 43 | [ 44 | 3.931825632724312, 45 | 3.931825632724312, 46 | 3.931825632724312 47 | ], 48 | [ 49 | 3.931825632724312, 50 | 3.931825632724312, 51 | 3.931825632724312 52 | ] 53 | ], 54 | "__meta__": { 55 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 56 | "__sklearn_version": "0.21.2", 57 | "__classifier": "BernoulliNB", 58 | "__author": "alex", 59 | "__dt": "2019-07-20T20:56:49.406030" 60 | } 61 | } -------------------------------------------------------------------------------- /example/models/dt.json: -------------------------------------------------------------------------------- 1 | { 2 | "children_left": [ 3 | 1, 4 | -1, 5 | 3, 6 | 4, 7 | 5, 8 | -1, 9 | -1, 10 | 8, 11 | -1, 12 | 10, 13 | -1, 14 | -1, 15 | 13, 16 | 14, 17 | -1, 18 | -1, 19 | -1 20 | ], 21 | "children_right": [ 22 | 2, 23 | -1, 24 | 12, 25 | 7, 26 | 6, 27 | -1, 28 | -1, 29 | 9, 30 | -1, 31 | 11, 32 | -1, 33 | -1, 34 | 16, 35 | 15, 36 | -1, 37 | -1, 38 | -1 39 | ], 40 | "threshold": [ 41 | 2.449999988079071, 42 | -2.0, 43 | 1.75, 44 | 4.950000047683716, 45 | 1.6500000357627869, 46 | -2.0, 47 | -2.0, 48 | 1.550000011920929, 49 | -2.0, 50 | 5.450000047683716, 51 | -2.0, 52 | -2.0, 53 | 4.8500001430511475, 54 | 5.950000047683716, 55 | -2.0, 56 | -2.0, 57 | -2.0 58 | ], 59 | "feature": [ 60 | 2, 61 | -2, 62 | 3, 63 | 2, 64 | 3, 65 | -2, 66 | -2, 67 | 3, 68 | -2, 69 | 2, 70 | -2, 71 | -2, 72 | 2, 73 | 0, 74 | -2, 75 | -2, 76 | -2 77 | ], 78 | "classes_": [ 79 | 0, 80 | 1, 81 | 2 82 | ], 83 | "value": [ 84 | [ 85 | 50.0, 86 | 50.0, 87 | 50.0 88 | ], 89 | [ 90 | 50.0, 91 | 0.0, 92 | 0.0 93 | ], 94 | [ 95 | 0.0, 96 | 50.0, 97 | 50.0 98 | ], 99 | [ 100 | 0.0, 101 | 49.0, 102 | 5.0 103 | ], 104 | [ 105 | 0.0, 106 | 47.0, 107 | 1.0 108 | ], 109 | [ 110 | 0.0, 111 | 47.0, 112 | 0.0 113 | ], 114 | [ 115 | 0.0, 116 | 0.0, 117 | 1.0 118 | ], 119 | [ 120 | 0.0, 121 | 2.0, 122 | 4.0 123 | ], 124 | [ 125 | 0.0, 126 | 0.0, 127 | 3.0 128 | ], 129 | [ 130 | 0.0, 131 | 2.0, 132 | 1.0 133 | ], 134 | [ 135 | 0.0, 136 | 2.0, 137 | 0.0 138 | ], 139 | [ 140 | 0.0, 141 | 0.0, 142 | 1.0 143 | ], 144 | [ 145 | 0.0, 146 | 1.0, 147 | 45.0 148 | ], 149 | [ 150 | 0.0, 151 | 1.0, 152 | 2.0 153 | ], 154 | [ 155 | 0.0, 156 | 1.0, 157 | 0.0 158 | ], 159 | [ 160 | 0.0, 161 | 0.0, 162 | 2.0 163 | ], 164 | [ 165 | 0.0, 166 | 0.0, 167 | 43.0 168 | ] 169 | ], 170 | "__meta__": { 171 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 172 | "__sklearn_version": "0.21.2", 173 | "__classifier": "DecisionTreeClassifier", 174 | "__author": "alex", 175 | "__dt": "2019-07-12T23:18:47.172481" 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /example/models/kneighbors.json: -------------------------------------------------------------------------------- 1 | { 2 | "_fit_X": [ 3 | [ 4 | 5.1, 5 | 3.5, 6 | 1.4, 7 | 0.2 8 | ], 9 | [ 10 | 4.9, 11 | 3.0, 12 | 1.4, 13 | 0.2 14 | ], 15 | [ 16 | 4.7, 17 | 3.2, 18 | 1.3, 19 | 0.2 20 | ], 21 | [ 22 | 4.6, 23 | 3.1, 24 | 1.5, 25 | 0.2 26 | ], 27 | [ 28 | 5.0, 29 | 3.6, 30 | 1.4, 31 | 0.2 32 | ], 33 | [ 34 | 5.4, 35 | 3.9, 36 | 1.7, 37 | 0.4 38 | ], 39 | [ 40 | 4.6, 41 | 3.4, 42 | 1.4, 43 | 0.3 44 | ], 45 | [ 46 | 5.0, 47 | 3.4, 48 | 1.5, 49 | 0.2 50 | ], 51 | [ 52 | 4.4, 53 | 2.9, 54 | 1.4, 55 | 0.2 56 | ], 57 | [ 58 | 4.9, 59 | 3.1, 60 | 1.5, 61 | 0.1 62 | ], 63 | [ 64 | 5.4, 65 | 3.7, 66 | 1.5, 67 | 0.2 68 | ], 69 | [ 70 | 4.8, 71 | 3.4, 72 | 1.6, 73 | 0.2 74 | ], 75 | [ 76 | 4.8, 77 | 3.0, 78 | 1.4, 79 | 0.1 80 | ], 81 | [ 82 | 4.3, 83 | 3.0, 84 | 1.1, 85 | 0.1 86 | ], 87 | [ 88 | 5.8, 89 | 4.0, 90 | 1.2, 91 | 0.2 92 | ], 93 | [ 94 | 5.7, 95 | 4.4, 96 | 1.5, 97 | 0.4 98 | ], 99 | [ 100 | 5.4, 101 | 3.9, 102 | 1.3, 103 | 0.4 104 | ], 105 | [ 106 | 5.1, 107 | 3.5, 108 | 1.4, 109 | 0.3 110 | ], 111 | [ 112 | 5.7, 113 | 3.8, 114 | 1.7, 115 | 0.3 116 | ], 117 | [ 118 | 5.1, 119 | 3.8, 120 | 1.5, 121 | 0.3 122 | ], 123 | [ 124 | 5.4, 125 | 3.4, 126 | 1.7, 127 | 0.2 128 | ], 129 | [ 130 | 5.1, 131 | 3.7, 132 | 1.5, 133 | 0.4 134 | ], 135 | [ 136 | 4.6, 137 | 3.6, 138 | 1.0, 139 | 0.2 140 | ], 141 | [ 142 | 5.1, 143 | 3.3, 144 | 1.7, 145 | 0.5 146 | ], 147 | [ 148 | 4.8, 149 | 3.4, 150 | 1.9, 151 | 0.2 152 | ], 153 | [ 154 | 5.0, 155 | 3.0, 156 | 1.6, 157 | 0.2 158 | ], 159 | [ 160 | 5.0, 161 | 3.4, 162 | 1.6, 163 | 0.4 164 | ], 165 | [ 166 | 5.2, 167 | 3.5, 168 | 1.5, 169 | 0.2 170 | ], 171 | [ 172 | 5.2, 173 | 3.4, 174 | 1.4, 175 | 0.2 176 | ], 177 | [ 178 | 4.7, 179 | 3.2, 180 | 1.6, 181 | 0.2 182 | ], 183 | [ 184 | 4.8, 185 | 3.1, 186 | 1.6, 187 | 0.2 188 | ], 189 | [ 190 | 5.4, 191 | 3.4, 192 | 1.5, 193 | 0.4 194 | ], 195 | [ 196 | 5.2, 197 | 4.1, 198 | 1.5, 199 | 0.1 200 | ], 201 | [ 202 | 5.5, 203 | 4.2, 204 | 1.4, 205 | 0.2 206 | ], 207 | [ 208 | 4.9, 209 | 3.1, 210 | 1.5, 211 | 0.2 212 | ], 213 | [ 214 | 5.0, 215 | 3.2, 216 | 1.2, 217 | 0.2 218 | ], 219 | [ 220 | 5.5, 221 | 3.5, 222 | 1.3, 223 | 0.2 224 | ], 225 | [ 226 | 4.9, 227 | 3.6, 228 | 1.4, 229 | 0.1 230 | ], 231 | [ 232 | 4.4, 233 | 3.0, 234 | 1.3, 235 | 0.2 236 | ], 237 | [ 238 | 5.1, 239 | 3.4, 240 | 1.5, 241 | 0.2 242 | ], 243 | [ 244 | 5.0, 245 | 3.5, 246 | 1.3, 247 | 0.3 248 | ], 249 | [ 250 | 4.5, 251 | 2.3, 252 | 1.3, 253 | 0.3 254 | ], 255 | [ 256 | 4.4, 257 | 3.2, 258 | 1.3, 259 | 0.2 260 | ], 261 | [ 262 | 5.0, 263 | 3.5, 264 | 1.6, 265 | 0.6 266 | ], 267 | [ 268 | 5.1, 269 | 3.8, 270 | 1.9, 271 | 0.4 272 | ], 273 | [ 274 | 4.8, 275 | 3.0, 276 | 1.4, 277 | 0.3 278 | ], 279 | [ 280 | 5.1, 281 | 3.8, 282 | 1.6, 283 | 0.2 284 | ], 285 | [ 286 | 4.6, 287 | 3.2, 288 | 1.4, 289 | 0.2 290 | ], 291 | [ 292 | 5.3, 293 | 3.7, 294 | 1.5, 295 | 0.2 296 | ], 297 | [ 298 | 5.0, 299 | 3.3, 300 | 1.4, 301 | 0.2 302 | ], 303 | [ 304 | 7.0, 305 | 3.2, 306 | 4.7, 307 | 1.4 308 | ], 309 | [ 310 | 6.4, 311 | 3.2, 312 | 4.5, 313 | 1.5 314 | ], 315 | [ 316 | 6.9, 317 | 3.1, 318 | 4.9, 319 | 1.5 320 | ], 321 | [ 322 | 5.5, 323 | 2.3, 324 | 4.0, 325 | 1.3 326 | ], 327 | [ 328 | 6.5, 329 | 2.8, 330 | 4.6, 331 | 1.5 332 | ], 333 | [ 334 | 5.7, 335 | 2.8, 336 | 4.5, 337 | 1.3 338 | ], 339 | [ 340 | 6.3, 341 | 3.3, 342 | 4.7, 343 | 1.6 344 | ], 345 | [ 346 | 4.9, 347 | 2.4, 348 | 3.3, 349 | 1.0 350 | ], 351 | [ 352 | 6.6, 353 | 2.9, 354 | 4.6, 355 | 1.3 356 | ], 357 | [ 358 | 5.2, 359 | 2.7, 360 | 3.9, 361 | 1.4 362 | ], 363 | [ 364 | 5.0, 365 | 2.0, 366 | 3.5, 367 | 1.0 368 | ], 369 | [ 370 | 5.9, 371 | 3.0, 372 | 4.2, 373 | 1.5 374 | ], 375 | [ 376 | 6.0, 377 | 2.2, 378 | 4.0, 379 | 1.0 380 | ], 381 | [ 382 | 6.1, 383 | 2.9, 384 | 4.7, 385 | 1.4 386 | ], 387 | [ 388 | 5.6, 389 | 2.9, 390 | 3.6, 391 | 1.3 392 | ], 393 | [ 394 | 6.7, 395 | 3.1, 396 | 4.4, 397 | 1.4 398 | ], 399 | [ 400 | 5.6, 401 | 3.0, 402 | 4.5, 403 | 1.5 404 | ], 405 | [ 406 | 5.8, 407 | 2.7, 408 | 4.1, 409 | 1.0 410 | ], 411 | [ 412 | 6.2, 413 | 2.2, 414 | 4.5, 415 | 1.5 416 | ], 417 | [ 418 | 5.6, 419 | 2.5, 420 | 3.9, 421 | 1.1 422 | ], 423 | [ 424 | 5.9, 425 | 3.2, 426 | 4.8, 427 | 1.8 428 | ], 429 | [ 430 | 6.1, 431 | 2.8, 432 | 4.0, 433 | 1.3 434 | ], 435 | [ 436 | 6.3, 437 | 2.5, 438 | 4.9, 439 | 1.5 440 | ], 441 | [ 442 | 6.1, 443 | 2.8, 444 | 4.7, 445 | 1.2 446 | ], 447 | [ 448 | 6.4, 449 | 2.9, 450 | 4.3, 451 | 1.3 452 | ], 453 | [ 454 | 6.6, 455 | 3.0, 456 | 4.4, 457 | 1.4 458 | ], 459 | [ 460 | 6.8, 461 | 2.8, 462 | 4.8, 463 | 1.4 464 | ], 465 | [ 466 | 6.7, 467 | 3.0, 468 | 5.0, 469 | 1.7 470 | ], 471 | [ 472 | 6.0, 473 | 2.9, 474 | 4.5, 475 | 1.5 476 | ], 477 | [ 478 | 5.7, 479 | 2.6, 480 | 3.5, 481 | 1.0 482 | ], 483 | [ 484 | 5.5, 485 | 2.4, 486 | 3.8, 487 | 1.1 488 | ], 489 | [ 490 | 5.5, 491 | 2.4, 492 | 3.7, 493 | 1.0 494 | ], 495 | [ 496 | 5.8, 497 | 2.7, 498 | 3.9, 499 | 1.2 500 | ], 501 | [ 502 | 6.0, 503 | 2.7, 504 | 5.1, 505 | 1.6 506 | ], 507 | [ 508 | 5.4, 509 | 3.0, 510 | 4.5, 511 | 1.5 512 | ], 513 | [ 514 | 6.0, 515 | 3.4, 516 | 4.5, 517 | 1.6 518 | ], 519 | [ 520 | 6.7, 521 | 3.1, 522 | 4.7, 523 | 1.5 524 | ], 525 | [ 526 | 6.3, 527 | 2.3, 528 | 4.4, 529 | 1.3 530 | ], 531 | [ 532 | 5.6, 533 | 3.0, 534 | 4.1, 535 | 1.3 536 | ], 537 | [ 538 | 5.5, 539 | 2.5, 540 | 4.0, 541 | 1.3 542 | ], 543 | [ 544 | 5.5, 545 | 2.6, 546 | 4.4, 547 | 1.2 548 | ], 549 | [ 550 | 6.1, 551 | 3.0, 552 | 4.6, 553 | 1.4 554 | ], 555 | [ 556 | 5.8, 557 | 2.6, 558 | 4.0, 559 | 1.2 560 | ], 561 | [ 562 | 5.0, 563 | 2.3, 564 | 3.3, 565 | 1.0 566 | ], 567 | [ 568 | 5.6, 569 | 2.7, 570 | 4.2, 571 | 1.3 572 | ], 573 | [ 574 | 5.7, 575 | 3.0, 576 | 4.2, 577 | 1.2 578 | ], 579 | [ 580 | 5.7, 581 | 2.9, 582 | 4.2, 583 | 1.3 584 | ], 585 | [ 586 | 6.2, 587 | 2.9, 588 | 4.3, 589 | 1.3 590 | ], 591 | [ 592 | 5.1, 593 | 2.5, 594 | 3.0, 595 | 1.1 596 | ], 597 | [ 598 | 5.7, 599 | 2.8, 600 | 4.1, 601 | 1.3 602 | ], 603 | [ 604 | 6.3, 605 | 3.3, 606 | 6.0, 607 | 2.5 608 | ], 609 | [ 610 | 5.8, 611 | 2.7, 612 | 5.1, 613 | 1.9 614 | ], 615 | [ 616 | 7.1, 617 | 3.0, 618 | 5.9, 619 | 2.1 620 | ], 621 | [ 622 | 6.3, 623 | 2.9, 624 | 5.6, 625 | 1.8 626 | ], 627 | [ 628 | 6.5, 629 | 3.0, 630 | 5.8, 631 | 2.2 632 | ], 633 | [ 634 | 7.6, 635 | 3.0, 636 | 6.6, 637 | 2.1 638 | ], 639 | [ 640 | 4.9, 641 | 2.5, 642 | 4.5, 643 | 1.7 644 | ], 645 | [ 646 | 7.3, 647 | 2.9, 648 | 6.3, 649 | 1.8 650 | ], 651 | [ 652 | 6.7, 653 | 2.5, 654 | 5.8, 655 | 1.8 656 | ], 657 | [ 658 | 7.2, 659 | 3.6, 660 | 6.1, 661 | 2.5 662 | ], 663 | [ 664 | 6.5, 665 | 3.2, 666 | 5.1, 667 | 2.0 668 | ], 669 | [ 670 | 6.4, 671 | 2.7, 672 | 5.3, 673 | 1.9 674 | ], 675 | [ 676 | 6.8, 677 | 3.0, 678 | 5.5, 679 | 2.1 680 | ], 681 | [ 682 | 5.7, 683 | 2.5, 684 | 5.0, 685 | 2.0 686 | ], 687 | [ 688 | 5.8, 689 | 2.8, 690 | 5.1, 691 | 2.4 692 | ], 693 | [ 694 | 6.4, 695 | 3.2, 696 | 5.3, 697 | 2.3 698 | ], 699 | [ 700 | 6.5, 701 | 3.0, 702 | 5.5, 703 | 1.8 704 | ], 705 | [ 706 | 7.7, 707 | 3.8, 708 | 6.7, 709 | 2.2 710 | ], 711 | [ 712 | 7.7, 713 | 2.6, 714 | 6.9, 715 | 2.3 716 | ], 717 | [ 718 | 6.0, 719 | 2.2, 720 | 5.0, 721 | 1.5 722 | ], 723 | [ 724 | 6.9, 725 | 3.2, 726 | 5.7, 727 | 2.3 728 | ], 729 | [ 730 | 5.6, 731 | 2.8, 732 | 4.9, 733 | 2.0 734 | ], 735 | [ 736 | 7.7, 737 | 2.8, 738 | 6.7, 739 | 2.0 740 | ], 741 | [ 742 | 6.3, 743 | 2.7, 744 | 4.9, 745 | 1.8 746 | ], 747 | [ 748 | 6.7, 749 | 3.3, 750 | 5.7, 751 | 2.1 752 | ], 753 | [ 754 | 7.2, 755 | 3.2, 756 | 6.0, 757 | 1.8 758 | ], 759 | [ 760 | 6.2, 761 | 2.8, 762 | 4.8, 763 | 1.8 764 | ], 765 | [ 766 | 6.1, 767 | 3.0, 768 | 4.9, 769 | 1.8 770 | ], 771 | [ 772 | 6.4, 773 | 2.8, 774 | 5.6, 775 | 2.1 776 | ], 777 | [ 778 | 7.2, 779 | 3.0, 780 | 5.8, 781 | 1.6 782 | ], 783 | [ 784 | 7.4, 785 | 2.8, 786 | 6.1, 787 | 1.9 788 | ], 789 | [ 790 | 7.9, 791 | 3.8, 792 | 6.4, 793 | 2.0 794 | ], 795 | [ 796 | 6.4, 797 | 2.8, 798 | 5.6, 799 | 2.2 800 | ], 801 | [ 802 | 6.3, 803 | 2.8, 804 | 5.1, 805 | 1.5 806 | ], 807 | [ 808 | 6.1, 809 | 2.6, 810 | 5.6, 811 | 1.4 812 | ], 813 | [ 814 | 7.7, 815 | 3.0, 816 | 6.1, 817 | 2.3 818 | ], 819 | [ 820 | 6.3, 821 | 3.4, 822 | 5.6, 823 | 2.4 824 | ], 825 | [ 826 | 6.4, 827 | 3.1, 828 | 5.5, 829 | 1.8 830 | ], 831 | [ 832 | 6.0, 833 | 3.0, 834 | 4.8, 835 | 1.8 836 | ], 837 | [ 838 | 6.9, 839 | 3.1, 840 | 5.4, 841 | 2.1 842 | ], 843 | [ 844 | 6.7, 845 | 3.1, 846 | 5.6, 847 | 2.4 848 | ], 849 | [ 850 | 6.9, 851 | 3.1, 852 | 5.1, 853 | 2.3 854 | ], 855 | [ 856 | 5.8, 857 | 2.7, 858 | 5.1, 859 | 1.9 860 | ], 861 | [ 862 | 6.8, 863 | 3.2, 864 | 5.9, 865 | 2.3 866 | ], 867 | [ 868 | 6.7, 869 | 3.3, 870 | 5.7, 871 | 2.5 872 | ], 873 | [ 874 | 6.7, 875 | 3.0, 876 | 5.2, 877 | 2.3 878 | ], 879 | [ 880 | 6.3, 881 | 2.5, 882 | 5.0, 883 | 1.9 884 | ], 885 | [ 886 | 6.5, 887 | 3.0, 888 | 5.2, 889 | 2.0 890 | ], 891 | [ 892 | 6.2, 893 | 3.4, 894 | 5.4, 895 | 2.3 896 | ], 897 | [ 898 | 5.9, 899 | 3.0, 900 | 5.1, 901 | 1.8 902 | ] 903 | ], 904 | "_y": [ 905 | 0, 906 | 0, 907 | 0, 908 | 0, 909 | 0, 910 | 0, 911 | 0, 912 | 0, 913 | 0, 914 | 0, 915 | 0, 916 | 0, 917 | 0, 918 | 0, 919 | 0, 920 | 0, 921 | 0, 922 | 0, 923 | 0, 924 | 0, 925 | 0, 926 | 0, 927 | 0, 928 | 0, 929 | 0, 930 | 0, 931 | 0, 932 | 0, 933 | 0, 934 | 0, 935 | 0, 936 | 0, 937 | 0, 938 | 0, 939 | 0, 940 | 0, 941 | 0, 942 | 0, 943 | 0, 944 | 0, 945 | 0, 946 | 0, 947 | 0, 948 | 0, 949 | 0, 950 | 0, 951 | 0, 952 | 0, 953 | 0, 954 | 0, 955 | 1, 956 | 1, 957 | 1, 958 | 1, 959 | 1, 960 | 1, 961 | 1, 962 | 1, 963 | 1, 964 | 1, 965 | 1, 966 | 1, 967 | 1, 968 | 1, 969 | 1, 970 | 1, 971 | 1, 972 | 1, 973 | 1, 974 | 1, 975 | 1, 976 | 1, 977 | 1, 978 | 1, 979 | 1, 980 | 1, 981 | 1, 982 | 1, 983 | 1, 984 | 1, 985 | 1, 986 | 1, 987 | 1, 988 | 1, 989 | 1, 990 | 1, 991 | 1, 992 | 1, 993 | 1, 994 | 1, 995 | 1, 996 | 1, 997 | 1, 998 | 1, 999 | 1, 1000 | 1, 1001 | 1, 1002 | 1, 1003 | 1, 1004 | 1, 1005 | 2, 1006 | 2, 1007 | 2, 1008 | 2, 1009 | 2, 1010 | 2, 1011 | 2, 1012 | 2, 1013 | 2, 1014 | 2, 1015 | 2, 1016 | 2, 1017 | 2, 1018 | 2, 1019 | 2, 1020 | 2, 1021 | 2, 1022 | 2, 1023 | 2, 1024 | 2, 1025 | 2, 1026 | 2, 1027 | 2, 1028 | 2, 1029 | 2, 1030 | 2, 1031 | 2, 1032 | 2, 1033 | 2, 1034 | 2, 1035 | 2, 1036 | 2, 1037 | 2, 1038 | 2, 1039 | 2, 1040 | 2, 1041 | 2, 1042 | 2, 1043 | 2, 1044 | 2, 1045 | 2, 1046 | 2, 1047 | 2, 1048 | 2, 1049 | 2, 1050 | 2, 1051 | 2, 1052 | 2, 1053 | 2, 1054 | 2 1055 | ], 1056 | "classes_": [ 1057 | 0, 1058 | 1, 1059 | 2 1060 | ], 1061 | "n_neighbors": 5, 1062 | "p": 2, 1063 | "__meta__": { 1064 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 1065 | "__sklearn_version": "0.21.2", 1066 | "__classifier": "KNeighborsClassifier", 1067 | "__author": "alex", 1068 | "__dt": "2019-07-12T23:18:47.189572" 1069 | } 1070 | } -------------------------------------------------------------------------------- /example/models/linearsvc.json: -------------------------------------------------------------------------------- 1 | { 2 | "intercept_": [ 3 | 0.10956193896258272, 4 | 1.6828674121616642, 5 | -1.709768871761931 6 | ], 7 | "classes_": [ 8 | 0, 9 | 1, 10 | 2 11 | ], 12 | "coef_": [ 13 | [ 14 | 0.18424017095359477, 15 | 0.4512266672774772, 16 | -0.8079440242043746, 17 | -0.4507153964623114 18 | ], 19 | [ 20 | 0.055094354318998895, 21 | -0.8981338797653609, 22 | 0.40927981018050796, 23 | -0.9621442795715535 24 | ], 25 | [ 26 | -0.8507774705465525, 27 | -0.986654355309393, 28 | 1.381019807135868, 29 | 1.8654348245711092 30 | ] 31 | ], 32 | "__meta__": { 33 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 34 | "__sklearn_version": "0.21.2", 35 | "__classifier": "LinearSVC", 36 | "__author": "alex", 37 | "__dt": "2019-07-12T23:18:47.184954" 38 | } 39 | } -------------------------------------------------------------------------------- /example/models/mlpclassifier.json: -------------------------------------------------------------------------------- 1 | { 2 | "classes_": [ 3 | 0, 4 | 1, 5 | 2 6 | ], 7 | "coefs_": [ 8 | [ 9 | [ 10 | 0.15528921788807937, 11 | -0.051348943374479046, 12 | -0.015484318464805753, 13 | -0.006154025167262611, 14 | 0.1607279908512673, 15 | -0.022093034285868327, 16 | 0.004745796244861899, 17 | -0.05663716831707216, 18 | 0.13076340968639824, 19 | 0.008531955384677317, 20 | -0.07489920036541643, 21 | -0.013051562339722224, 22 | -0.08278028717737074, 23 | -0.05726666086598528, 24 | -0.06328171628382373, 25 | -0.08223963591772915, 26 | -0.09145798536347888, 27 | -0.02858748717481487, 28 | -0.048020467571916345, 29 | 0.15763910163766356, 30 | 0.02067496205650228, 31 | 0.011174464098339236, 32 | -0.007367363575172879, 33 | 0.2063931635573357, 34 | 0.27717957609638316, 35 | 0.16485193835028863, 36 | 0.17595327853829917, 37 | 0.0020543265417801207, 38 | 0.1581877603390459, 39 | -0.09199075712696372, 40 | -0.028470357693378776, 41 | 0.25019908968634696, 42 | -0.061022055910066104, 43 | -0.03738007887698059, 44 | -0.10666907292809003, 45 | 0.15262038774935105, 46 | 0.00023734900843799914, 47 | 0.19856824545061977, 48 | 0.25773206983974545, 49 | 0.14982505682980082, 50 | -0.11873068291112246, 51 | 0.2249584927470832, 52 | -0.09663927762627945, 53 | -0.019514838746269185, 54 | -0.0403352532266673, 55 | 0.3258692008524919, 56 | 0.25178388585822425, 57 | -0.022369735896329283, 58 | 0.01835085105797823, 59 | -0.02389518183587461, 60 | 0.15141404568297415, 61 | -0.029295226835784827, 62 | 0.2694146810936162, 63 | 0.031679009216359286, 64 | -0.09949999975268445, 65 | 0.0961667033019178, 66 | 0.01566530415528046, 67 | 0.19816458473724313, 68 | 0.20160809872788155, 69 | -0.08878077570159781, 70 | 0.169951019841758, 71 | -0.04241194493024096, 72 | 0.06470354550186029, 73 | 0.17767805489441582, 74 | 0.23960022753956742, 75 | -0.14393412814837675, 76 | -0.0016439036992576088, 77 | -0.013269704331111134, 78 | 0.007606061680264684, 79 | 0.06287616679519636, 80 | 0.19743332236992142, 81 | -0.0842967935726935, 82 | -0.05617835914710142, 83 | -0.08103320763429706, 84 | 0.11164751669166299, 85 | 0.2564096776745225, 86 | -0.047258468184272116, 87 | -0.2025037179492077, 88 | -0.006548143093006502, 89 | -0.10433531684136048, 90 | 0.017282093742604032, 91 | -0.08909898898727003, 92 | -0.10381400507012543, 93 | -0.08382161885934289, 94 | 0.19795269071617916, 95 | -0.03372934203119454, 96 | 0.04450510378293357, 97 | -0.045737934186959144, 98 | -0.002888558611025295, 99 | -0.2520278025018951, 100 | -0.02573669379360423, 101 | 0.06006435460815241, 102 | 0.0008685076944091963, 103 | 0.20830313042159848, 104 | -0.01964126229503425, 105 | 0.0922244009367758, 106 | -0.00023971656836038643, 107 | -0.010180008701154576, 108 | 0.15007448197333143, 109 | -0.00155057980876858 110 | ], 111 | [ 112 | -0.23120819016397617, 113 | -0.10080519661271337, 114 | -0.2799668784091283, 115 | -0.016113703351880452, 116 | 0.06742081138778684, 117 | 0.11969046453484401, 118 | -0.08453533189553147, 119 | 0.0057393491481020666, 120 | 0.24950554692248522, 121 | 0.3341988400458354, 122 | 0.07075665410136395, 123 | -6.730113625737044e-05, 124 | -0.002213357109878309, 125 | 0.00039092524761039706, 126 | 0.05695902161120508, 127 | -0.06202135249137846, 128 | -0.004770166018676059, 129 | -0.01111170427712711, 130 | -0.015432570365309166, 131 | 0.09770478463484251, 132 | 0.15394662704096035, 133 | -0.03937450759350129, 134 | 0.0002788153587719878, 135 | 0.21677019102256032, 136 | 0.08297878175561714, 137 | 0.16753094569726265, 138 | 0.0722229482653414, 139 | -0.001386295855654879, 140 | -0.10288742249385131, 141 | 0.25124859418822376, 142 | -0.024929576350638378, 143 | 0.2131301152430547, 144 | -0.014745747673351834, 145 | 0.0012354012540339195, 146 | -0.08124683549794859, 147 | 0.06188485306352519, 148 | -0.02715107541185857, 149 | 0.07398120607340936, 150 | -0.13570213799194267, 151 | 0.14825938452887474, 152 | 0.005880841571499457, 153 | -0.09388025649264184, 154 | 0.06716865459102032, 155 | -0.043328582958752006, 156 | 0.11314853771971922, 157 | 0.3390005612323912, 158 | 0.3162488779199575, 159 | -0.1634453907311029, 160 | -0.050770109183584836, 161 | 0.016057772129419483, 162 | -0.1900696105575038, 163 | 0.12860835205713114, 164 | 0.0040878417163702245, 165 | 0.16139951644241574, 166 | 0.0026451980379299826, 167 | 0.1812569624060151, 168 | -0.09609919467875051, 169 | -0.21787011812702034, 170 | 0.019193207787767202, 171 | 0.10610747200344524, 172 | -0.10723778884261641, 173 | 0.09275346191454922, 174 | -0.05039797079609277, 175 | -0.26765741736969023, 176 | -0.12055784954459887, 177 | 0.11436216721488726, 178 | -0.042394767452481434, 179 | -0.01285329740617977, 180 | 0.2232672357726687, 181 | -0.10580619976557562, 182 | -0.2749792603281721, 183 | -0.016074239071821584, 184 | 0.14137764654423485, 185 | -0.00032101903307379877, 186 | -0.17194654373814547, 187 | 0.006066320864218669, 188 | 0.028239076805497188, 189 | 0.08951494146450338, 190 | -0.2037739874705276, 191 | 0.036383745828464605, 192 | 0.23277395367096398, 193 | -0.002780218944138348, 194 | 0.001986201193845198, 195 | -0.032544328604484835, 196 | 0.18160670253902683, 197 | -0.07716310133288036, 198 | -0.18665023791959162, 199 | -0.06810334678952876, 200 | 0.023543568159893093, 201 | 0.04021838415983708, 202 | 0.049873325509145486, 203 | -0.21521570710239477, 204 | -0.05189718189989805, 205 | 0.21808332427925833, 206 | -0.04135735279361817, 207 | 0.14949033827906258, 208 | -4.0135230037368e-05, 209 | -0.03167497754186829, 210 | -0.06158945390187105, 211 | 0.006451301889480014 212 | ], 213 | [ 214 | 0.10885392264746117, 215 | -0.010177926519645067, 216 | 0.17328372957204466, 217 | 0.2440648705094329, 218 | -0.12973260745515638, 219 | -0.05127429079494167, 220 | 0.3083281759544819, 221 | 0.010701847603862436, 222 | -0.30390961312850195, 223 | -0.2574699790000819, 224 | 0.30590259396240965, 225 | 0.00027478348404787856, 226 | 0.02136529191328369, 227 | 0.004423114477531373, 228 | -0.0009681375846047194, 229 | 0.01788055398970543, 230 | -0.0895832467453483, 231 | -0.09250074530284963, 232 | -0.01117217332309584, 233 | 0.12878334498577143, 234 | 0.1003838846848103, 235 | -0.09436066404567445, 236 | 0.11875567928485639, 237 | -0.011992998692803595, 238 | -0.2972123510543796, 239 | -0.05223292511089602, 240 | -0.135295402292331, 241 | -0.10403980656295264, 242 | -0.24018613610423603, 243 | -0.057096741341333634, 244 | 0.00357124583563903, 245 | 0.052801006926373475, 246 | -0.09474906358956449, 247 | 0.01896622024122202, 248 | -0.07334692012545607, 249 | -0.25502556049650865, 250 | -0.09907494005407837, 251 | -0.230464269512323, 252 | 0.15719300831168678, 253 | -0.10721692113583721, 254 | 0.3393599396126433, 255 | -0.035317417340452587, 256 | 0.3635069037555956, 257 | 0.23551475649100412, 258 | 0.17912248733825342, 259 | -0.3385258949315411, 260 | -0.2661811283055575, 261 | 0.33916440102228024, 262 | -0.060986901483291216, 263 | -0.10174269411050961, 264 | 0.2958869274388836, 265 | -0.22511332788974545, 266 | -0.17210783807897947, 267 | -0.14681080695467327, 268 | 0.001026233018780767, 269 | 0.12246180026150258, 270 | -0.002803071647430293, 271 | 0.04816827742267984, 272 | -0.04983486014023779, 273 | 0.1865166036737075, 274 | 0.01583028746236208, 275 | -0.09443046418025211, 276 | 0.0389517235474193, 277 | 0.03385636570581815, 278 | -0.12990334925667318, 279 | -0.002815286880260506, 280 | -0.09069044086711298, 281 | -0.09536013698940903, 282 | 0.08348514307406878, 283 | 0.19331735742036554, 284 | -0.17662209805042783, 285 | -0.04659067645762726, 286 | 0.23635715893830994, 287 | -0.0013883723488345822, 288 | 0.10180855701408542, 289 | -0.03914815978194073, 290 | -0.049084320917179236, 291 | 0.22231009852401593, 292 | 0.33085471815702794, 293 | 0.0017924065463350573, 294 | 0.04049479227982597, 295 | -0.045629907338368164, 296 | 0.004780733527205932, 297 | 0.2449766683647694, 298 | -0.09345337697717553, 299 | -5.01847690704499e-05, 300 | 0.3093907020261365, 301 | -0.09157078114662642, 302 | -0.02503421651721971, 303 | 0.16837182003883275, 304 | -0.14478805603434844, 305 | 0.16957872011022473, 306 | -0.015161613787746811, 307 | 0.032809631791753, 308 | 0.020751056200894374, 309 | -0.04747944174933259, 310 | -0.10083012292375632, 311 | 7.539278954188814e-05, 312 | -0.05533932242878507, 313 | -0.004891306880385402 314 | ], 315 | [ 316 | 0.20032692769045246, 317 | 0.07834453204719004, 318 | 0.25419035422008945, 319 | 0.2658972887411767, 320 | 0.22839002440622322, 321 | -0.23994551285708063, 322 | 0.025338435976407694, 323 | 0.00014884244251332508, 324 | -0.2175791176584303, 325 | 0.10345944573304629, 326 | 0.3510409133931134, 327 | -0.01079654384392329, 328 | -3.2835213845233195e-05, 329 | 0.03706136805627769, 330 | 0.03618205502874074, 331 | -0.09204598437600146, 332 | 0.002913869795802729, 333 | 0.0021609280549776417, 334 | -4.265392800701038e-06, 335 | -0.2635477206681438, 336 | 0.26428561464236994, 337 | -0.064380265087605, 338 | 0.3463501323773422, 339 | -0.0007530218601647566, 340 | -0.13186082841646496, 341 | 0.3045271222725004, 342 | -0.17296842664570758, 343 | 0.005052907404203668, 344 | 0.03691295125290632, 345 | 0.1450161671854197, 346 | 0.049299650931361086, 347 | -0.2844971733625897, 348 | 0.06830525138960261, 349 | 0.0049697146211907265, 350 | -0.09296015174116302, 351 | 0.11383901985358744, 352 | -0.07643076434638699, 353 | 0.26979735703097285, 354 | 0.05215681285916623, 355 | -0.27460626537988864, 356 | 0.1287472221353317, 357 | -0.29660871544051726, 358 | 0.16159804944810266, 359 | 0.2389147618749262, 360 | 0.06124188869453518, 361 | -0.2807904222299568, 362 | -0.3244011002812804, 363 | -0.017013599152415092, 364 | 0.029454555874249905, 365 | 6.582543823780013e-05, 366 | 0.02320885985274779, 367 | -0.12986459981212792, 368 | -0.3257608266463189, 369 | -0.2824607065406284, 370 | 0.004626747961577279, 371 | 0.0776458131924303, 372 | -0.004443883906724035, 373 | -6.456727819637546e-05, 374 | -0.29523288884079135, 375 | 0.3213950433787457, 376 | -0.05650599550078138, 377 | -0.01682913233006902, 378 | -0.08472262498128542, 379 | 0.34631403545130884, 380 | 0.11111060425935956, 381 | 0.06387884640668823, 382 | 0.0006287704781581103, 383 | 0.00038330272889934623, 384 | -0.1443572756902572, 385 | 0.30572883159815273, 386 | 0.08548057059220236, 387 | -0.016015061318818073, 388 | 0.28184242220422306, 389 | -5.3467511055062155e-05, 390 | 0.23383006917409274, 391 | -0.16903102533219005, 392 | -0.0005328750354015457, 393 | 0.29594933591878053, 394 | 0.3663835484534536, 395 | 0.0008059905145645758, 396 | 0.03278582771132021, 397 | 0.083264691972632, 398 | 0.06709361890276563, 399 | -0.05036955492821752, 400 | -0.14509089548055026, 401 | -0.0786953942544462, 402 | 0.017136403467781745, 403 | -0.04118391623093935, 404 | 0.05198031095220931, 405 | 0.22351125198019497, 406 | -0.053151943554308495, 407 | 0.3341275479534796, 408 | -0.10083449296562627, 409 | -0.2734507404470314, 410 | -0.04813472019627444, 411 | -0.30714224389138567, 412 | -0.09799252820533784, 413 | 0.0019244209168322818, 414 | 0.005865577525659862, 415 | 0.0007176967934213062 416 | ] 417 | ], 418 | [ 419 | [ 420 | -0.3033784652586513, 421 | 0.21428287450719957, 422 | 0.12038299434394428 423 | ], 424 | [ 425 | 0.0878756848790385, 426 | 0.0077029008837985365, 427 | -0.015245492465667407 428 | ], 429 | [ 430 | -0.08025416472821838, 431 | -0.3289408761227014, 432 | -0.08009857139763839 433 | ], 434 | [ 435 | -0.2786480008793938, 436 | 0.2041118970775391, 437 | 0.13345397605030943 438 | ], 439 | [ 440 | -0.04368467425165618, 441 | 0.050077995251817865, 442 | -0.016212206204633463 443 | ], 444 | [ 445 | 0.40100425791107064, 446 | -0.18038944385894284, 447 | 0.013946646824691452 448 | ], 449 | [ 450 | -0.32056419169234773, 451 | -0.12486415368366657, 452 | 0.07672273941012032 453 | ], 454 | [ 455 | 0.07413503200986336, 456 | -0.08299898821774776, 457 | 0.09934618090576591 458 | ], 459 | [ 460 | 0.006266564937561657, 461 | -0.31957526398881203, 462 | -0.11803713040764242 463 | ], 464 | [ 465 | 0.2925292827100023, 466 | -0.14014354548917807, 467 | -0.22564636375713767 468 | ], 469 | [ 470 | -0.2497987044164128, 471 | -0.017316906299745524, 472 | 0.007561387165670958 473 | ], 474 | [ 475 | -0.011694145808795759, 476 | 0.0008695622865167298, 477 | -0.017331743203415666 478 | ], 479 | [ 480 | 0.06701562409908578, 481 | -0.003821079880632609, 482 | 0.01397153799186262 483 | ], 484 | [ 485 | 0.0817097132155213, 486 | -0.01965195411506342, 487 | -0.07104453918976245 488 | ], 489 | [ 490 | 0.07344009799132317, 491 | 0.0744824884871679, 492 | -0.08946753271816582 493 | ], 494 | [ 495 | -0.010561351443075219, 496 | 0.024354304766031697, 497 | -0.0001406266483356265 498 | ], 499 | [ 500 | -0.0010935398649763355, 501 | 0.10069807307555767, 502 | 0.000635263795200516 503 | ], 504 | [ 505 | 0.0006531190885117661, 506 | 6.424754058750958e-05, 507 | -0.048055667436300374 508 | ], 509 | [ 510 | -0.04422459688690375, 511 | -0.02774540074489079, 512 | -0.04690252785541435 513 | ], 514 | [ 515 | -0.0047624956425191284, 516 | 0.10472159933321387, 517 | -0.1605449110508165 518 | ], 519 | [ 520 | -0.12695234977214, 521 | -0.052716828300197645, 522 | -0.05338579152175423 523 | ], 524 | [ 525 | -0.0886887988202316, 526 | 0.005582042083934192, 527 | -0.06298083853492165 528 | ], 529 | [ 530 | -0.19609089943310032, 531 | 0.05940420384594951, 532 | 0.3049730502313931 533 | ], 534 | [ 535 | 0.17884424587791156, 536 | -0.19749792534668423, 537 | 0.165106679381631 538 | ], 539 | [ 540 | 0.17875725123936953, 541 | 0.1911063545873048, 542 | 0.02870619470380533 543 | ], 544 | [ 545 | -0.041763783287708765, 546 | -0.020764727658490686, 547 | 0.1297482094400543 548 | ], 549 | [ 550 | 0.1304943194026293, 551 | 0.27077643698288173, 552 | -0.3143030880481478 553 | ], 554 | [ 555 | 0.0793533113323326, 556 | -0.07848916546044134, 557 | 0.021882047313915638 558 | ], 559 | [ 560 | 0.18923377201535957, 561 | -0.057662747927841373, 562 | 0.1538766991247922 563 | ], 564 | [ 565 | 0.2338723586086386, 566 | -0.303918599054213, 567 | -0.03587521163891008 568 | ], 569 | [ 570 | -0.07417189928446007, 571 | 0.04710019309346903, 572 | 0.013767072996339922 573 | ], 574 | [ 575 | 0.153393593393114, 576 | 0.233399580979507, 577 | -0.26140302744906346 578 | ], 579 | [ 580 | 0.04441826401522207, 581 | -0.017201244704433228, 582 | -6.2171551327930725e-06 583 | ], 584 | [ 585 | -0.013818105413396854, 586 | 0.04690611051496756, 587 | -0.10966725954451424 588 | ], 589 | [ 590 | 0.03613396625563348, 591 | 0.01423330979575789, 592 | 0.057032775757015215 593 | ], 594 | [ 595 | -0.02347673168601549, 596 | -0.010759376226688142, 597 | -0.27241647931701946 598 | ], 599 | [ 600 | 0.0655192736710493, 601 | -0.012670851330512916, 602 | -0.008655934531484333 603 | ], 604 | [ 605 | 0.06478739346242625, 606 | -0.20977791767369258, 607 | 0.07532792452123128 608 | ], 609 | [ 610 | 0.11203923363744726, 611 | 0.07534562519554548, 612 | -0.20199658989218952 613 | ], 614 | [ 615 | 0.03817356631946901, 616 | 0.13480835877314035, 617 | -0.18177001032689535 618 | ], 619 | [ 620 | -0.344890586635857, 621 | 0.008566895726590397, 622 | 0.3171363846632408 623 | ], 624 | [ 625 | 0.04234821489863139, 626 | 0.2722989809864901, 627 | -0.12541719266268184 628 | ], 629 | [ 630 | -0.2805708257313667, 631 | -0.12396497247062845, 632 | -0.04244321928678528 633 | ], 634 | [ 635 | -0.07587455830299668, 636 | 0.09548695520401311, 637 | 0.18513478095128172 638 | ], 639 | [ 640 | -0.0971050660381392, 641 | -0.055039633756272695, 642 | 0.056872916590691706 643 | ], 644 | [ 645 | 0.24480749540641172, 646 | -0.124929236546824, 647 | -0.2357939801288859 648 | ], 649 | [ 650 | 0.11249955551261129, 651 | 0.02184545603784175, 652 | -0.23785295230110315 653 | ], 654 | [ 655 | -0.2613090385892601, 656 | -0.22688028529072712, 657 | 0.12987059696886075 658 | ], 659 | [ 660 | -0.019788948490409953, 661 | -0.0003162291659877188, 662 | -0.0018721283960839838 663 | ], 664 | [ 665 | -0.002269395380380751, 666 | 0.0001444833731251187, 667 | -0.037751448458580125 668 | ], 669 | [ 670 | -0.16506707489949737, 671 | 0.2643786152975958, 672 | 0.0904785851985554 673 | ], 674 | [ 675 | 0.05573299542355352, 676 | -0.0652510575333608, 677 | 0.1854973009374366 678 | ], 679 | [ 680 | 0.3701445056535994, 681 | 0.24563449068340287, 682 | -0.11621072910870815 683 | ], 684 | [ 685 | 0.120817223359239, 686 | -0.28273315596430204, 687 | -0.23763679117510578 688 | ], 689 | [ 690 | 0.050996451007578755, 691 | 0.06760111639417052, 692 | -0.02342300459027115 693 | ], 694 | [ 695 | 0.06391371029521842, 696 | -0.19998819912232263, 697 | 0.09419131641271013 698 | ], 699 | [ 700 | 0.017681019516036317, 701 | 0.10327981062833465, 702 | 0.051935806412108494 703 | ], 704 | [ 705 | 0.050009999731250344, 706 | 0.17925800804813544, 707 | 0.10576819348727802 708 | ], 709 | [ 710 | 0.301212349247507, 711 | 0.10958334921074243, 712 | -0.22218183438961403 713 | ], 714 | [ 715 | -0.07905601097858331, 716 | 0.08699179275560584, 717 | 0.2502458423752894 718 | ], 719 | [ 720 | -0.07893197722162644, 721 | 0.2119804129688478, 722 | 0.07594780662308599 723 | ], 724 | [ 725 | -0.19442394225347664, 726 | -0.24365980852864827, 727 | 0.013213969727041277 728 | ], 729 | [ 730 | -0.08140186183481356, 731 | 0.3058151580167791, 732 | -0.06552299870458697 733 | ], 734 | [ 735 | -0.28545192226993604, 736 | -0.12528499481447714, 737 | 0.21498178262091888 738 | ], 739 | [ 740 | 0.015816551669369076, 741 | 0.26875579764169105, 742 | -0.11312277861957883 743 | ], 744 | [ 745 | 0.16780975644584448, 746 | 0.07107990396874635, 747 | 0.19569973923719822 748 | ], 749 | [ 750 | -0.01529949581743202, 751 | 0.0011599265262120415, 752 | 0.09023528774185002 753 | ], 754 | [ 755 | 0.04410094944252845, 756 | -0.06727807182241088, 757 | 0.0008213736830681489 758 | ], 759 | [ 760 | -0.07518408306692101, 761 | 0.019896425193250876, 762 | -0.2767445016147709 763 | ], 764 | [ 765 | -0.3116805980105834, 766 | -0.07738293574876165, 767 | 0.05961433227879092 768 | ], 769 | [ 770 | -0.06119073246354519, 771 | 0.006467498402016148, 772 | 0.1668229314831908 773 | ], 774 | [ 775 | -0.03391824769818817, 776 | -0.009558445228608126, 777 | -0.006769819976150405 778 | ], 779 | [ 780 | 0.07380400786907695, 781 | -0.14736393068957587, 782 | 0.25396831130331143 783 | ], 784 | [ 785 | -0.08020163673129331, 786 | 0.06768756250854971, 787 | -0.013276700009527295 788 | ], 789 | [ 790 | -0.30691354770884266, 791 | -0.22960472093705525, 792 | 0.027122977167975664 793 | ], 794 | [ 795 | 0.2736864988775898, 796 | 0.2425473229454834, 797 | 0.03162408749436578 798 | ], 799 | [ 800 | -0.0009368913513272167, 801 | -0.06671939038896361, 802 | 0.01845706103490739 803 | ], 804 | [ 805 | -0.0032957001228602653, 806 | -0.2215366200154537, 807 | 0.13746735046978134 808 | ], 809 | [ 810 | -0.2690574923482806, 811 | -0.188179840169756, 812 | -0.01941611147628747 813 | ], 814 | [ 815 | 0.09232622605446568, 816 | -0.013619023383817284, 817 | 0.0728504051082172 818 | ], 819 | [ 820 | -0.0922966596184843, 821 | -0.17144501750714689, 822 | -0.24893084912791255 823 | ], 824 | [ 825 | 0.05988114670267713, 826 | -0.03382239910565614, 827 | 0.0981944977274642 828 | ], 829 | [ 830 | -0.0656848704658892, 831 | 0.0669229637488095, 832 | 0.032862387153292094 833 | ], 834 | [ 835 | -0.18749469519295264, 836 | 0.3397560144862, 837 | 0.2698424956899208 838 | ], 839 | [ 840 | 0.2836362648524062, 841 | 0.09640083024531139, 842 | 0.11731070274482404 843 | ], 844 | [ 845 | -0.06311914355976968, 846 | 0.024714384124775866, 847 | 0.06111758610916221 848 | ], 849 | [ 850 | -0.08981702754478255, 851 | 0.1254419470172283, 852 | 0.33303180089464096 853 | ], 854 | [ 855 | -0.01488246394269484, 856 | -0.043148439231868965, 857 | 0.06508996884515214 858 | ], 859 | [ 860 | -0.050504028750196654, 861 | 7.483885016862738e-05, 862 | 0.05820242162117114 863 | ], 864 | [ 865 | 0.14292154734262003, 866 | 0.07785562263642798, 867 | 0.11504347091641547 868 | ], 869 | [ 870 | 0.00041020017829782713, 871 | 5.4422814730374584e-05, 872 | 0.003333750601676967 873 | ], 874 | [ 875 | -0.30866130513052564, 876 | -0.05755710324933142, 877 | 0.14709836461215403 878 | ], 879 | [ 880 | 0.035887606911915206, 881 | 0.09839586877142036, 882 | 0.0029200879588277147 883 | ], 884 | [ 885 | 0.02929477626739368, 886 | 0.022053534392534, 887 | -0.06856048983665933 888 | ], 889 | [ 890 | 0.07878305734851247, 891 | 0.005297078676139924, 892 | -0.0258570191587478 893 | ], 894 | [ 895 | 0.3659610698511386, 896 | 0.2368900303823268, 897 | -0.2673380115574881 898 | ], 899 | [ 900 | -0.02752270022828956, 901 | -0.00018161749063796336, 902 | -7.995790821672238e-05 903 | ], 904 | [ 905 | 0.05161185060957482, 906 | 0.04341702342033817, 907 | 0.044230063425248364 908 | ], 909 | [ 910 | 0.050438412036662855, 911 | -0.03387134337185776, 912 | 0.17405359090201922 913 | ], 914 | [ 915 | -0.03462623124907428, 916 | 0.0016347034151533934, 917 | -0.08179225432290875 918 | ] 919 | ] 920 | ], 921 | "intercepts_": [ 922 | [ 923 | 0.15528921788807937, 924 | -0.051348943374479046, 925 | -0.015484318464805753, 926 | -0.006154025167262611, 927 | 0.1607279908512673, 928 | -0.022093034285868327, 929 | 0.004745796244861899, 930 | -0.05663716831707216, 931 | 0.13076340968639824, 932 | 0.008531955384677317, 933 | -0.07489920036541643, 934 | -0.013051562339722224, 935 | -0.08278028717737074, 936 | -0.05726666086598528, 937 | -0.06328171628382373, 938 | -0.08223963591772915, 939 | -0.09145798536347888, 940 | -0.02858748717481487, 941 | -0.048020467571916345, 942 | 0.15763910163766356, 943 | 0.02067496205650228, 944 | 0.011174464098339236, 945 | -0.007367363575172879, 946 | 0.2063931635573357, 947 | 0.27717957609638316, 948 | 0.16485193835028863, 949 | 0.17595327853829917, 950 | 0.0020543265417801207, 951 | 0.1581877603390459, 952 | -0.09199075712696372, 953 | -0.028470357693378776, 954 | 0.25019908968634696, 955 | -0.061022055910066104, 956 | -0.03738007887698059, 957 | -0.10666907292809003, 958 | 0.15262038774935105, 959 | 0.00023734900843799914, 960 | 0.19856824545061977, 961 | 0.25773206983974545, 962 | 0.14982505682980082, 963 | -0.11873068291112246, 964 | 0.2249584927470832, 965 | -0.09663927762627945, 966 | -0.019514838746269185, 967 | -0.0403352532266673, 968 | 0.3258692008524919, 969 | 0.25178388585822425, 970 | -0.022369735896329283, 971 | 0.01835085105797823, 972 | -0.02389518183587461, 973 | 0.15141404568297415, 974 | -0.029295226835784827, 975 | 0.2694146810936162, 976 | 0.031679009216359286, 977 | -0.09949999975268445, 978 | 0.0961667033019178, 979 | 0.01566530415528046, 980 | 0.19816458473724313, 981 | 0.20160809872788155, 982 | -0.08878077570159781, 983 | 0.169951019841758, 984 | -0.04241194493024096, 985 | 0.06470354550186029, 986 | 0.17767805489441582, 987 | 0.23960022753956742, 988 | -0.14393412814837675, 989 | -0.0016439036992576088, 990 | -0.013269704331111134, 991 | 0.007606061680264684, 992 | 0.06287616679519636, 993 | 0.19743332236992142, 994 | -0.0842967935726935, 995 | -0.05617835914710142, 996 | -0.08103320763429706, 997 | 0.11164751669166299, 998 | 0.2564096776745225, 999 | -0.047258468184272116, 1000 | -0.2025037179492077, 1001 | -0.006548143093006502, 1002 | -0.10433531684136048, 1003 | 0.017282093742604032, 1004 | -0.08909898898727003, 1005 | -0.10381400507012543, 1006 | -0.08382161885934289, 1007 | 0.19795269071617916, 1008 | -0.03372934203119454, 1009 | 0.04450510378293357, 1010 | -0.045737934186959144, 1011 | -0.002888558611025295, 1012 | -0.2520278025018951, 1013 | -0.02573669379360423, 1014 | 0.06006435460815241, 1015 | 0.0008685076944091963, 1016 | 0.20830313042159848, 1017 | -0.01964126229503425, 1018 | 0.0922244009367758, 1019 | -0.00023971656836038643, 1020 | -0.010180008701154576, 1021 | 0.15007448197333143, 1022 | -0.00155057980876858 1023 | ], 1024 | [ 1025 | -0.23120819016397617, 1026 | -0.10080519661271337, 1027 | -0.2799668784091283, 1028 | -0.016113703351880452, 1029 | 0.06742081138778684, 1030 | 0.11969046453484401, 1031 | -0.08453533189553147, 1032 | 0.0057393491481020666, 1033 | 0.24950554692248522, 1034 | 0.3341988400458354, 1035 | 0.07075665410136395, 1036 | -6.730113625737044e-05, 1037 | -0.002213357109878309, 1038 | 0.00039092524761039706, 1039 | 0.05695902161120508, 1040 | -0.06202135249137846, 1041 | -0.004770166018676059, 1042 | -0.01111170427712711, 1043 | -0.015432570365309166, 1044 | 0.09770478463484251, 1045 | 0.15394662704096035, 1046 | -0.03937450759350129, 1047 | 0.0002788153587719878, 1048 | 0.21677019102256032, 1049 | 0.08297878175561714, 1050 | 0.16753094569726265, 1051 | 0.0722229482653414, 1052 | -0.001386295855654879, 1053 | -0.10288742249385131, 1054 | 0.25124859418822376, 1055 | -0.024929576350638378, 1056 | 0.2131301152430547, 1057 | -0.014745747673351834, 1058 | 0.0012354012540339195, 1059 | -0.08124683549794859, 1060 | 0.06188485306352519, 1061 | -0.02715107541185857, 1062 | 0.07398120607340936, 1063 | -0.13570213799194267, 1064 | 0.14825938452887474, 1065 | 0.005880841571499457, 1066 | -0.09388025649264184, 1067 | 0.06716865459102032, 1068 | -0.043328582958752006, 1069 | 0.11314853771971922, 1070 | 0.3390005612323912, 1071 | 0.3162488779199575, 1072 | -0.1634453907311029, 1073 | -0.050770109183584836, 1074 | 0.016057772129419483, 1075 | -0.1900696105575038, 1076 | 0.12860835205713114, 1077 | 0.0040878417163702245, 1078 | 0.16139951644241574, 1079 | 0.0026451980379299826, 1080 | 0.1812569624060151, 1081 | -0.09609919467875051, 1082 | -0.21787011812702034, 1083 | 0.019193207787767202, 1084 | 0.10610747200344524, 1085 | -0.10723778884261641, 1086 | 0.09275346191454922, 1087 | -0.05039797079609277, 1088 | -0.26765741736969023, 1089 | -0.12055784954459887, 1090 | 0.11436216721488726, 1091 | -0.042394767452481434, 1092 | -0.01285329740617977, 1093 | 0.2232672357726687, 1094 | -0.10580619976557562, 1095 | -0.2749792603281721, 1096 | -0.016074239071821584, 1097 | 0.14137764654423485, 1098 | -0.00032101903307379877, 1099 | -0.17194654373814547, 1100 | 0.006066320864218669, 1101 | 0.028239076805497188, 1102 | 0.08951494146450338, 1103 | -0.2037739874705276, 1104 | 0.036383745828464605, 1105 | 0.23277395367096398, 1106 | -0.002780218944138348, 1107 | 0.001986201193845198, 1108 | -0.032544328604484835, 1109 | 0.18160670253902683, 1110 | -0.07716310133288036, 1111 | -0.18665023791959162, 1112 | -0.06810334678952876, 1113 | 0.023543568159893093, 1114 | 0.04021838415983708, 1115 | 0.049873325509145486, 1116 | -0.21521570710239477, 1117 | -0.05189718189989805, 1118 | 0.21808332427925833, 1119 | -0.04135735279361817, 1120 | 0.14949033827906258, 1121 | -4.0135230037368e-05, 1122 | -0.03167497754186829, 1123 | -0.06158945390187105, 1124 | 0.006451301889480014 1125 | ], 1126 | [ 1127 | 0.10885392264746117, 1128 | -0.010177926519645067, 1129 | 0.17328372957204466, 1130 | 0.2440648705094329, 1131 | -0.12973260745515638, 1132 | -0.05127429079494167, 1133 | 0.3083281759544819, 1134 | 0.010701847603862436, 1135 | -0.30390961312850195, 1136 | -0.2574699790000819, 1137 | 0.30590259396240965, 1138 | 0.00027478348404787856, 1139 | 0.02136529191328369, 1140 | 0.004423114477531373, 1141 | -0.0009681375846047194, 1142 | 0.01788055398970543, 1143 | -0.0895832467453483, 1144 | -0.09250074530284963, 1145 | -0.01117217332309584, 1146 | 0.12878334498577143, 1147 | 0.1003838846848103, 1148 | -0.09436066404567445, 1149 | 0.11875567928485639, 1150 | -0.011992998692803595, 1151 | -0.2972123510543796, 1152 | -0.05223292511089602, 1153 | -0.135295402292331, 1154 | -0.10403980656295264, 1155 | -0.24018613610423603, 1156 | -0.057096741341333634, 1157 | 0.00357124583563903, 1158 | 0.052801006926373475, 1159 | -0.09474906358956449, 1160 | 0.01896622024122202, 1161 | -0.07334692012545607, 1162 | -0.25502556049650865, 1163 | -0.09907494005407837, 1164 | -0.230464269512323, 1165 | 0.15719300831168678, 1166 | -0.10721692113583721, 1167 | 0.3393599396126433, 1168 | -0.035317417340452587, 1169 | 0.3635069037555956, 1170 | 0.23551475649100412, 1171 | 0.17912248733825342, 1172 | -0.3385258949315411, 1173 | -0.2661811283055575, 1174 | 0.33916440102228024, 1175 | -0.060986901483291216, 1176 | -0.10174269411050961, 1177 | 0.2958869274388836, 1178 | -0.22511332788974545, 1179 | -0.17210783807897947, 1180 | -0.14681080695467327, 1181 | 0.001026233018780767, 1182 | 0.12246180026150258, 1183 | -0.002803071647430293, 1184 | 0.04816827742267984, 1185 | -0.04983486014023779, 1186 | 0.1865166036737075, 1187 | 0.01583028746236208, 1188 | -0.09443046418025211, 1189 | 0.0389517235474193, 1190 | 0.03385636570581815, 1191 | -0.12990334925667318, 1192 | -0.002815286880260506, 1193 | -0.09069044086711298, 1194 | -0.09536013698940903, 1195 | 0.08348514307406878, 1196 | 0.19331735742036554, 1197 | -0.17662209805042783, 1198 | -0.04659067645762726, 1199 | 0.23635715893830994, 1200 | -0.0013883723488345822, 1201 | 0.10180855701408542, 1202 | -0.03914815978194073, 1203 | -0.049084320917179236, 1204 | 0.22231009852401593, 1205 | 0.33085471815702794, 1206 | 0.0017924065463350573, 1207 | 0.04049479227982597, 1208 | -0.045629907338368164, 1209 | 0.004780733527205932, 1210 | 0.2449766683647694, 1211 | -0.09345337697717553, 1212 | -5.01847690704499e-05, 1213 | 0.3093907020261365, 1214 | -0.09157078114662642, 1215 | -0.02503421651721971, 1216 | 0.16837182003883275, 1217 | -0.14478805603434844, 1218 | 0.16957872011022473, 1219 | -0.015161613787746811, 1220 | 0.032809631791753, 1221 | 0.020751056200894374, 1222 | -0.04747944174933259, 1223 | -0.10083012292375632, 1224 | 7.539278954188814e-05, 1225 | -0.05533932242878507, 1226 | -0.004891306880385402 1227 | ], 1228 | [ 1229 | 0.20032692769045246, 1230 | 0.07834453204719004, 1231 | 0.25419035422008945, 1232 | 0.2658972887411767, 1233 | 0.22839002440622322, 1234 | -0.23994551285708063, 1235 | 0.025338435976407694, 1236 | 0.00014884244251332508, 1237 | -0.2175791176584303, 1238 | 0.10345944573304629, 1239 | 0.3510409133931134, 1240 | -0.01079654384392329, 1241 | -3.2835213845233195e-05, 1242 | 0.03706136805627769, 1243 | 0.03618205502874074, 1244 | -0.09204598437600146, 1245 | 0.002913869795802729, 1246 | 0.0021609280549776417, 1247 | -4.265392800701038e-06, 1248 | -0.2635477206681438, 1249 | 0.26428561464236994, 1250 | -0.064380265087605, 1251 | 0.3463501323773422, 1252 | -0.0007530218601647566, 1253 | -0.13186082841646496, 1254 | 0.3045271222725004, 1255 | -0.17296842664570758, 1256 | 0.005052907404203668, 1257 | 0.03691295125290632, 1258 | 0.1450161671854197, 1259 | 0.049299650931361086, 1260 | -0.2844971733625897, 1261 | 0.06830525138960261, 1262 | 0.0049697146211907265, 1263 | -0.09296015174116302, 1264 | 0.11383901985358744, 1265 | -0.07643076434638699, 1266 | 0.26979735703097285, 1267 | 0.05215681285916623, 1268 | -0.27460626537988864, 1269 | 0.1287472221353317, 1270 | -0.29660871544051726, 1271 | 0.16159804944810266, 1272 | 0.2389147618749262, 1273 | 0.06124188869453518, 1274 | -0.2807904222299568, 1275 | -0.3244011002812804, 1276 | -0.017013599152415092, 1277 | 0.029454555874249905, 1278 | 6.582543823780013e-05, 1279 | 0.02320885985274779, 1280 | -0.12986459981212792, 1281 | -0.3257608266463189, 1282 | -0.2824607065406284, 1283 | 0.004626747961577279, 1284 | 0.0776458131924303, 1285 | -0.004443883906724035, 1286 | -6.456727819637546e-05, 1287 | -0.29523288884079135, 1288 | 0.3213950433787457, 1289 | -0.05650599550078138, 1290 | -0.01682913233006902, 1291 | -0.08472262498128542, 1292 | 0.34631403545130884, 1293 | 0.11111060425935956, 1294 | 0.06387884640668823, 1295 | 0.0006287704781581103, 1296 | 0.00038330272889934623, 1297 | -0.1443572756902572, 1298 | 0.30572883159815273, 1299 | 0.08548057059220236, 1300 | -0.016015061318818073, 1301 | 0.28184242220422306, 1302 | -5.3467511055062155e-05, 1303 | 0.23383006917409274, 1304 | -0.16903102533219005, 1305 | -0.0005328750354015457, 1306 | 0.29594933591878053, 1307 | 0.3663835484534536, 1308 | 0.0008059905145645758, 1309 | 0.03278582771132021, 1310 | 0.083264691972632, 1311 | 0.06709361890276563, 1312 | -0.05036955492821752, 1313 | -0.14509089548055026, 1314 | -0.0786953942544462, 1315 | 0.017136403467781745, 1316 | -0.04118391623093935, 1317 | 0.05198031095220931, 1318 | 0.22351125198019497, 1319 | -0.053151943554308495, 1320 | 0.3341275479534796, 1321 | -0.10083449296562627, 1322 | -0.2734507404470314, 1323 | -0.04813472019627444, 1324 | -0.30714224389138567, 1325 | -0.09799252820533784, 1326 | 0.0019244209168322818, 1327 | 0.005865577525659862, 1328 | 0.0007176967934213062 1329 | ] 1330 | ], 1331 | "activation": "relu", 1332 | "out_activation": "softmax", 1333 | "layers": [ 1334 | 100, 1335 | 3 1336 | ], 1337 | "__meta__": { 1338 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 1339 | "__sklearn_version": "0.21.2", 1340 | "__classifier": "MLPClassifier", 1341 | "__author": "alex", 1342 | "__dt": "2019-07-20T20:56:49.554503" 1343 | } 1344 | } -------------------------------------------------------------------------------- /example/models/nbc.json: -------------------------------------------------------------------------------- 1 | { 2 | "theta_": [ 3 | [ 4 | 5.005999999999999, 5 | 3.428000000000001, 6 | 1.4620000000000002, 7 | 0.2459999999999999 8 | ], 9 | [ 10 | 5.936, 11 | 2.7700000000000005, 12 | 4.26, 13 | 1.3259999999999998 14 | ], 15 | [ 16 | 6.587999999999998, 17 | 2.9739999999999998, 18 | 5.552, 19 | 2.026 20 | ] 21 | ], 22 | "sigma_": [ 23 | [ 24 | 0.12176400309550259, 25 | 0.14081600309550263, 26 | 0.029556003095502676, 27 | 0.010884003095502673 28 | ], 29 | [ 30 | 0.2611040030955028, 31 | 0.09650000309550268, 32 | 0.21640000309550278, 33 | 0.03832400309550265 34 | ], 35 | [ 36 | 0.39625600309550263, 37 | 0.10192400309550273, 38 | 0.2984960030955029, 39 | 0.07392400309550265 40 | ] 41 | ], 42 | "class_prior_": [ 43 | 0.3333333333333333, 44 | 0.3333333333333333, 45 | 0.3333333333333333 46 | ], 47 | "classes_": [ 48 | 0, 49 | 1, 50 | 2 51 | ], 52 | "__meta__": { 53 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 54 | "__sklearn_version": "0.21.2", 55 | "__classifier": "GaussianNB", 56 | "__author": "alex", 57 | "__dt": "2019-07-12T23:18:47.173832" 58 | } 59 | } -------------------------------------------------------------------------------- /example/models/randomforest.json: -------------------------------------------------------------------------------- 1 | { 2 | "classes_": [ 3 | 0, 4 | 1, 5 | 2 6 | ], 7 | "dtrees": [ 8 | { 9 | "children_left": [ 10 | 1, 11 | -1, 12 | 3, 13 | 4, 14 | -1, 15 | 6, 16 | -1, 17 | -1, 18 | 9, 19 | 10, 20 | -1, 21 | -1, 22 | -1 23 | ], 24 | "children_right": [ 25 | 2, 26 | -1, 27 | 8, 28 | 5, 29 | -1, 30 | 7, 31 | -1, 32 | -1, 33 | 12, 34 | 11, 35 | -1, 36 | -1, 37 | -1 38 | ], 39 | "threshold": [ 40 | 0.7000000029802322, 41 | -2.0, 42 | 4.8500001430511475, 43 | 1.6500000357627869, 44 | -2.0, 45 | 5.400000095367432, 46 | -2.0, 47 | -2.0, 48 | 5.1499998569488525, 49 | 1.75, 50 | -2.0, 51 | -2.0, 52 | -2.0 53 | ], 54 | "feature": [ 55 | 3, 56 | -2, 57 | 2, 58 | 3, 59 | -2, 60 | 0, 61 | -2, 62 | -2, 63 | 2, 64 | 3, 65 | -2, 66 | -2, 67 | -2 68 | ], 69 | "classes_": [ 70 | 0.0, 71 | 1.0, 72 | 2.0 73 | ], 74 | "value": [ 75 | [ 76 | 46.0, 77 | 58.0, 78 | 46.0 79 | ], 80 | [ 81 | 46.0, 82 | 0.0, 83 | 0.0 84 | ], 85 | [ 86 | 0.0, 87 | 58.0, 88 | 46.0 89 | ], 90 | [ 91 | 0.0, 92 | 55.0, 93 | 2.0 94 | ], 95 | [ 96 | 0.0, 97 | 54.0, 98 | 0.0 99 | ], 100 | [ 101 | 0.0, 102 | 1.0, 103 | 2.0 104 | ], 105 | [ 106 | 0.0, 107 | 0.0, 108 | 2.0 109 | ], 110 | [ 111 | 0.0, 112 | 1.0, 113 | 0.0 114 | ], 115 | [ 116 | 0.0, 117 | 3.0, 118 | 44.0 119 | ], 120 | [ 121 | 0.0, 122 | 3.0, 123 | 10.0 124 | ], 125 | [ 126 | 0.0, 127 | 3.0, 128 | 0.0 129 | ], 130 | [ 131 | 0.0, 132 | 0.0, 133 | 10.0 134 | ], 135 | [ 136 | 0.0, 137 | 0.0, 138 | 34.0 139 | ] 140 | ] 141 | }, 142 | { 143 | "children_left": [ 144 | 1, 145 | -1, 146 | 3, 147 | 4, 148 | -1, 149 | 6, 150 | 7, 151 | -1, 152 | -1, 153 | -1, 154 | -1 155 | ], 156 | "children_right": [ 157 | 2, 158 | -1, 159 | 10, 160 | 5, 161 | -1, 162 | 9, 163 | 8, 164 | -1, 165 | -1, 166 | -1, 167 | -1 168 | ], 169 | "threshold": [ 170 | 2.449999988079071, 171 | -2.0, 172 | 5.049999952316284, 173 | 4.75, 174 | -2.0, 175 | 6.5, 176 | 1.649999976158142, 177 | -2.0, 178 | -2.0, 179 | -2.0, 180 | -2.0 181 | ], 182 | "feature": [ 183 | 2, 184 | -2, 185 | 2, 186 | 2, 187 | -2, 188 | 0, 189 | 3, 190 | -2, 191 | -2, 192 | -2, 193 | -2 194 | ], 195 | "classes_": [ 196 | 0.0, 197 | 1.0, 198 | 2.0 199 | ], 200 | "value": [ 201 | [ 202 | 43.0, 203 | 61.0, 204 | 46.0 205 | ], 206 | [ 207 | 43.0, 208 | 0.0, 209 | 0.0 210 | ], 211 | [ 212 | 0.0, 213 | 61.0, 214 | 46.0 215 | ], 216 | [ 217 | 0.0, 218 | 61.0, 219 | 4.0 220 | ], 221 | [ 222 | 0.0, 223 | 55.0, 224 | 0.0 225 | ], 226 | [ 227 | 0.0, 228 | 6.0, 229 | 4.0 230 | ], 231 | [ 232 | 0.0, 233 | 1.0, 234 | 4.0 235 | ], 236 | [ 237 | 0.0, 238 | 1.0, 239 | 0.0 240 | ], 241 | [ 242 | 0.0, 243 | 0.0, 244 | 4.0 245 | ], 246 | [ 247 | 0.0, 248 | 5.0, 249 | 0.0 250 | ], 251 | [ 252 | 0.0, 253 | 0.0, 254 | 42.0 255 | ] 256 | ] 257 | }, 258 | { 259 | "children_left": [ 260 | 1, 261 | -1, 262 | 3, 263 | -1, 264 | 5, 265 | 6, 266 | 7, 267 | 8, 268 | -1, 269 | -1, 270 | -1, 271 | -1, 272 | 13, 273 | -1, 274 | -1 275 | ], 276 | "children_right": [ 277 | 2, 278 | -1, 279 | 4, 280 | -1, 281 | 12, 282 | 11, 283 | 10, 284 | 9, 285 | -1, 286 | -1, 287 | -1, 288 | -1, 289 | 14, 290 | -1, 291 | -1 292 | ], 293 | "threshold": [ 294 | 0.800000011920929, 295 | -2.0, 296 | 4.75, 297 | -2.0, 298 | 3.049999952316284, 299 | 1.75, 300 | 5.349999904632568, 301 | 1.550000011920929, 302 | -2.0, 303 | -2.0, 304 | -2.0, 305 | -2.0, 306 | 5.0, 307 | -2.0, 308 | -2.0 309 | ], 310 | "feature": [ 311 | 3, 312 | -2, 313 | 2, 314 | -2, 315 | 1, 316 | 3, 317 | 2, 318 | 3, 319 | -2, 320 | -2, 321 | -2, 322 | -2, 323 | 2, 324 | -2, 325 | -2 326 | ], 327 | "classes_": [ 328 | 0.0, 329 | 1.0, 330 | 2.0 331 | ], 332 | "value": [ 333 | [ 334 | 48.0, 335 | 42.0, 336 | 60.0 337 | ], 338 | [ 339 | 48.0, 340 | 0.0, 341 | 0.0 342 | ], 343 | [ 344 | 0.0, 345 | 42.0, 346 | 60.0 347 | ], 348 | [ 349 | 0.0, 350 | 37.0, 351 | 0.0 352 | ], 353 | [ 354 | 0.0, 355 | 5.0, 356 | 60.0 357 | ], 358 | [ 359 | 0.0, 360 | 2.0, 361 | 43.0 362 | ], 363 | [ 364 | 0.0, 365 | 2.0, 366 | 3.0 367 | ], 368 | [ 369 | 0.0, 370 | 2.0, 371 | 1.0 372 | ], 373 | [ 374 | 0.0, 375 | 0.0, 376 | 1.0 377 | ], 378 | [ 379 | 0.0, 380 | 2.0, 381 | 0.0 382 | ], 383 | [ 384 | 0.0, 385 | 0.0, 386 | 2.0 387 | ], 388 | [ 389 | 0.0, 390 | 0.0, 391 | 40.0 392 | ], 393 | [ 394 | 0.0, 395 | 3.0, 396 | 17.0 397 | ], 398 | [ 399 | 0.0, 400 | 3.0, 401 | 0.0 402 | ], 403 | [ 404 | 0.0, 405 | 0.0, 406 | 17.0 407 | ] 408 | ] 409 | }, 410 | { 411 | "children_left": [ 412 | 1, 413 | -1, 414 | 3, 415 | 4, 416 | -1, 417 | 6, 418 | -1, 419 | 8, 420 | -1, 421 | -1, 422 | 11, 423 | 12, 424 | -1, 425 | -1, 426 | -1 427 | ], 428 | "children_right": [ 429 | 2, 430 | -1, 431 | 10, 432 | 5, 433 | -1, 434 | 7, 435 | -1, 436 | 9, 437 | -1, 438 | -1, 439 | 14, 440 | 13, 441 | -1, 442 | -1, 443 | -1 444 | ], 445 | "threshold": [ 446 | 0.800000011920929, 447 | -2.0, 448 | 1.75, 449 | 4.950000047683716, 450 | -2.0, 451 | 1.550000011920929, 452 | -2.0, 453 | 6.949999809265137, 454 | -2.0, 455 | -2.0, 456 | 4.8500001430511475, 457 | 3.100000023841858, 458 | -2.0, 459 | -2.0, 460 | -2.0 461 | ], 462 | "feature": [ 463 | 3, 464 | -2, 465 | 3, 466 | 2, 467 | -2, 468 | 3, 469 | -2, 470 | 0, 471 | -2, 472 | -2, 473 | 2, 474 | 1, 475 | -2, 476 | -2, 477 | -2 478 | ], 479 | "classes_": [ 480 | 0.0, 481 | 1.0, 482 | 2.0 483 | ], 484 | "value": [ 485 | [ 486 | 43.0, 487 | 56.0, 488 | 51.0 489 | ], 490 | [ 491 | 43.0, 492 | 0.0, 493 | 0.0 494 | ], 495 | [ 496 | 0.0, 497 | 56.0, 498 | 51.0 499 | ], 500 | [ 501 | 0.0, 502 | 54.0, 503 | 5.0 504 | ], 505 | [ 506 | 0.0, 507 | 51.0, 508 | 0.0 509 | ], 510 | [ 511 | 0.0, 512 | 3.0, 513 | 5.0 514 | ], 515 | [ 516 | 0.0, 517 | 0.0, 518 | 4.0 519 | ], 520 | [ 521 | 0.0, 522 | 3.0, 523 | 1.0 524 | ], 525 | [ 526 | 0.0, 527 | 3.0, 528 | 0.0 529 | ], 530 | [ 531 | 0.0, 532 | 0.0, 533 | 1.0 534 | ], 535 | [ 536 | 0.0, 537 | 2.0, 538 | 46.0 539 | ], 540 | [ 541 | 0.0, 542 | 2.0, 543 | 1.0 544 | ], 545 | [ 546 | 0.0, 547 | 0.0, 548 | 1.0 549 | ], 550 | [ 551 | 0.0, 552 | 2.0, 553 | 0.0 554 | ], 555 | [ 556 | 0.0, 557 | 0.0, 558 | 45.0 559 | ] 560 | ] 561 | }, 562 | { 563 | "children_left": [ 564 | 1, 565 | -1, 566 | 3, 567 | -1, 568 | 5, 569 | 6, 570 | 7, 571 | -1, 572 | 9, 573 | -1, 574 | 11, 575 | -1, 576 | -1, 577 | -1, 578 | 15, 579 | 16, 580 | -1, 581 | 18, 582 | -1, 583 | -1, 584 | -1 585 | ], 586 | "children_right": [ 587 | 2, 588 | -1, 589 | 4, 590 | -1, 591 | 14, 592 | 13, 593 | 8, 594 | -1, 595 | 10, 596 | -1, 597 | 12, 598 | -1, 599 | -1, 600 | -1, 601 | 20, 602 | 17, 603 | -1, 604 | 19, 605 | -1, 606 | -1, 607 | -1 608 | ], 609 | "threshold": [ 610 | 2.600000023841858, 611 | -2.0, 612 | 4.75, 613 | -2.0, 614 | 1.75, 615 | 7.049999952316284, 616 | 2.350000023841858, 617 | -2.0, 618 | 5.049999952316284, 619 | -2.0, 620 | 6.150000095367432, 621 | -2.0, 622 | -2.0, 623 | -2.0, 624 | 1.8499999642372131, 625 | 3.100000023841858, 626 | -2.0, 627 | 5.400000095367432, 628 | -2.0, 629 | -2.0, 630 | -2.0 631 | ], 632 | "feature": [ 633 | 2, 634 | -2, 635 | 2, 636 | -2, 637 | 3, 638 | 0, 639 | 1, 640 | -2, 641 | 2, 642 | -2, 643 | 0, 644 | -2, 645 | -2, 646 | -2, 647 | 3, 648 | 1, 649 | -2, 650 | 2, 651 | -2, 652 | -2, 653 | -2 654 | ], 655 | "classes_": [ 656 | 0.0, 657 | 1.0, 658 | 2.0 659 | ], 660 | "value": [ 661 | [ 662 | 51.0, 663 | 46.0, 664 | 53.0 665 | ], 666 | [ 667 | 51.0, 668 | 0.0, 669 | 0.0 670 | ], 671 | [ 672 | 0.0, 673 | 46.0, 674 | 53.0 675 | ], 676 | [ 677 | 0.0, 678 | 37.0, 679 | 0.0 680 | ], 681 | [ 682 | 0.0, 683 | 9.0, 684 | 53.0 685 | ], 686 | [ 687 | 0.0, 688 | 8.0, 689 | 3.0 690 | ], 691 | [ 692 | 0.0, 693 | 8.0, 694 | 2.0 695 | ], 696 | [ 697 | 0.0, 698 | 0.0, 699 | 1.0 700 | ], 701 | [ 702 | 0.0, 703 | 8.0, 704 | 1.0 705 | ], 706 | [ 707 | 0.0, 708 | 5.0, 709 | 0.0 710 | ], 711 | [ 712 | 0.0, 713 | 3.0, 714 | 1.0 715 | ], 716 | [ 717 | 0.0, 718 | 3.0, 719 | 0.0 720 | ], 721 | [ 722 | 0.0, 723 | 0.0, 724 | 1.0 725 | ], 726 | [ 727 | 0.0, 728 | 0.0, 729 | 1.0 730 | ], 731 | [ 732 | 0.0, 733 | 1.0, 734 | 50.0 735 | ], 736 | [ 737 | 0.0, 738 | 1.0, 739 | 13.0 740 | ], 741 | [ 742 | 0.0, 743 | 0.0, 744 | 12.0 745 | ], 746 | [ 747 | 0.0, 748 | 1.0, 749 | 1.0 750 | ], 751 | [ 752 | 0.0, 753 | 1.0, 754 | 0.0 755 | ], 756 | [ 757 | 0.0, 758 | 0.0, 759 | 1.0 760 | ], 761 | [ 762 | 0.0, 763 | 0.0, 764 | 37.0 765 | ] 766 | ] 767 | }, 768 | { 769 | "children_left": [ 770 | 1, 771 | -1, 772 | 3, 773 | 4, 774 | 5, 775 | 6, 776 | -1, 777 | -1, 778 | 9, 779 | -1, 780 | 11, 781 | -1, 782 | 13, 783 | -1, 784 | -1, 785 | 16, 786 | -1, 787 | 18, 788 | -1, 789 | -1, 790 | 21, 791 | -1, 792 | -1 793 | ], 794 | "children_right": [ 795 | 2, 796 | -1, 797 | 20, 798 | 15, 799 | 8, 800 | 7, 801 | -1, 802 | -1, 803 | 10, 804 | -1, 805 | 12, 806 | -1, 807 | 14, 808 | -1, 809 | -1, 810 | 17, 811 | -1, 812 | 19, 813 | -1, 814 | -1, 815 | 22, 816 | -1, 817 | -1 818 | ], 819 | "threshold": [ 820 | 0.75, 821 | -2.0, 822 | 6.75, 823 | 1.75, 824 | 4.950000047683716, 825 | 4.950000047683716, 826 | -2.0, 827 | -2.0, 828 | 2.649999976158142, 829 | -2.0, 830 | 5.049999952316284, 831 | -2.0, 832 | 1.550000011920929, 833 | -2.0, 834 | -2.0, 835 | 3.149999976158142, 836 | -2.0, 837 | 2.049999952316284, 838 | -2.0, 839 | -2.0, 840 | 1.550000011920929, 841 | -2.0, 842 | -2.0 843 | ], 844 | "feature": [ 845 | 3, 846 | -2, 847 | 0, 848 | 3, 849 | 2, 850 | 0, 851 | -2, 852 | -2, 853 | 1, 854 | -2, 855 | 2, 856 | -2, 857 | 3, 858 | -2, 859 | -2, 860 | 1, 861 | -2, 862 | 3, 863 | -2, 864 | -2, 865 | 3, 866 | -2, 867 | -2 868 | ], 869 | "classes_": [ 870 | 0.0, 871 | 1.0, 872 | 2.0 873 | ], 874 | "value": [ 875 | [ 876 | 42.0, 877 | 59.0, 878 | 49.0 879 | ], 880 | [ 881 | 42.0, 882 | 0.0, 883 | 0.0 884 | ], 885 | [ 886 | 0.0, 887 | 59.0, 888 | 49.0 889 | ], 890 | [ 891 | 0.0, 892 | 58.0, 893 | 30.0 894 | ], 895 | [ 896 | 0.0, 897 | 57.0, 898 | 6.0 899 | ], 900 | [ 901 | 0.0, 902 | 53.0, 903 | 2.0 904 | ], 905 | [ 906 | 0.0, 907 | 0.0, 908 | 2.0 909 | ], 910 | [ 911 | 0.0, 912 | 53.0, 913 | 0.0 914 | ], 915 | [ 916 | 0.0, 917 | 4.0, 918 | 4.0 919 | ], 920 | [ 921 | 0.0, 922 | 0.0, 923 | 3.0 924 | ], 925 | [ 926 | 0.0, 927 | 4.0, 928 | 1.0 929 | ], 930 | [ 931 | 0.0, 932 | 2.0, 933 | 0.0 934 | ], 935 | [ 936 | 0.0, 937 | 2.0, 938 | 1.0 939 | ], 940 | [ 941 | 0.0, 942 | 0.0, 943 | 1.0 944 | ], 945 | [ 946 | 0.0, 947 | 2.0, 948 | 0.0 949 | ], 950 | [ 951 | 0.0, 952 | 1.0, 953 | 24.0 954 | ], 955 | [ 956 | 0.0, 957 | 0.0, 958 | 18.0 959 | ], 960 | [ 961 | 0.0, 962 | 1.0, 963 | 6.0 964 | ], 965 | [ 966 | 0.0, 967 | 1.0, 968 | 0.0 969 | ], 970 | [ 971 | 0.0, 972 | 0.0, 973 | 6.0 974 | ], 975 | [ 976 | 0.0, 977 | 1.0, 978 | 19.0 979 | ], 980 | [ 981 | 0.0, 982 | 1.0, 983 | 0.0 984 | ], 985 | [ 986 | 0.0, 987 | 0.0, 988 | 19.0 989 | ] 990 | ] 991 | }, 992 | { 993 | "children_left": [ 994 | 1, 995 | 2, 996 | 3, 997 | -1, 998 | -1, 999 | -1, 1000 | 7, 1001 | 8, 1002 | 9, 1003 | -1, 1004 | 11, 1005 | -1, 1006 | -1, 1007 | -1, 1008 | 15, 1009 | 16, 1010 | -1, 1011 | 18, 1012 | -1, 1013 | -1, 1014 | -1 1015 | ], 1016 | "children_right": [ 1017 | 6, 1018 | 5, 1019 | 4, 1020 | -1, 1021 | -1, 1022 | -1, 1023 | 14, 1024 | 13, 1025 | 10, 1026 | -1, 1027 | 12, 1028 | -1, 1029 | -1, 1030 | -1, 1031 | 20, 1032 | 17, 1033 | -1, 1034 | 19, 1035 | -1, 1036 | -1, 1037 | -1 1038 | ], 1039 | "threshold": [ 1040 | 5.450000047683716, 1041 | 2.700000047683716, 1042 | 3.899999976158142, 1043 | -2.0, 1044 | -2.0, 1045 | -2.0, 1046 | 1.75, 1047 | 3.649999976158142, 1048 | 4.950000047683716, 1049 | -2.0, 1050 | 6.5, 1051 | -2.0, 1052 | -2.0, 1053 | -2.0, 1054 | 1.8499999642372131, 1055 | 3.149999976158142, 1056 | -2.0, 1057 | 6.549999952316284, 1058 | -2.0, 1059 | -2.0, 1060 | -2.0 1061 | ], 1062 | "feature": [ 1063 | 0, 1064 | 1, 1065 | 2, 1066 | -2, 1067 | -2, 1068 | -2, 1069 | 3, 1070 | 1, 1071 | 2, 1072 | -2, 1073 | 0, 1074 | -2, 1075 | -2, 1076 | -2, 1077 | 3, 1078 | 1, 1079 | -2, 1080 | 0, 1081 | -2, 1082 | -2, 1083 | -2 1084 | ], 1085 | "classes_": [ 1086 | 0.0, 1087 | 1.0, 1088 | 2.0 1089 | ], 1090 | "value": [ 1091 | [ 1092 | 44.0, 1093 | 44.0, 1094 | 62.0 1095 | ], 1096 | [ 1097 | 42.0, 1098 | 1.0, 1099 | 3.0 1100 | ], 1101 | [ 1102 | 0.0, 1103 | 1.0, 1104 | 3.0 1105 | ], 1106 | [ 1107 | 0.0, 1108 | 1.0, 1109 | 0.0 1110 | ], 1111 | [ 1112 | 0.0, 1113 | 0.0, 1114 | 3.0 1115 | ], 1116 | [ 1117 | 42.0, 1118 | 0.0, 1119 | 0.0 1120 | ], 1121 | [ 1122 | 2.0, 1123 | 43.0, 1124 | 59.0 1125 | ], 1126 | [ 1127 | 2.0, 1128 | 42.0, 1129 | 4.0 1130 | ], 1131 | [ 1132 | 0.0, 1133 | 42.0, 1134 | 4.0 1135 | ], 1136 | [ 1137 | 0.0, 1138 | 41.0, 1139 | 0.0 1140 | ], 1141 | [ 1142 | 0.0, 1143 | 1.0, 1144 | 4.0 1145 | ], 1146 | [ 1147 | 0.0, 1148 | 0.0, 1149 | 4.0 1150 | ], 1151 | [ 1152 | 0.0, 1153 | 1.0, 1154 | 0.0 1155 | ], 1156 | [ 1157 | 2.0, 1158 | 0.0, 1159 | 0.0 1160 | ], 1161 | [ 1162 | 0.0, 1163 | 1.0, 1164 | 55.0 1165 | ], 1166 | [ 1167 | 0.0, 1168 | 1.0, 1169 | 14.0 1170 | ], 1171 | [ 1172 | 0.0, 1173 | 0.0, 1174 | 11.0 1175 | ], 1176 | [ 1177 | 0.0, 1178 | 1.0, 1179 | 3.0 1180 | ], 1181 | [ 1182 | 0.0, 1183 | 1.0, 1184 | 0.0 1185 | ], 1186 | [ 1187 | 0.0, 1188 | 0.0, 1189 | 3.0 1190 | ], 1191 | [ 1192 | 0.0, 1193 | 0.0, 1194 | 41.0 1195 | ] 1196 | ] 1197 | }, 1198 | { 1199 | "children_left": [ 1200 | 1, 1201 | 2, 1202 | -1, 1203 | -1, 1204 | 5, 1205 | 6, 1206 | 7, 1207 | -1, 1208 | 9, 1209 | -1, 1210 | 11, 1211 | 12, 1212 | -1, 1213 | -1, 1214 | -1, 1215 | 16, 1216 | -1, 1217 | -1, 1218 | -1 1219 | ], 1220 | "children_right": [ 1221 | 4, 1222 | 3, 1223 | -1, 1224 | -1, 1225 | 18, 1226 | 15, 1227 | 8, 1228 | -1, 1229 | 10, 1230 | -1, 1231 | 14, 1232 | 13, 1233 | -1, 1234 | -1, 1235 | -1, 1236 | 17, 1237 | -1, 1238 | -1, 1239 | -1 1240 | ], 1241 | "threshold": [ 1242 | 5.450000047683716, 1243 | 2.599999964237213, 1244 | -2.0, 1245 | -2.0, 1246 | 6.8500001430511475, 1247 | 1.699999988079071, 1248 | 0.7000000029802322, 1249 | -2.0, 1250 | 6.25, 1251 | -2.0, 1252 | 6.3500001430511475, 1253 | 5.0, 1254 | -2.0, 1255 | -2.0, 1256 | -2.0, 1257 | 4.8500001430511475, 1258 | -2.0, 1259 | -2.0, 1260 | -2.0 1261 | ], 1262 | "feature": [ 1263 | 0, 1264 | 2, 1265 | -2, 1266 | -2, 1267 | 0, 1268 | 3, 1269 | 3, 1270 | -2, 1271 | 0, 1272 | -2, 1273 | 0, 1274 | 2, 1275 | -2, 1276 | -2, 1277 | -2, 1278 | 2, 1279 | -2, 1280 | -2, 1281 | -2 1282 | ], 1283 | "classes_": [ 1284 | 0.0, 1285 | 1.0, 1286 | 2.0 1287 | ], 1288 | "value": [ 1289 | [ 1290 | 49.0, 1291 | 61.0, 1292 | 40.0 1293 | ], 1294 | [ 1295 | 42.0, 1296 | 5.0, 1297 | 0.0 1298 | ], 1299 | [ 1300 | 42.0, 1301 | 0.0, 1302 | 0.0 1303 | ], 1304 | [ 1305 | 0.0, 1306 | 5.0, 1307 | 0.0 1308 | ], 1309 | [ 1310 | 7.0, 1311 | 56.0, 1312 | 40.0 1313 | ], 1314 | [ 1315 | 7.0, 1316 | 56.0, 1317 | 20.0 1318 | ], 1319 | [ 1320 | 7.0, 1321 | 55.0, 1322 | 2.0 1323 | ], 1324 | [ 1325 | 7.0, 1326 | 0.0, 1327 | 0.0 1328 | ], 1329 | [ 1330 | 0.0, 1331 | 55.0, 1332 | 2.0 1333 | ], 1334 | [ 1335 | 0.0, 1336 | 40.0, 1337 | 0.0 1338 | ], 1339 | [ 1340 | 0.0, 1341 | 15.0, 1342 | 2.0 1343 | ], 1344 | [ 1345 | 0.0, 1346 | 4.0, 1347 | 2.0 1348 | ], 1349 | [ 1350 | 0.0, 1351 | 4.0, 1352 | 0.0 1353 | ], 1354 | [ 1355 | 0.0, 1356 | 0.0, 1357 | 2.0 1358 | ], 1359 | [ 1360 | 0.0, 1361 | 11.0, 1362 | 0.0 1363 | ], 1364 | [ 1365 | 0.0, 1366 | 1.0, 1367 | 18.0 1368 | ], 1369 | [ 1370 | 0.0, 1371 | 1.0, 1372 | 0.0 1373 | ], 1374 | [ 1375 | 0.0, 1376 | 0.0, 1377 | 18.0 1378 | ], 1379 | [ 1380 | 0.0, 1381 | 0.0, 1382 | 20.0 1383 | ] 1384 | ] 1385 | }, 1386 | { 1387 | "children_left": [ 1388 | 1, 1389 | 2, 1390 | -1, 1391 | 4, 1392 | -1, 1393 | -1, 1394 | 7, 1395 | 8, 1396 | -1, 1397 | 10, 1398 | 11, 1399 | -1, 1400 | 13, 1401 | -1, 1402 | -1, 1403 | -1, 1404 | 17, 1405 | 18, 1406 | -1, 1407 | -1, 1408 | -1 1409 | ], 1410 | "children_right": [ 1411 | 6, 1412 | 3, 1413 | -1, 1414 | 5, 1415 | -1, 1416 | -1, 1417 | 16, 1418 | 9, 1419 | -1, 1420 | 15, 1421 | 12, 1422 | -1, 1423 | 14, 1424 | -1, 1425 | -1, 1426 | -1, 1427 | 20, 1428 | 19, 1429 | -1, 1430 | -1, 1431 | -1 1432 | ], 1433 | "threshold": [ 1434 | 5.450000047683716, 1435 | 2.599999964237213, 1436 | -2.0, 1437 | 1.350000023841858, 1438 | -2.0, 1439 | -2.0, 1440 | 1.699999988079071, 1441 | 2.600000023841858, 1442 | -2.0, 1443 | 7.099999904632568, 1444 | 4.950000047683716, 1445 | -2.0, 1446 | 1.550000011920929, 1447 | -2.0, 1448 | -2.0, 1449 | -2.0, 1450 | 4.8500001430511475, 1451 | 3.100000023841858, 1452 | -2.0, 1453 | -2.0, 1454 | -2.0 1455 | ], 1456 | "feature": [ 1457 | 0, 1458 | 2, 1459 | -2, 1460 | 3, 1461 | -2, 1462 | -2, 1463 | 3, 1464 | 2, 1465 | -2, 1466 | 0, 1467 | 2, 1468 | -2, 1469 | 3, 1470 | -2, 1471 | -2, 1472 | -2, 1473 | 2, 1474 | 1, 1475 | -2, 1476 | -2, 1477 | -2 1478 | ], 1479 | "classes_": [ 1480 | 0.0, 1481 | 1.0, 1482 | 2.0 1483 | ], 1484 | "value": [ 1485 | [ 1486 | 48.0, 1487 | 52.0, 1488 | 50.0 1489 | ], 1490 | [ 1491 | 42.0, 1492 | 2.0, 1493 | 2.0 1494 | ], 1495 | [ 1496 | 42.0, 1497 | 0.0, 1498 | 0.0 1499 | ], 1500 | [ 1501 | 0.0, 1502 | 2.0, 1503 | 2.0 1504 | ], 1505 | [ 1506 | 0.0, 1507 | 2.0, 1508 | 0.0 1509 | ], 1510 | [ 1511 | 0.0, 1512 | 0.0, 1513 | 2.0 1514 | ], 1515 | [ 1516 | 6.0, 1517 | 50.0, 1518 | 48.0 1519 | ], 1520 | [ 1521 | 6.0, 1522 | 49.0, 1523 | 5.0 1524 | ], 1525 | [ 1526 | 6.0, 1527 | 0.0, 1528 | 0.0 1529 | ], 1530 | [ 1531 | 0.0, 1532 | 49.0, 1533 | 5.0 1534 | ], 1535 | [ 1536 | 0.0, 1537 | 49.0, 1538 | 3.0 1539 | ], 1540 | [ 1541 | 0.0, 1542 | 46.0, 1543 | 0.0 1544 | ], 1545 | [ 1546 | 0.0, 1547 | 3.0, 1548 | 3.0 1549 | ], 1550 | [ 1551 | 0.0, 1552 | 0.0, 1553 | 3.0 1554 | ], 1555 | [ 1556 | 0.0, 1557 | 3.0, 1558 | 0.0 1559 | ], 1560 | [ 1561 | 0.0, 1562 | 0.0, 1563 | 2.0 1564 | ], 1565 | [ 1566 | 0.0, 1567 | 1.0, 1568 | 43.0 1569 | ], 1570 | [ 1571 | 0.0, 1572 | 1.0, 1573 | 5.0 1574 | ], 1575 | [ 1576 | 0.0, 1577 | 0.0, 1578 | 5.0 1579 | ], 1580 | [ 1581 | 0.0, 1582 | 1.0, 1583 | 0.0 1584 | ], 1585 | [ 1586 | 0.0, 1587 | 0.0, 1588 | 38.0 1589 | ] 1590 | ] 1591 | }, 1592 | { 1593 | "children_left": [ 1594 | 1, 1595 | -1, 1596 | 3, 1597 | 4, 1598 | 5, 1599 | -1, 1600 | -1, 1601 | -1, 1602 | 9, 1603 | 10, 1604 | -1, 1605 | -1, 1606 | 13, 1607 | 14, 1608 | -1, 1609 | -1, 1610 | -1 1611 | ], 1612 | "children_right": [ 1613 | 2, 1614 | -1, 1615 | 8, 1616 | 7, 1617 | 6, 1618 | -1, 1619 | -1, 1620 | -1, 1621 | 12, 1622 | 11, 1623 | -1, 1624 | -1, 1625 | 16, 1626 | 15, 1627 | -1, 1628 | -1, 1629 | -1 1630 | ], 1631 | "threshold": [ 1632 | 2.350000023841858, 1633 | -2.0, 1634 | 4.75, 1635 | 2.549999952316284, 1636 | 1.600000023841858, 1637 | -2.0, 1638 | -2.0, 1639 | -2.0, 1640 | 1.75, 1641 | 5.049999952316284, 1642 | -2.0, 1643 | -2.0, 1644 | 4.8500001430511475, 1645 | 3.100000023841858, 1646 | -2.0, 1647 | -2.0, 1648 | -2.0 1649 | ], 1650 | "feature": [ 1651 | 2, 1652 | -2, 1653 | 2, 1654 | 1, 1655 | 3, 1656 | -2, 1657 | -2, 1658 | -2, 1659 | 3, 1660 | 2, 1661 | -2, 1662 | -2, 1663 | 2, 1664 | 1, 1665 | -2, 1666 | -2, 1667 | -2 1668 | ], 1669 | "classes_": [ 1670 | 0.0, 1671 | 1.0, 1672 | 2.0 1673 | ], 1674 | "value": [ 1675 | [ 1676 | 44.0, 1677 | 55.0, 1678 | 51.0 1679 | ], 1680 | [ 1681 | 44.0, 1682 | 0.0, 1683 | 0.0 1684 | ], 1685 | [ 1686 | 0.0, 1687 | 55.0, 1688 | 51.0 1689 | ], 1690 | [ 1691 | 0.0, 1692 | 49.0, 1693 | 2.0 1694 | ], 1695 | [ 1696 | 0.0, 1697 | 15.0, 1698 | 2.0 1699 | ], 1700 | [ 1701 | 0.0, 1702 | 15.0, 1703 | 0.0 1704 | ], 1705 | [ 1706 | 0.0, 1707 | 0.0, 1708 | 2.0 1709 | ], 1710 | [ 1711 | 0.0, 1712 | 34.0, 1713 | 0.0 1714 | ], 1715 | [ 1716 | 0.0, 1717 | 6.0, 1718 | 49.0 1719 | ], 1720 | [ 1721 | 0.0, 1722 | 5.0, 1723 | 3.0 1724 | ], 1725 | [ 1726 | 0.0, 1727 | 5.0, 1728 | 0.0 1729 | ], 1730 | [ 1731 | 0.0, 1732 | 0.0, 1733 | 3.0 1734 | ], 1735 | [ 1736 | 0.0, 1737 | 1.0, 1738 | 46.0 1739 | ], 1740 | [ 1741 | 0.0, 1742 | 1.0, 1743 | 3.0 1744 | ], 1745 | [ 1746 | 0.0, 1747 | 0.0, 1748 | 3.0 1749 | ], 1750 | [ 1751 | 0.0, 1752 | 1.0, 1753 | 0.0 1754 | ], 1755 | [ 1756 | 0.0, 1757 | 0.0, 1758 | 43.0 1759 | ] 1760 | ] 1761 | } 1762 | ], 1763 | "__meta__": { 1764 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 1765 | "__sklearn_version": "0.21.2", 1766 | "__classifier": "RandomForestClassifier", 1767 | "__author": "alex", 1768 | "__dt": "2019-07-12T23:18:47.199662" 1769 | } 1770 | } 1771 | -------------------------------------------------------------------------------- /example/models/svc.json: -------------------------------------------------------------------------------- 1 | { 2 | "support_vectors_": [ 3 | [ 4 | 4.3, 5 | 3.0, 6 | 1.1, 7 | 0.1 8 | ], 9 | [ 10 | 5.7, 11 | 4.4, 12 | 1.5, 13 | 0.4 14 | ], 15 | [ 16 | 5.7, 17 | 3.8, 18 | 1.7, 19 | 0.3 20 | ], 21 | [ 22 | 5.1, 23 | 3.3, 24 | 1.7, 25 | 0.5 26 | ], 27 | [ 28 | 4.8, 29 | 3.4, 30 | 1.9, 31 | 0.2 32 | ], 33 | [ 34 | 4.5, 35 | 2.3, 36 | 1.3, 37 | 0.3 38 | ], 39 | [ 40 | 5.1, 41 | 3.8, 42 | 1.9, 43 | 0.4 44 | ], 45 | [ 46 | 7.0, 47 | 3.2, 48 | 4.7, 49 | 1.4 50 | ], 51 | [ 52 | 6.9, 53 | 3.1, 54 | 4.9, 55 | 1.5 56 | ], 57 | [ 58 | 6.5, 59 | 2.8, 60 | 4.6, 61 | 1.5 62 | ], 63 | [ 64 | 6.3, 65 | 3.3, 66 | 4.7, 67 | 1.6 68 | ], 69 | [ 70 | 4.9, 71 | 2.4, 72 | 3.3, 73 | 1.0 74 | ], 75 | [ 76 | 5.0, 77 | 2.0, 78 | 3.5, 79 | 1.0 80 | ], 81 | [ 82 | 6.1, 83 | 2.9, 84 | 4.7, 85 | 1.4 86 | ], 87 | [ 88 | 5.6, 89 | 3.0, 90 | 4.5, 91 | 1.5 92 | ], 93 | [ 94 | 6.2, 95 | 2.2, 96 | 4.5, 97 | 1.5 98 | ], 99 | [ 100 | 5.9, 101 | 3.2, 102 | 4.8, 103 | 1.8 104 | ], 105 | [ 106 | 6.3, 107 | 2.5, 108 | 4.9, 109 | 1.5 110 | ], 111 | [ 112 | 6.8, 113 | 2.8, 114 | 4.8, 115 | 1.4 116 | ], 117 | [ 118 | 6.7, 119 | 3.0, 120 | 5.0, 121 | 1.7 122 | ], 123 | [ 124 | 6.0, 125 | 2.9, 126 | 4.5, 127 | 1.5 128 | ], 129 | [ 130 | 6.0, 131 | 2.7, 132 | 5.1, 133 | 1.6 134 | ], 135 | [ 136 | 5.4, 137 | 3.0, 138 | 4.5, 139 | 1.5 140 | ], 141 | [ 142 | 6.0, 143 | 3.4, 144 | 4.5, 145 | 1.6 146 | ], 147 | [ 148 | 6.7, 149 | 3.1, 150 | 4.7, 151 | 1.5 152 | ], 153 | [ 154 | 5.1, 155 | 2.5, 156 | 3.0, 157 | 1.1 158 | ], 159 | [ 160 | 6.3, 161 | 3.3, 162 | 6.0, 163 | 2.5 164 | ], 165 | [ 166 | 4.9, 167 | 2.5, 168 | 4.5, 169 | 1.7 170 | ], 171 | [ 172 | 6.5, 173 | 3.2, 174 | 5.1, 175 | 2.0 176 | ], 177 | [ 178 | 7.7, 179 | 2.6, 180 | 6.9, 181 | 2.3 182 | ], 183 | [ 184 | 6.0, 185 | 2.2, 186 | 5.0, 187 | 1.5 188 | ], 189 | [ 190 | 5.6, 191 | 2.8, 192 | 4.9, 193 | 2.0 194 | ], 195 | [ 196 | 6.3, 197 | 2.7, 198 | 4.9, 199 | 1.8 200 | ], 201 | [ 202 | 6.2, 203 | 2.8, 204 | 4.8, 205 | 1.8 206 | ], 207 | [ 208 | 6.1, 209 | 3.0, 210 | 4.9, 211 | 1.8 212 | ], 213 | [ 214 | 7.2, 215 | 3.0, 216 | 5.8, 217 | 1.6 218 | ], 219 | [ 220 | 7.9, 221 | 3.8, 222 | 6.4, 223 | 2.0 224 | ], 225 | [ 226 | 6.3, 227 | 2.8, 228 | 5.1, 229 | 1.5 230 | ], 231 | [ 232 | 6.1, 233 | 2.6, 234 | 5.6, 235 | 1.4 236 | ], 237 | [ 238 | 6.0, 239 | 3.0, 240 | 4.8, 241 | 1.8 242 | ], 243 | [ 244 | 6.9, 245 | 3.1, 246 | 5.1, 247 | 2.3 248 | ], 249 | [ 250 | 5.8, 251 | 2.7, 252 | 5.1, 253 | 1.9 254 | ], 255 | [ 256 | 6.3, 257 | 2.5, 258 | 5.0, 259 | 1.9 260 | ], 261 | [ 262 | 6.5, 263 | 3.0, 264 | 5.2, 265 | 2.0 266 | ], 267 | [ 268 | 5.9, 269 | 3.0, 270 | 5.1, 271 | 1.8 272 | ] 273 | ], 274 | "dual_coef_": [ 275 | [ 276 | 0.0, 277 | 0.4386244104464341, 278 | 0.06663115831281492, 279 | 0.002277020749968409, 280 | 0.35843112572827146, 281 | 1.0, 282 | 0.4588582343970687, 283 | -0.5517100820489875, 284 | -0.0, 285 | -0.0, 286 | -0.0, 287 | -0.5428293066095111, 288 | -0.0, 289 | -0.0, 290 | -0.0, 291 | -0.0, 292 | -0.0, 293 | -0.0, 294 | -0.0, 295 | -0.1664909718151888, 296 | -0.0, 297 | -0.06379158916087012, 298 | -0.0, 299 | -0.0, 300 | -0.0, 301 | -1.0, 302 | -0.11757608131084718, 303 | -0.7337655049344587, 304 | -0.0, 305 | -0.4272359406177839, 306 | -0.09993001758512109, 307 | -0.0, 308 | -0.0, 309 | -0.0, 310 | -0.0, 311 | -0.0, 312 | -0.4053395104913362, 313 | -0.0, 314 | -0.0, 315 | -0.0, 316 | -0.16140841734798533, 317 | -0.0, 318 | -0.0, 319 | -0.0, 320 | -0.0 321 | ], 322 | [ 323 | 0.009368831960995326, 324 | 0.9556474901217844, 325 | 0.0, 326 | 0.0, 327 | 0.011617305692425932, 328 | 0.9686218445123266, 329 | 0.0, 330 | 0.0, 331 | 1.0, 332 | 1.0, 333 | 1.0, 334 | 0.0, 335 | 0.40434216978125864, 336 | 1.0, 337 | 1.0, 338 | 1.0, 339 | 1.0, 340 | 1.0, 341 | 1.0, 342 | 1.0, 343 | 1.0, 344 | 1.0, 345 | 1.0, 346 | 0.27391516456770126, 347 | 1.0, 348 | 0.0, 349 | -0.0, 350 | -1.0, 351 | -1.0, 352 | -0.0, 353 | -1.0, 354 | -1.0, 355 | -1.0, 356 | -1.0, 357 | -1.0, 358 | -0.8300343547007096, 359 | -0.13092148302187717, 360 | -1.0, 361 | -0.6237238841373084, 362 | -1.0, 363 | -0.7730127984352919, 364 | -0.32056481405377285, 365 | -1.0, 366 | -1.0, 367 | -1.0 368 | ] 369 | ], 370 | "n_support_": [ 371 | 7, 372 | 19, 373 | 19 374 | ], 375 | "_intercept_": [ 376 | -0.03985691051205832, 377 | -0.1677745320943027, 378 | -0.143704687543137 379 | ], 380 | "classes_": [ 381 | 0, 382 | 1, 383 | 2 384 | ], 385 | "kernel": "rbf", 386 | "coef0": 0.0, 387 | "degree": 3, 388 | "_gamma": 0.25, 389 | "__meta__": { 390 | "__pyversion": "3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]", 391 | "__sklearn_version": "0.21.2", 392 | "__classifier": "SVC", 393 | "__author": "alex", 394 | "__dt": "2019-07-12T23:18:47.175305" 395 | } 396 | } -------------------------------------------------------------------------------- /example/tests.dart: -------------------------------------------------------------------------------- 1 | import 'package:sklite/tree/tree.dart'; 2 | import 'package:sklite/naivebayes/naive_bayes.dart'; 3 | import 'package:sklite/SVM/SVM.dart'; 4 | import 'package:sklite/neighbors/neighbors.dart'; 5 | import 'package:sklite/ensemble/forest.dart'; 6 | import 'package:sklite/neural_network/neural_network.dart'; 7 | import 'dart:io'; 8 | import 'dart:convert'; 9 | 10 | /// For development only. 11 | String readFile(String path){ 12 | return File(path).readAsStringSync(); 13 | } 14 | 15 | /// For development only. 16 | Map readJsonFile(String path) { 17 | return json.decode(readFile(path)); 18 | } 19 | 20 | void main(){ 21 | List X = [5.0, 2.0, 3.5, 1.0]; 22 | print("DecisionTreeClassifier"); 23 | var params0 = readJsonFile('models/dt.json'); 24 | DecisionTreeClassifier x = DecisionTreeClassifier.fromMap(params0); 25 | print(x.predict(X)); 26 | print('------------------------------------'); 27 | print("GaussianNB"); 28 | var params1 = readJsonFile('models/nbc.json'); 29 | GaussianNB n = GaussianNB.fromMap(params1); 30 | print(n.predict(X)); 31 | print('------------------------------------'); 32 | print("SVC"); 33 | var params2 = readJsonFile('models/svc.json'); 34 | SVC s = SVC.fromMap(params2); 35 | print(s.predict(X)); 36 | print('------------------------------------'); 37 | print("LinearSVC"); 38 | var params3 = readJsonFile('models/linearsvc.json'); 39 | LinearSVC l = LinearSVC.fromMap(params3); 40 | print(l.predict(X)); 41 | print('------------------------------------'); 42 | print("BernoulliNB"); 43 | var params4 = readJsonFile('models/bernoullinb.json'); 44 | BernoulliNB b = BernoulliNB.fromMap(params4); 45 | print(b.predict(X)); 46 | print('------------------------------------'); 47 | print("KNeighborsClassifier"); 48 | var params5 = readJsonFile("models/kneighbors.json"); 49 | KNeighborsClassifier k = KNeighborsClassifier.fromMap(params5); 50 | print(k.predict(X)); 51 | print('------------------------------------'); 52 | print("RandomForestClassifier"); 53 | var params6 = readJsonFile("models/randomforest.json"); 54 | RandomForestClassifier r = RandomForestClassifier.fromMap(params6); 55 | print(r.predict(X)); 56 | print('------------------------------------'); 57 | print("MLPClassifier"); 58 | var params7 = readJsonFile("models/mlpclassifier.json"); 59 | MLPClassifier m = MLPClassifier.fromMap(params7); 60 | print(m.predict(X)); 61 | } -------------------------------------------------------------------------------- /lib/SVM/SVM.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:sklite/base.dart'; 3 | import 'package:sklite/utils/mathutils.dart'; 4 | import 'package:sklite/utils/exceptions.dart'; 5 | 6 | /// An implementation of sklearn.svm.SVC. 7 | /// --------------- 8 | /// 9 | /// https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html 10 | class SVC extends Classifier { 11 | List supportVectors; 12 | List dualCoef; 13 | List intercept; 14 | List nSupport; 15 | List classes; 16 | String kernel; 17 | double gamma; 18 | double coef0; 19 | int degree; 20 | final List _supported = ["rbf", "linear", "sigmoid", "poly"]; 21 | 22 | /// To manually instantiate the SVC. The parameters 23 | /// are lifted directly from scikit-learn. 24 | /// See the attributes here: 25 | /// https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html 26 | SVC(this.supportVectors, this.dualCoef, this.intercept, this.nSupport, 27 | this.classes, this.kernel, this.gamma, this.coef0, this.degree); 28 | 29 | factory SVC.fromMap(Map params) { 30 | return SVC( 31 | params["support_vectors_"], 32 | params["dual_coef_"], 33 | params["_intercept_"], 34 | params["n_support_"], 35 | List.from(params["classes_"]), 36 | params["kernel"], 37 | params["_gamma"], 38 | params["coef0"], 39 | params["degree"]); 40 | } 41 | 42 | /// Implementation of sklearn.svm.SVC.predict. 43 | @override 44 | int predict(List X) { 45 | List kernels; 46 | List starts = List.filled(classes.length, 0); 47 | List ends = List.generate(classes.length, ((index) => index)); 48 | if (kernel == "rbf") 49 | kernels = rbf(X); 50 | else if (kernel == "linear") 51 | kernels = linear(X); 52 | else if (kernel == "sigmoid") 53 | kernels = sigmoid(X); 54 | else if (kernel == "poly") 55 | kernels = sigmoid(X); 56 | else 57 | throw InvalidSVMKernelException( 58 | "Unsupported kernel $kernel, supported are: ${_supported.join(", ")}"); 59 | 60 | for (int i = 1; i < classes.length; i++) { 61 | int start = 0; 62 | for (int j = 0; j < i; j++) { 63 | final e = nSupport[j]; 64 | if (e is String) { 65 | start += int.parse(e); 66 | } else if (e is int) { 67 | start += e; 68 | } 69 | } 70 | starts[i] = start; 71 | } 72 | classes.asMap().forEach((i, v) => ends[i] = nSupport[i] + starts[i]); 73 | 74 | if (classes.length == 2) { 75 | for (int i = 0; i < kernels.length; i++) { 76 | kernels[i] = -kernels[i]; 77 | } 78 | 79 | double decision = 0.0; 80 | for (int k = starts[1]; k < ends[1]; k++) { 81 | decision += kernels[k] * dualCoef[0][k]; 82 | } 83 | for (int k = starts[0]; k < ends[0]; k++) { 84 | decision += kernels[k] * dualCoef[0][k]; 85 | } 86 | decision += intercept[0]; 87 | } 88 | 89 | List decisions = List.generate( 90 | intercept.length, 91 | ((index) => index.toDouble()), 92 | ); 93 | for (int i = 0, d = 0, l = classes.length; i < l; i++) { 94 | for (int j = i + 1; j < l; j++) { 95 | double tmp = 0.0; 96 | for (int k = starts[j]; k < ends[j]; k++) { 97 | tmp += dualCoef[i][k] * kernels[k]; 98 | } 99 | for (int k = starts[i]; k < ends[i]; k++) { 100 | tmp += dualCoef[j - 1][k] * kernels[k]; 101 | } 102 | decisions[d] = tmp + intercept[d]; 103 | d++; 104 | } 105 | } 106 | 107 | List votes = List.generate(intercept.length, (index) => index); 108 | for (int i = 0, d = 0, l = classes.length; i < l; i++) { 109 | for (int j = i + 1; j < l; j++) { 110 | votes[d] = decisions[d] > 0 ? i : j; 111 | d++; 112 | } 113 | } 114 | List amounts = List.filled(classes.length, 0); 115 | votes.asMap().forEach((i, v) => amounts[votes[i]] += 1); 116 | 117 | int classVal = -1; 118 | int idx = -1; 119 | for (int i = 0, l = amounts.length; i < l; i++) { 120 | if (amounts[i] > classVal) { 121 | classVal = amounts[i]; 122 | idx = i; 123 | } 124 | } 125 | 126 | return classes[idx]; 127 | } 128 | 129 | /// RBF kernel. 130 | /// --------------- 131 | /// 132 | /// K(x, y) = exp(-gamma ||x-y||^2) 133 | List rbf(List X) { 134 | List kernels = 135 | List.generate(supportVectors.length, (index) => index.toDouble()); 136 | for (int i = 0; i < supportVectors.length; i++) { 137 | double kernel = 0.0; 138 | for (int j = 0; j < supportVectors[i].length; j++) { 139 | kernel += pow(supportVectors[i][j] - X[j], 2); 140 | } 141 | kernels[i] = exp(this.gamma * -1.0 * kernel); 142 | } 143 | return kernels; 144 | } 145 | 146 | /// Linear kernel. 147 | /// --------------- 148 | /// 149 | /// K(x, y) = 150 | List linear(List X) { 151 | List kernels = 152 | List.generate(supportVectors.length, (index) => index.toDouble()); 153 | for (int i = 0; i < supportVectors.length; i++) { 154 | double kernel = 0.0; 155 | for (int j = 0; j < supportVectors[i].length; j++) { 156 | kernel += supportVectors[i][j] * X[j]; 157 | } 158 | kernels[i] = kernel; 159 | } 160 | return kernels; 161 | } 162 | 163 | /// Sigmoid kernel. 164 | /// --------------- 165 | /// 166 | /// K(X, Y) = tanh([gamma] + [coef0]) 167 | List sigmoid(List X) { 168 | List kernels = 169 | List.generate(supportVectors.length, ((index) => index.toDouble())); 170 | for (int i = 0; i < supportVectors.length; i++) { 171 | double kernel = 0.0; 172 | for (int j = 0; j < supportVectors[i].length; j++) { 173 | kernel += supportVectors[i][j] * X[j]; 174 | } 175 | kernels[i] = tanh((this.gamma * kernel) + this.coef0); 176 | } 177 | return kernels; 178 | } 179 | 180 | /// Polynomial kernel. 181 | /// --------------- 182 | /// 183 | /// K(X, Y) = ([gamma] + [coef0])^[degree] 184 | List poly(List X) { 185 | List kernels = List.generate( 186 | supportVectors.length, 187 | ((index) => index.toDouble()), 188 | ); 189 | for (int i = 0; i < supportVectors.length; i++) { 190 | double kernel = 0.0; 191 | for (int j = 0; j < supportVectors[i].length; j++) { 192 | kernel += supportVectors[i][j] * X[j]; 193 | } 194 | kernels[i] = 195 | pow((this.gamma * kernel) + this.coef0, this.degree).toDouble(); 196 | } 197 | return kernels; 198 | } 199 | } 200 | 201 | /// An implementation of sklearn.svm.SVC. 202 | /// --------------- 203 | /// 204 | /// https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html 205 | class LinearSVC extends Classifier { 206 | List coef; 207 | List intercept; 208 | List classes; 209 | 210 | /// To manually instantiate the LinearSVC. The parameters 211 | /// are lifted directly from scikit-learn. 212 | /// See the attributes here: 213 | /// https://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html 214 | LinearSVC(this.coef, this.intercept, this.classes); 215 | 216 | factory LinearSVC.fromMap(Map params) { 217 | return LinearSVC(params["coef_"], params["intercept_"], params["classes_"]); 218 | } 219 | 220 | /// Implementation of sklearn.svm.LinearSVC.predict. 221 | @override 222 | int predict(List X) { 223 | if (classes.length == 2) return _binPredict(X); 224 | return _predict(X); 225 | } 226 | 227 | int _predict(List X) { 228 | int idx = 0; 229 | double classVal = 0.0; 230 | for (int i = 0, il = intercept.length; i < il; i++) { 231 | double prob = 0.0; 232 | for (int j = 0, jl = coef[0].length; j < jl; j++) { 233 | prob += coef[i][j] * X[j]; 234 | } 235 | if (prob + intercept[i] > classVal) { 236 | classVal = prob + intercept[i]; 237 | idx = i; 238 | } 239 | } 240 | return classes[idx]; 241 | } 242 | 243 | int _binPredict(List X) { 244 | double prob = 0.0; 245 | coef.asMap().forEach((i, v) => prob += coef[i] * X[i]); 246 | if (prob + intercept[0] > 0.0) { 247 | return classes[1]; 248 | } 249 | return classes[0]; 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /lib/base.dart: -------------------------------------------------------------------------------- 1 | /// Abstract classifier class: all classifiers extend this class 2 | /// since they need to have individual implementation. 3 | /// The methods to be implemented are: 4 | /// 5 | /// int predict(List X) 6 | /// A dart implementation of the predict method 7 | /// in scikit-learn for the given class 8 | /// 9 | /// void fromMap(Map params) 10 | /// Loading the parameters from the JSON 11 | /// file or URL into the class. 12 | abstract class Classifier { 13 | 14 | /// Override in all classes extending Classifier. 15 | int predict(List X); 16 | 17 | /// Override in all classes extending Classifier. 18 | 19 | /// Load a model from a URL using an HTTP request 20 | /// @TODO 21 | fromURL(String url) {} 22 | } 23 | -------------------------------------------------------------------------------- /lib/ensemble/forest.dart: -------------------------------------------------------------------------------- 1 | import 'package:sklite/utils/mathutils.dart'; 2 | import 'package:sklite/base.dart'; 3 | import 'package:sklite/tree/tree.dart'; 4 | 5 | 6 | /// An implementation of sklearn.ensemble.RandomForestClassifier 7 | /// --------------- 8 | /// 9 | /// https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html 10 | class RandomForestClassifier extends Classifier { 11 | List classes; 12 | List _dtrees = []; 13 | List dtrees; 14 | 15 | 16 | /// To manually instantiate the RandomForestClassifier. The parameters 17 | /// are lifted directly from scikit-learn. 18 | /// See the attributes here: 19 | /// https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html 20 | RandomForestClassifier(this.classes, this.dtrees){ 21 | initDtrees(dtrees); 22 | } 23 | 24 | /// Override from Classifier. 25 | factory RandomForestClassifier.fromMap(Map params) { 26 | return RandomForestClassifier(List.from(params["classes_"]), params["dtrees"]); 27 | } 28 | 29 | /// Initializes the decision [trees] within the forest. 30 | /// Each of those instantiates a DecisionTreeClassifier. 31 | void initDtrees(List trees) { 32 | if (_dtrees.length > 0) return null; 33 | for (int i = 0; i < trees.length; i++) { 34 | trees[i]["classes_"] = classes; 35 | _dtrees.add(DecisionTreeClassifier.fromMap(trees[i])); 36 | } 37 | } 38 | 39 | /// Implementation of sklearn.ensemble.RandomForestClassifier.predict. 40 | @override 41 | int predict(List X) { 42 | var cls = List.filled(_dtrees[0].classes.length, 0); 43 | _dtrees.asMap().forEach((i, v) => cls[_dtrees[i].predict(X)]++); 44 | return classes[argmax(cls)]; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/naivebayes/naive_bayes.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:sklite/base.dart'; 3 | import 'package:sklite/utils/mathutils.dart'; 4 | 5 | /// An implementation of sklearn.naive_bayes.KNeighborsClassifier 6 | /// --------------- 7 | /// 8 | /// https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html 9 | class GaussianNB extends Classifier { 10 | List classPrior; 11 | List> sigma; 12 | List> theta; 13 | List classes; 14 | 15 | /// To manually instantiate the GaussianNB. The parameters 16 | /// are lifted directly from scikit-learn. 17 | /// See the attributes here: 18 | /// https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.GaussianNB.html 19 | GaussianNB(this.classPrior, this.sigma, this.theta, this.classes); 20 | 21 | factory GaussianNB.fromMap(Map params) { 22 | return GaussianNB( 23 | List.from(params['class_prior_']), 24 | List>.from(params['sigma_']), 25 | List>.from(params['theta_']), 26 | List.from(params["classes_"])); 27 | } 28 | 29 | /// Implementation of sklearn.nayve_bayes.GaussianNB.predict. 30 | @override 31 | int predict(List X) { 32 | // List probabilities = List(sigma.length); 33 | List probabilities = 34 | List.generate(sigma.length, (index) => index.toDouble()); 35 | for (int i = 0; i < sigma.length; i++) { 36 | double sum = 0.0; 37 | for (int j = 0; j < sigma[0].length; j++) { 38 | sum += log(2.0 * pi * sigma[i][j]); 39 | } 40 | double nij = -0.5 * sum; 41 | sum = 0.0; 42 | for (int j = 0; j < sigma.length; j++) { 43 | sum += pow(X[j] - theta[i][j], 2.0) / sigma[i][j]; 44 | } 45 | nij -= 0.5 * sum; 46 | probabilities[i] = log(classPrior[i]) + nij; 47 | } 48 | 49 | return classes[argmax(probabilities)]; 50 | } 51 | } 52 | 53 | /// An implementation of sklearn.naive_bayes.BernoulliNB 54 | /// --------------- 55 | /// 56 | /// https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.BernoulliNB.html 57 | class BernoulliNB extends Classifier { 58 | List priors; 59 | List> negProbs; 60 | List> delProbes; 61 | List classes; 62 | 63 | /// To manually instantiate the GaussianNB. The parameters 64 | /// are lifted directly from scikit-learn. 65 | /// See the attributes here: 66 | /// https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.BernoulliNB.html 67 | BernoulliNB(this.priors, this.negProbs, this.delProbes, this.classes); 68 | 69 | factory BernoulliNB.fromMap(Map params) { 70 | return BernoulliNB( 71 | List.from(params["class_log_prior_"]), 72 | List>.from(params["neg_prob_"]), 73 | List>.from(params["delta_probs_"]), 74 | List.from(params["classes_"])); 75 | } 76 | 77 | /// Implementation of sklearn.nayve_bayes.BernoulliNB.predict. 78 | @override 79 | int predict(List X) { 80 | int nClasses = classes.length; 81 | int nFeatures = delProbes.length; 82 | 83 | var jll = List.generate(nClasses, (index) => index.toDouble()); 84 | for (int i = 0; i < nClasses; i++) { 85 | double sum = 0.0; 86 | for (int j = 0; j < nFeatures; j++) { 87 | sum += X[i] * delProbes[j][i]; 88 | } 89 | jll[i] = sum; 90 | } 91 | for (int i = 0; i < nClasses; i++) { 92 | double sum = 0.0; 93 | for (int j = 0; j < nFeatures; j++) { 94 | sum += negProbs[i][j]; 95 | } 96 | jll[i] += priors[i] + sum; 97 | } 98 | var idx = 0; 99 | 100 | classes.asMap().forEach((i, v) => idx = jll[i] > jll[idx] ? i : idx); 101 | return classes[idx]; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/neighbors/neighbors.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:sklite/base.dart'; 3 | import 'package:sklite/utils/mathutils.dart'; 4 | 5 | /// Makes life easier. 6 | class Neighbor { 7 | int cls; 8 | double dist; 9 | 10 | Neighbor(this.cls, this.dist); 11 | } 12 | 13 | /// An implementation of sklearn.neighbors.KNeighborsClassifier 14 | /// --------------- 15 | /// 16 | /// https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html 17 | class KNeighborsClassifier extends Classifier { 18 | List> fitX; 19 | List fitY; 20 | List classes; 21 | int nNeighbors; 22 | int p; 23 | 24 | /// To manually instantiate the KNeighborsClassifier. The parameters 25 | /// are lifted directly from scikit-learn. 26 | /// See the attributes here: 27 | /// https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KNeighborsClassifier.html 28 | KNeighborsClassifier( 29 | this.fitX, this.fitY, this.nNeighbors, this.p, this.classes); 30 | 31 | factory KNeighborsClassifier.fromMap(Map params) { 32 | return KNeighborsClassifier( 33 | List>.from(params["_fit_X"]), 34 | List.from(params["_y"]), 35 | params["n_neighbors"], 36 | params["p"], 37 | List.from(params["classes_"])); 38 | } 39 | 40 | double cmp(List temp, List cand, int q) { 41 | double dist = 0.0; 42 | double diff = 0.0; 43 | for (int i = 0; i < temp.length; i++) { 44 | diff = (temp[i] - cand[i]).abs(); 45 | if (q == 1) 46 | dist += diff; 47 | else if (q == 2) 48 | dist += diff * diff; 49 | else if (q == INFINITY && diff > dist) 50 | dist = diff; 51 | else 52 | dist += pow(diff, q); 53 | } 54 | if (q == 1 || q == INFINITY) 55 | return dist; 56 | else if (q == 2) return sqrt(dist); 57 | return pow(dist, 1.0 / q).toDouble(); 58 | } 59 | 60 | /// Implementation of sklearn.neghbors.KNeighborsClassifier.predict. 61 | @override 62 | int predict(List X) { 63 | if (nNeighbors == 1) { 64 | int idx = 0; 65 | double minDist = INFINITY; 66 | double curDist; 67 | for (int i = 0; i < fitY.length; i++) { 68 | curDist = cmp(fitX[i], X, p); 69 | if (curDist <= minDist) { 70 | minDist = curDist; 71 | idx = fitY[i]; 72 | } 73 | } 74 | return classes[idx]; 75 | } 76 | var compute = List.filled(classes.length, 0); 77 | var dists = []; 78 | fitY.asMap().forEach((i, v) => dists.add(Neighbor(v, cmp(fitX[i], X, p)))); 79 | dists.sort((a, b) => a.dist.compareTo(b.dist)); 80 | classes.asMap().forEach((i, v) => compute[dists[i].cls]++); 81 | 82 | return classes[argmax(compute)]; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/neural_network/neural_network.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'package:sklite/utils/mathutils.dart' as mathutils; 3 | import 'package:sklite/base.dart'; 4 | import 'package:sklite/utils/exceptions.dart'; 5 | 6 | /// An implementation of sklearn.neural_network.MLPClassifier 7 | /// --------------- 8 | /// 9 | /// https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html 10 | class MLPClassifier extends Classifier { 11 | List layers; 12 | List> coefs; 13 | List> intercepts; 14 | List classes; 15 | String activation; 16 | String outActivation; 17 | final List _activations = ["logistic", "relu", "tanh", "softmax"]; 18 | 19 | /// To manually instantiate the MLPClassifier. The parameters 20 | /// are lifted directly from scikit-learn. 21 | /// See the attributes here: 22 | /// https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html 23 | MLPClassifier(this.layers, this.coefs, this.intercepts, this.classes, 24 | this.activation, this.outActivation); 25 | 26 | factory MLPClassifier.fromMap(Map params) { 27 | return MLPClassifier( 28 | List.from(params["layers"]), 29 | List>.from(params["coefs_"]), 30 | List>.from(params["intercepts_"]), 31 | List.from(params["classes"]), 32 | params["activation"], 33 | params["out_activation"]); 34 | } 35 | 36 | /// Logistic activation function: 37 | /// --------------- 38 | /// 39 | /// f(x) = 1 / (1 + exp(-x)) 40 | List logistic(List val) { 41 | val.asMap().forEach((i, v) => val[i] = 1.0 / (1.0 + exp(-val[i]))); 42 | return val; 43 | } 44 | 45 | /// Rectified Linear unit activation function: 46 | /// -------------- 47 | /// 48 | /// f(x) = max(0, x) 49 | List relu(List val) { 50 | val.asMap().forEach((i, v) => val[i] = max(0, val[i])); 51 | return val; 52 | } 53 | 54 | /// Hyperbolic tangent activation function: 55 | /// -------------- 56 | /// 57 | /// f(x) = tanh(x) 58 | List tanh(List val) { 59 | val.asMap().forEach((i, v) => val[i] = mathutils.tanh(val[i])); 60 | return val; 61 | } 62 | 63 | /// Softmax activation function: 64 | /// --------------- 65 | /// 66 | /// \text{Softmax}(x_{i}) = \frac{\exp(x_i)}{\sum_j \exp(x_j)} 67 | /// LaTeX in the absence of a better way to express it... 68 | List softmax(List val) { 69 | double max = mathutils.NEGATIVE_INFINITY; 70 | double sum = 0.0; 71 | val.asMap().forEach((i, v) => max = val[i] > max ? val[i] : max); 72 | val.asMap().forEach((i, v) => val[i] = exp(val[i] - max)); 73 | val.asMap().forEach((i, v) => sum += val[i]); 74 | val.asMap().forEach((i, v) => val[i] /= sum); 75 | return val; 76 | } 77 | 78 | /// No-op activation function 79 | /// --------------- 80 | /// 81 | /// f(x) = x 82 | List identity(List val) { 83 | return val; 84 | } 85 | 86 | /// Serves as a getter function for all the activation functions, 87 | /// as [val] being a list of doubles(within a layer of the network. 88 | /// [activationType] points to which activation to be used, 89 | /// using the activation from the constructor by default. 90 | List _activation(List val, [String? activationType]) { 91 | activationType ??= activation; 92 | if (activationType == "logistix") return logistic(val); 93 | if (activationType == "relu") return relu(val); 94 | if (activationType == "tanh") return tanh(val); 95 | if (activationType == "softmax") return softmax(val); 96 | if (activationType == "identity") return identity(val); 97 | throw InvalidActivationException( 98 | "Invalid $activationType activation used, supported are ${_activations.join(", ")}."); 99 | } 100 | 101 | /// Implementation of sklearn.neural_network.MLPClassifier.predict. 102 | @override 103 | int predict(List X) { 104 | List> network = [X, [], []]; 105 | layers.asMap().forEach( 106 | (i, v) => network[i + 1] = List.filled(layers[i], 0.0)); 107 | for (int i = 0; i < network.length - 1; i++) { 108 | for (int j = 0; j < network[i + 1].length; j++) { 109 | network[i + 1][j] = intercepts[i][j]; 110 | network[i].asMap().forEach( 111 | (l, v) => network[i + 1][j] += network[i][l] * coefs[i][l][j]); 112 | } 113 | if ((i + 1) < (network.length - 1)) { 114 | network[i + 1] = _activation(network[i + 1]); 115 | } 116 | } 117 | network[network.length - 1] = 118 | _activation(network[network.length - 1], outActivation); 119 | 120 | if (network[network.length - 1].length == 1) { 121 | if (network[network.length - 1][0] > 0.5) { 122 | return classes[1]; 123 | } 124 | return classes[0]; 125 | } 126 | 127 | return classes[mathutils.argmax(network[network.length - 1])]; 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /lib/pipeline/pipeline.dart: -------------------------------------------------------------------------------- 1 | /// @TODO 2 | class Pipeline { 3 | 4 | } -------------------------------------------------------------------------------- /lib/tree/tree.dart: -------------------------------------------------------------------------------- 1 | import 'package:sklite/base.dart'; 2 | import 'package:sklite/utils/mathutils.dart'; 3 | 4 | /// An implementation of sklearn.tree.DecisionTreeClassifier. 5 | /// --------------- 6 | /// 7 | /// https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html 8 | class DecisionTreeClassifier extends Classifier { 9 | List childrenLeft; 10 | List childrenRight; 11 | List threshold; 12 | List features; 13 | List> values; 14 | List classes; 15 | 16 | /// To manually instantiate the DecisionTreeClassifier. The parameters 17 | /// are lifted directly from scikit-learn. 18 | /// See the attributes here: 19 | /// https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html 20 | DecisionTreeClassifier(this.childrenLeft, this.childrenRight, this.threshold, 21 | this.features, this.values, this.classes); 22 | 23 | factory DecisionTreeClassifier.fromMap(Map params) { 24 | return DecisionTreeClassifier( 25 | List.from(params["children_left"]), 26 | List.from(params["children_right"]), 27 | List.from(params["threshold"]), 28 | List.from(params["feature"]), 29 | List>.from(params["value"]), 30 | List.from(params["classes"] ?? [])); 31 | } 32 | 33 | /// Implementation of sklearn.tree.DecisionTreeClassifier.predict. 34 | @override 35 | int predict(List X) { 36 | return _predict(X); 37 | } 38 | 39 | int _predict(List X, [int? node]) { 40 | node ??= 0; 41 | if (threshold[node] != -2) { 42 | if (X[features[node]] <= threshold[node]) 43 | return _predict(X, childrenLeft[node]); 44 | return _predict(X, childrenRight[node]); 45 | } 46 | return classes[argmax(List.from(values[node]))]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/utils/exceptions.dart: -------------------------------------------------------------------------------- 1 | class InvalidSVMKernelException implements Exception { 2 | String cause; 3 | 4 | InvalidSVMKernelException(this.cause) { 5 | print(cause); 6 | } 7 | } 8 | 9 | class InvalidActivationException implements Exception { 10 | String cause; 11 | 12 | InvalidActivationException(this.cause) { 13 | print(cause); 14 | } 15 | } 16 | 17 | class InvalidLoggingLevelException implements Exception { 18 | String cause; 19 | 20 | InvalidLoggingLevelException(this.cause) { 21 | print(cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/utils/io.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'dart:convert'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart' show rootBundle; 5 | 6 | /// For development only. 7 | String readFile(String path){ 8 | return File(path).readAsStringSync(); 9 | } 10 | 11 | /// For development only. 12 | Map readJsonFile(String path) { 13 | return json.decode(readFile(path)); 14 | } 15 | 16 | Future loadModelContext(BuildContext context, String path) async { 17 | return await DefaultAssetBundle.of(context) 18 | .loadString(path); 19 | } 20 | 21 | Future loadModel(String path) async { 22 | return await rootBundle.loadString(path); 23 | } -------------------------------------------------------------------------------- /lib/utils/mathutils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | const double INFINITY = 1.0 / 0.0; 4 | const double NEGATIVE_INFINITY = INFINITY * -1; 5 | 6 | int argmax(List X) { 7 | int idx = 0; 8 | int l = X.length; 9 | for (int i = 0; i < l; i++) { 10 | idx = X[i] > X[idx] ? i : idx; 11 | } 12 | return idx; 13 | } 14 | 15 | /// Oddly enough dart does not have hyperbolic 16 | /// functions built-in (yet?). 17 | double tanh(double X) { 18 | return -1.0 + 2.0 / (1 + pow(e, (-2 * X))); 19 | } 20 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.9.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.1.0" 18 | characters: 19 | dependency: transitive 20 | description: 21 | name: characters 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.2.1" 25 | clock: 26 | dependency: transitive 27 | description: 28 | name: clock 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.1.1" 32 | collection: 33 | dependency: transitive 34 | description: 35 | name: collection 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "1.16.0" 39 | fake_async: 40 | dependency: transitive 41 | description: 42 | name: fake_async 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "1.3.1" 46 | flutter: 47 | dependency: "direct main" 48 | description: flutter 49 | source: sdk 50 | version: "0.0.0" 51 | flutter_test: 52 | dependency: "direct dev" 53 | description: flutter 54 | source: sdk 55 | version: "0.0.0" 56 | matcher: 57 | dependency: transitive 58 | description: 59 | name: matcher 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "0.12.12" 63 | material_color_utilities: 64 | dependency: transitive 65 | description: 66 | name: material_color_utilities 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "0.1.5" 70 | meta: 71 | dependency: transitive 72 | description: 73 | name: meta 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "1.8.0" 77 | path: 78 | dependency: transitive 79 | description: 80 | name: path 81 | url: "https://pub.dartlang.org" 82 | source: hosted 83 | version: "1.8.2" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.9.0" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "1.10.0" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "2.1.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.1.1" 117 | term_glyph: 118 | dependency: transitive 119 | description: 120 | name: term_glyph 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "1.2.1" 124 | test_api: 125 | dependency: transitive 126 | description: 127 | name: test_api 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "0.4.12" 131 | vector_math: 132 | dependency: transitive 133 | description: 134 | name: vector_math 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.1.2" 138 | sdks: 139 | dart: ">=2.17.0-0 <3.0.0" 140 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sklite 2 | description: Porting Scikit-Learn models to Flutter 3 | version: 1.0.0 4 | homepage: https://github.com/axegon/SkLite-dart 5 | 6 | environment: 7 | sdk: ">=2.12.0 <3.0.0" 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | 13 | dev_dependencies: 14 | flutter_test: 15 | sdk: flutter 16 | 17 | # For information on the generic Dart part of this file, see the 18 | # following page: https://dart.dev/tools/pub/pubspec 19 | 20 | # The following section is specific to Flutter. 21 | flutter: 22 | 23 | # To add assets to your package, add an assets section, like this: 24 | # assets: 25 | # - images/a_dot_burr.jpeg 26 | # - images/a_dot_ham.jpeg 27 | # 28 | # For details regarding assets in packages, see 29 | # https://flutter.dev/assets-and-images/#from-packages 30 | # 31 | # An image asset can refer to one or more resolution-specific "variants", see 32 | # https://flutter.dev/assets-and-images/#resolution-aware. 33 | 34 | # To add custom fonts to your package, add a fonts section here, 35 | # in this "flutter" section. Each entry in this list should have a 36 | # "family" key with the font family name, and a "fonts" key with a 37 | # list giving the asset and other descriptors for the font. For 38 | # example: 39 | # fonts: 40 | # - family: Schyler 41 | # fonts: 42 | # - asset: fonts/Schyler-Regular.ttf 43 | # - asset: fonts/Schyler-Italic.ttf 44 | # style: italic 45 | # - family: Trajan Pro 46 | # fonts: 47 | # - asset: fonts/TrajanPro.ttf 48 | # - asset: fonts/TrajanPro_Bold.ttf 49 | # weight: 700 50 | # 51 | # For details regarding fonts in packages, see 52 | # https://flutter.dev/custom-fonts/#from-packages 53 | -------------------------------------------------------------------------------- /test/sklite_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | /// @TODO! 4 | void main() {} 5 | --------------------------------------------------------------------------------