public final class CLI extends Object
A basic command-line interface to the Java client. It is run like so:
java -jar myrrix-client-X.Y.jar [options] command [arg0 arg1 ...]
"options" are flags, most of which configure an instance of MyrrixClientConfiguration:
--host: sets MyrrixClientConfiguration.getHost()--port: sets MyrrixClientConfiguration.getPort()--secure: sets MyrrixClientConfiguration.isSecure()--contextPath: sets MyrrixClientConfiguration.getContextPath()--userName: sets MyrrixClientConfiguration.setUserName(String)--password: sets MyrrixClientConfiguration.setPassword(String)--keystoreFile: sets MyrrixClientConfiguration.setKeystoreFile(File)--keystorePassword: sets MyrrixClientConfiguration.setKeystorePassword(String)--allPartitions: sets MyrrixClientConfiguration.setAllPartitionsSpecification(String)"options" may include a few additional flags:
--translateItem [file]: Sets the client to use String item IDs instead of numeric, and to translate
to/from numeric item IDs when contacting the server. This may be used to avoid sending sensitive IDs to
an external server, while still using them locally for convenience. The optional file argument names
a file containing all known item IDs. This is needed so that the client can reverse translate any
value from the server. "file" may be set to "oneWay" to only translate the item IDs and not build
a dictionary from known items; this is faster for clients that only write, such as a command-line invocation
to just ingest a file.--translateUser: Same as above, but controls translating user IDs. Since they need never be
translated back, no list of values is required.--verbose: log more messages to standard outFinally "options" may also include a few optional arguments which affect the results of some of the commands:
--howMany: how many items to return from commands like recommend or
mostSimilarItems. Optional.--considerKnownItems: in recommend, allow items that the user is already connected to
to be returned in results. Optional.--rescorerParams: Specifies one argument to be sent with the requests, to be passed to the
server's RescorerProvider as a rescorerParams argument. Optional, may be repeated.--contextUserID: in mostSimilarItems or recommendToAnonymous, supplies the
user for which the request is made, which is used only for proper routing. Optional."command" may be any value of CLICommand, in lower case if you like; "estimatePreference" and
"recommend" are valid values for example. These correspond to the methods of
MyrrixRecommender
The remaining arguments are arguments to the method named by command, and are likewise analogous to the
method arguments seen in MyrrixRecommender, where some arguments are taken from
command line flags like --howMany above:
setPreference userID itemID [value]removePreference userID itemIDsetUserTag userID tag [value]setItemTag tag itemID [value]ingest csvFile [csvFile2 ...]estimatePreference userID itemID0 [itemID1 itemID2 ...]estimateForAnonymous toItemID [itemID0 itemID1 ...]recommend userIDrecommendToAnonymous itemID0 [itemID1 itemID2 ...]recommendToMany userID0 [userID1 userID2 ...]mostPopularItemsmostSimilarItems itemID0 [itemID1 itemID2 ...]similarityToItem toItemID itemID0 [itemID1 itemID2 ...]recommendedBecause userID itemIDrefreshisReadygetAllUserIDsgetAllItemIDsgetNumUserClustersgetNumItemClustersgetUserCluster ngetItemCluster nNote: since some arguments like IDs can be negative, and begin with "-", they are mistakenly interpreted
as flags by the command line parser. Double-quote such values. Note further than in command-line shells like
bash, the double-quote is parsed by the shell, and so must be escaped. To specify the value
-100 for example, write \"-100\".
Methods that return void in MyrrixRecommender produce no output. Methods
like MyrrixRecommender.estimatePreference(long, long) that return a single value
have this written to a single line of output. Methods like
MyrrixRecommender.recommend(long, int) that return a series of values are output in
CSV format.
For example, to make 3 recommendations for user 35, one might run:
java -jar myrrix-client-X.Y.jar --host example.com --howMany 3 recommend 35
... and output might be:
352352, 0.559
9898,0.4034
209,0.03339
If using string IDs, it might look more like:
java -jar myrrix-client-X.Y.jar --host example.com
--translateUser --translateItem ids.txt --howMany 3 recommend Jane
... and output might be:
Apple, 0.559
Orange,0.4034
Banana,0.03339
Copyright © 2012-2013 Myrrix Ltd. All Rights Reserved.