Code Monkey home page Code Monkey logo

skflow's Introduction

Scikit Flow

This is a simplified interface for TensorFlow, to get people started on predictive analytics and data mining.

Why TensorFlow?

  • TensorFlow provides a good backbone for building different shapes of machine learning applicaitons.
  • It will continue evolve both in distributed direction and as a general pipelininig machinery.

Why Scikit Flow?

  • To smooth the transition from Scikit Learn world of one-liner machine learning into more open world of building different shapes of ML models. You can start by using fit/predict and slide into TensorFlow APIs as you getting comfortable.
  • Provide a set of reference models, that would be easy to integrate with existing code.

Installation

First, make sure you have TensorFlow and Scikit Learn installed, then just run:

pip install git+git://github.com/google/skflow.git

Tutorial

Usage

Example usage:

Linear Classifier

Simple linear classification.

import skflow
from sklearn import datasets, metrics

iris = datasets.load_iris()
classifier = skflow.TensorFlowLinearClassifier(n_classes=3)
classifier.fit(iris.data, iris.target)
score = metrics.accuracy_score(classifier.predict(iris.data), iris.target)
print("Accuracy: ", score)

Deep Neural Network

Example of 3 layer network with 10, 20 and 10 hidden units respectively:

import skflow
from sklearn import datasets, metrics

iris = datasets.load_iris()
classifier = skflow.TensorFlowDNNClassifier(hidden_units=[10, 20, 10], n_classes=3)
classifier.fit(iris.data, iris.target)
score = accuracy_score(classifier.predict(iris.data), iris.target)
print("Accuracy: ", score)

Custom model

This is example of how to pass custom model to the TensorFlowEstimator

import skflow
from sklearn import datasets, metrics

iris = datasets.load_iris()

def my_model(X, y):
    """This is DNN with 10, 20, 10 hidden layers, and dropout of 0.5 probability."""
    layers = skflow.ops.dnn(X, [10, 20, 10], keep_prob=0.5)
    return skflow.ops.logistic_classifier(layers, y)

classifier = skflow.TensorFlowEstimator(model_fn=my_model, n_classes=3)
classifier.fit(iris.data, iris.target)
score = accuracy_score(classifier.predict(iris.data), iris.target)
print("Accuracy: ", score)

Coming soon

  • Easy way to handle categorical variables
  • Text categorization
  • Images (CNNs)
  • More & deeper

skflow's People

Contributors

ilblackdragon avatar

Watchers

James Cloos avatar Glenn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.