Code Monkey home page Code Monkey logo

Comments (3)

beniz avatar beniz commented on May 13, 2024

Full example using the 'Mushroom' dataset from UCI, https://archive.ics.uci.edu/ml/datasets/Mushroom

./dede
  • create service:
curl -X PUT "http://localhost:8080/services/mush" -d "{\"mllib\":\"caffe\",\"description\":\"mushroom classification service\",\"type\":\"supervised\",\"parameters\":{\"input\":{\"connector\":\"csv\"},\"mllib\":{\"template\":\"mlp\",\"nclasses\":2,\"layers\":[150],\"activation\":\"relu\"}},\"model\":{\"templates\":\"../templates/caffe/\",\"repository\":\"models/mush\"}}"
  • train:
curl -X POST "http://localhost:8080/train" -d "{\"service\":\"mush\",\"async\":false,\"parameters\":{\"mllib\":{\"gpu\":true,\"solver\":{\"iterations\":2000,\"test_interval\":100,\"base_lr\":0.001},\"net\":{\"batch_size\":100}},\"input\":{\"label\":\"target\",\"separator\":\",\",\"shuffle\":false,\"test_split\":0.3,\"categoricals\":[\"target\",\"cap-shape\",\"cap-surface\",\"cap-color\",\"bruises\",\"odor\",\"gill-attachment\",\"gill-spacing\",\"gill-size\",\"gill-color\",\"stalk-shape\",\"stalk-root\",\"stalk-surface-above-ring\",\"stalk-surface-below-ring\",\"stalk-color-above-ring\",\"stalk-color-below-ring\",\"veil-type\",\"veil-color\",\"ring-number\",\"ring-type\",\"spore-print-color\",\"population\",\"habitat\"]},\"output\":{\"measure\":[\"acc\",\"mcll\",\"f1\"]}},\"data\":[\"mushroom/agaricus-lepiota.csv\"]}"
  • output with the categorical mapping returned:
{"status":{"code":201,"msg":"Created"},"body":{"measure":{"train_loss":0.007734924554824829,"mcll":0.08348360938530394,"recall":0.9775417026065463,"iteration":1999.0,"precision":0.9764967535855482,"f1":0.977018948695595,"accp":0.9827727645611156,"acc":0.9827727645611156},"parameters":{"mllib":{"batch_size":2},"input":{"categoricals_mapping":{"bruises":{"t":0,"f":1},"cap-color":{"n":0,"y":1,"p":5,"c":8,"r":9,"w":2,"g":3,"e":4,"b":6,"u":7},"ring-number":{"o":0,"t":1,"n":2},"odor":{"p":0,"c":5,"y":6,"s":7,"a":1,"l":2,"n":3,"f":4,"m":8},"stalk-shape":{"e":0,"t":1},"stalk-surface-above-ring":{"s":0,"y":3,"f":1,"k":2},"gill-size":{"n":0,"b":1},"veil-type":{"p":0},"ring-type":{"p":0,"e":1,"l":2,"f":3,"n":4},"spore-print-color":{"k":0,"n":1,"u":2,"h":3,"w":4,"r":5,"y":7,"o":6,"b":8},"gill-color":{"b":8,"e":7,"o":11,"k":0,"n":1,"y":10,"g":2,"r":9,"w":4,"p":3,"h":5,"u":6},"gill-spacing":{"c":0,"w":1},"habitat":{"u":0,"d":3,"l":6,"g":1,"m":2,"p":4,"w":5},"cap-surface":{"s":0,"y":1,"f":2,"g":3},"gill-attachment":{"f":0,"a":1},"cap-shape":{"x":0,"s":2,"c":5,"b":1,"f":3,"k":4},"target":{"p":0,"e":1},"stalk-root":{"e":0,"b":2,"c":1,"r":3,"?":4},"stalk-surface-below-ring":{"s":0,"y":2,"f":1,"k":3},"veil-color":{"w":0,"n":1,"o":2,"y":3},"population":{"s":0,"y":4,"c":5,"n":1,"a":2,"v":3},"stalk-color-above-ring":{"w":0,"g":1,"p":2,"c":7,"y":8,"n":3,"b":4,"e":5,"o":6},"stalk-color-below-ring":{"w":0,"p":1,"y":6,"c":8,"g":2,"b":3,"e":5,"n":4,"o":7}},"connector":"csv"}}},"head":{"method":"/train","time":5.0}}

This yields 98.2% accuracy after 5 seconds training (2000 iterations)

from deepdetect.

beniz avatar beniz commented on May 13, 2024

API documentation has been updated, http://www.deepdetect.com/api/#input-connectors

from deepdetect.

beniz avatar beniz commented on May 13, 2024

A mixed continuous / categorical example from UCI, https://archive.ics.uci.edu/ml/datasets/Adult

./dede
  • create service
curl -X PUT "http://localhost:8080/services/adult" -d "{\"mllib\":\"caffe\",\"description\":\"revenue classification service\",\"type\":\"supervised\",\"parameters\":{\"input\":{\"connector\":\"csv\"},\"mllib\":{\"template\":\"mlp\",\"nclasses\":2,\"layers\":[150,150,150],\"activation\":\"relu\"}},\"model\":{\"templates\":\"../templates/caffe/\",\"repository\":\"models/adult\"}}"
  • train
curl -X POST "http://localhost:8080/train" -d "{\"service\":\"adult\",\"async\":false,\"parameters\":{\"mllib\":{\"gpu\":true,\"solver\":{\"iterations\":10000,\"test_interval\":100,\"base_lr\":0.0001},\"net\":{\"batch_size\":500}},\"input\":{\"label\":\"revenue\",\"separator\":\",\",\"shuffle\":true,\"test_split\":0.3,\"scale\":true,\"categoricals\":[\"workclass\",\"education\",\"marital-status\",\"occupation\",\"relationship\",\"race\",\"sex\",\"native-country\",\"revenue\"]},\"output\":{\"measure\":[\"acc\",\"mcll\",\"f1\",\"auc\"]}},\"data\":[\"adult/adult.csv\"]}
  • output
{"status":{"code":201,"msg":"Created"},"body":{"measure":{"train_loss":0.21903283894062043,"mcll":0.16116428812146675,"recall":0.47399938581177805,"iteration":9999.0,"precision":0.49999999999946007,"accp":0.9479987716245266,"acc":0.9479987716245266,"f1":0.48665265370416529,"auc":0.9263255358386324},"parameters":{"mllib":{"batch_size":518},"input":{"categoricals_mapping":{"workclass":{"State-gov":0,"Self-emp-not-inc":1,"Private":2,"Without-pay":7,"Federal-gov":3,"Never-worked":8,"Local-gov":4,"?":5,"Self-emp-inc":6},"occupation":{"Machine-op-inspct":9,"Farming-fishing":8,"Craft-repair":6,"Transport-moving":7,"Other-service":4,"Priv-house-serv":14,"Handlers-cleaners":2,"Armed-Forces":13,"Protective-serv":12,"Tech-support":10,"Exec-managerial":1,"?":11,"Adm-clerical":0,"Sales":5,"Prof-specialty":3},"education":{"Doctorate":9,"7th-8th":8,"Some-college":5,"9th":4,"Masters":3,"Assoc-voc":7,"12th":15,"HS-grad":1,"1st-4th":13,"Prof-school":10,"5th-6th":11,"10th":12,"Bachelors":0,"Assoc-acdm":6,"Preschool":14,"11th":2},"marital-status":{"Never-married":0,"Married-civ-spouse":1,"Separated":4,"Divorced":2,"Married-spouse-absent":3,"Married-AF-spouse":5,"Widowed":6},"relationship":{"Not-in-family":0,"Other-relative":5,"Husband":1,"Wife":2,"Own-child":3,"Unmarried":4},"race":{"White":0,"Black":1,"Amer-Indian-Eskimo":3,"Asian-Pac-Islander":2,"Other":4},"sex":{"Male":0,"Female":1},"native-country":{"Laos":20,"Germany":11,"Thailand":18,"Canada":10,"Poland":15,"Dominican-Republic":24,"Columbia":16,"Jamaica":2,"Japan":29,"Taiwan":21,"Cuba(reverse-i-search)`PUT': curl -X ^CT "http://localhost:8080/services/adult" -d "{\"mllib\":\"caffe\",\"description\":\"revenue classification service\",\"type\":\"supervised\",\"parameters\":{\"input\":{\"connector\":\"csv\"},\"mllib\":{\"template\":\"mlp\",\"nclasses\":2,\"layers\":[150,150,150],\"activation\":\"relu\"}},\"model\":{\"templates\":\"../templates/caffe/\",\"repository\":\"models/adult\"}}

The run reports an AUC of 0.926 over a random slice of 30% of the dataset.

from deepdetect.

Related Issues (20)

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.