Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jubaclient

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jubaclient

Jubatus CLI client (unofficial)

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

jubaclient

npm version Build Status Codacy Badge Codacy Badge

Jubatus CLI client (unofficial)

Quick Start

# startup jubaclassifier
# For example: 
#  $ docker pull jubatus/jubatus
#  $ docker run -d -p 9199:9199 jubatus/jubatus jubaclassifier -f /opt/jubatus/share/jubatus/example/config/classifier/pa.json

# installation
npm install -g jubaclient

# classifier#train()
echo '[ [ [ "baz", [ [ [ "foo", "bar" ] ] ] ] ] ]' \
| jubaclient classifier train

Requires

  • Node.js v6+

Installation

npm install -g jubaclient

Usage

jubaclient service method [-p port] [-h hostname] [-n name] [-t timeoutSeconds]

jubaclient -i [service] [method] [-p port] [-h hostname] [-n name] [-t timeoutSeconds]

jubaclient -v

The jubaclient command requests JSON received from standard input with the specified method to the Jubatus server, and returns the response to the standard output.

JSON passed to standard input is an array of method arguments.

  • For methods without arguments it is [].
  • If the method argument is a single string type, it should be like [ "foo" ].

Tips: JSON formatting is useful for the jq command.

The command line options are as follows:

  • service: sevice name (classifier, nearest_neighbor, etc.)
  • method: service method (get_status, train, get_k_center, etc.)
  • -p port : port number (default 9199)
  • -h hostname : hostname (default localhost)
  • -n name : name of target cluster (default '')
  • -t timeoutSeconds : timeout (default 0)
  • -i : interactive mode
  • -v : Print jubaclient's version.

Examples

  • #save(id)
    echo '[ "jubaclient_save_1" ]' | jubaclient classifier save 
    
  • #get_status()
    echo '[]' | jubaclient classifier get_status | jq '.' 
    
  • #get_config()
    echo '[]' | jubaclient classifier get_config | jq '.|fromjson' 
    
  • classifier#train(data)
    jubaclient classifier train <<EOF | jq '.'
    [ [ [ "corge", [ [ [ "message", "<p>foo</p>" ] ] ] ] ] ]
    [ [ [ "corge", [ [ [ "message", "<p>bar</p>" ] ] ] ] ] ]
    [ [ [ "corge", [ [ [ "message", "<p>baz</p>" ] ] ] ] ] ]
    [ [ [ "grault", [ [ [ "message", "<p>qux</p>" ] ] ] ] ] ]
    [ [ [ "grault", [ [ [ "message", "<p>quux</p>" ] ] ] ] ] ]
    EOF
    
  • classifier#classify(data)
    jubaclient classifier classify <<EOF | jq '.'
    [ [ [ [ [ "message", "<b>quuz</b>" ] ] ] ] ]
    EOF
    

Interactive mode

With the -i option, it will be in interactive mode. When choosing service and method, it provides keyword completion system. When you send Ctrl-C (SIGINT) you return to choosing the service and method, and sending Ctrl-D (EOT) will end the process.

Demonstration asciicast

Tutorial

Classifier

See also http://jubat.us/en/tutorial/classifier.html

  1. start jubaclassifier process.

    jubaclassifier -D --configpath gender.json 
    
  2. train

    cat train.csv \
    | jq -RcM 'split(",")|[[[.[0],[[["hair",.[1]],["top",.[2]],["bottom",.[3]]],[["height",(.[4]|tonumber)]]]]]]' \
    | jubaclient classifier train
    
  3. classify

    cat classify.csv \
    | jq -RcM 'split(",")|[[[[["hair",.[0]],["top",.[1]],["bottom",.[2]]],[["height",(.[3]|tonumber)]]]]]' \
    | jubaclient classifier classify \
    | jq '.[]|max_by(.[1])'
    

configure: gender.json

{
  "method": "AROW",
  "converter": {
    "num_filter_types": {}, "num_filter_rules": [],
    "string_filter_types": {}, "string_filter_rules": [],
    "num_types": {}, "num_rules": [],
    "string_types": {
      "unigram": { "method": "ngram", "char_num": "1" }
    },
    "string_rules": [
      { "key": "*", "type": "unigram", "sample_weight": "bin", "global_weight": "bin" }
    ]
  },
  "parameter": { "regularization_weight" : 1.0 }
}

training data: train.csv

male,short,sweater,jeans,1.70
female,long,shirt,skirt,1.56
male,short,jacket,chino,1.65
female,short,T shirt,jeans,1.72
male,long,T shirt,jeans,1.82
female,long,jacket,skirt,1.43

test data: classify.csv

short,T shirt,jeans,1.81
long,shirt,skirt,1.50

Demonstration asciicast

Keywords

FAQs

Package last updated on 27 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc