sklite

Creator: coderz1093

Last updated:

0 purchases

TODO
Add to Cart

Description:

sklite

SkLite-dart #


Porting Scikit-Learn models to Flutter *

Getting Started #
The library uses pre-trained models using scikit-learn and 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:
You need to setup a local static directory where you can store the generated JSON file using sklite.
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
loadModel in utils/dart.io for your application, the other functions are for development and testing only.
Supported models #



IMPLEMENTATION
STATUS




KNeighborsClassifier



SVC



GaussianProcessClassifier



DecisionTreeClassifier



RandomForestClassifier



MLPClassifier



AdaBoostClassifier



GaussianNB



QuadraticDiscriminantAnalysis



BernoulliNB



LinearSVC




Usage #
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).
dependencies:
sklite: ^0.0.1
copied to clipboard
Add a static assets directory inside your Flutter project:
flutter:
uses-material-design: true
assets:
- assets/
copied to clipboard
Put the generated model using sklite for python in the specified directory
Import the library in your application and load the model:
import 'package:flutter/material.dart';
import 'package:sklite/SVM/SVM.dart';
import 'package:sklite/utils/io.dart';
import 'dart:convert';

void main() => runApp(new MaterialApp(
home: new HomePage(),
debugShowCheckedModeBanner: false)
);

class HomePage extends StatefulWidget {
@override
_HomePageState createState() {
return new _HomePageState();
}
}

class _HomePageState extends State<HomePage> {
SVC svc;

_HomePageState() {
loadModel("assets/svcmnist.json").then((x) {
this.svc = SVC.fromMap(json.decode(x));
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
// add any widget with svc.predict() callback
);
}
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.