1 / 33

Pattern Analysis and Machine Intelligence

Pattern Analysis and Machine Intelligence. A web service perspective. Overview. Why? What are web services? How do we deploy them? Design Issues Examples Word recognition Checkers. Why?. Take re-use to new heights Risk-free evaluation Customer installs only an ultra-thin client

naeva
Download Presentation

Pattern Analysis and Machine Intelligence

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pattern Analysis and Machine Intelligence A web service perspective

  2. Overview • Why? • What are web services? • How do we deploy them? • Design Issues • Examples • Word recognition • Checkers

  3. Why? • Take re-use to new heights • Risk-free evaluation • Customer installs only an ultra-thin client • Service provider keeps valuable implementations on site • Customer subscribes to a service • Does not care how it is implemented • Implementations can be upgraded transparently • Quality of service can be monitored by service provider and customer

  4. Web Service • A contractually defined behaviour • Implemented in any way • Used in any way • Usage governed by contract • Just like Java interfaces, except • Language independent • Web based

  5. Web Services Client Application Service Implementation Language Specific Messages Language Neutral Messages Web Service

  6. Web Service Components Service Implementation Web Application Server (e.g. Tomcat) Service Proxy Client Service Listener

  7. Key Features • Language Neutral • Compositional • Should be able to construct more complex services from simpler ones • Configuration issues • Stateless versus state-based services

  8. Web Services and Distributed Computing • Simple model for distributed computing • Call by value only • No call-backs • No remote references (other than URIs)

  9. Hello SOAP World • Define this interface for Hello Service • Not necessary – but useful to decouple the service description from the implementation • Essential for Dynamic Proxy – see later package hello; public interface Hello { public String sayHelloTo(String name) }

  10. Implementing the Service • In this case, the service is very simple: package hello; public class HelloImpl { // just to notify when tomcat loads the class static { System.out.println("Loaded HelloImpl.class"); } public String sayHelloTo(String name) { System.out.println("sayHelloTo(String name)"); return "Hello " + name + ", How are you doing?"; } }

  11. DeploymentDescriptor.xml <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment" id="urn:Hello"> <isd:provider type="java" scope="Application" methods="sayHelloTo"> <isd:java class="hello.HelloImpl" static="false"/> </isd:provider> </isd:service>

  12. hello.ProxyClient.java package hello; import proxy.*; public class ProxyClient { public static void main(String[] args) throws Exception { Class[] interfaces = new Class[] {hello.Hello.class}; Hello hello = (Hello) Proxy.newInstance("urn:Hello",interfaces); System.out.println(hello.sayHelloTo("Simon")); } }

  13. Design Issues • Type mappings i.e. • How do we encode/decode objects • XML-RPC and SOAP provide standard type-mappings for various primitives, arrays and collections • User-defined classes are trickier! • Take care to preserve language independence!

  14. Example: Checkers Game Service • Service is to provide opponents to play checkers over the web • Client invokes service by sending player details • Service responds with details of opponent and the first move • Client then modifies a local copy of the board, makes a move and sends the move to the service • Repeat move exchange until game over

  15. Example: Move Encoding • Zero effort is to use JSX • Java serialization to XML • BUT: compromises language independence • Preferred solution: customized type mapping • Note the difference:

  16. Use Object Encoder via standard interface public static void main(String[] args) { SquareSequenceMove ssm = new SquareSequenceMove( new Square(0, 0), new Square(1, 1)); RemoteMoveRequest rmr = new RemoteMoveRequest( ssm, 2, false ); // XMLWriter out = new JSXWriter( // new PrintWriter( System.out ) ); XMLWriter out = new BoardWriter( new PrintWriter( System.out ) ); out.writeObject( rmr ); }

  17. JSX Move Encoding <games.board.RemoteMoveRequest requestTime="1016535860883" toPlay="2" maximize="false"> <games.board.SquareSequenceMove obj-name="move"> <java.util.Vector obj-name="squares"> <games.board.Square x="0" y="0"/> <games.board.Square x="1" y="1"/> </java.util.Vector> </games.board.SquareSequenceMove> </games.board.RemoteMoveRequest>

  18. Custom Move Encoding <RemoteMoveRequest> <toPlay> 2 </toPlay> <SquareSequenceMove> 0,0 1,1 </SquareSequenceMove> </RemoteMoveRequest>

  19. More Design Issues • Problem decomposition • What services do we provide? • How do we allow clients to configure services? • How best to store the state of a configured service?

  20. Pattern recognition servers • Reside at particular URLs • Can be trained on specified or supplied datasets • Can respond to recognition requests

  21. Example Request • Recognize this word: • Given the dictionary at: • http://ace.essex.ac.uk/viadocs/dic/pygenera.txt • And the OCR training set at: • http://ace.essex.ac.uk/algoval/ocr/viadocs1.xml • Respond with your 10 best word hypotheses

  22. 1. MELISSOBLAPTES2. ENDOMMMASIS3. HETEROGRAPHIS4. TRICHOBAPTES5. HETEROCHROSIS6. PHLOEOGRAPTIS7. HETEROCNEPHES8. DRESCOMPOSIS9. MESOGRAPHE10.DIPSOCHARES Example Response

  23. Issues • How general to make problem specs • Could set up separate problems for OCR and face recognition, or a single problem called ImageRecognition • How does the software effort scale?

  24. Evolving a Checkers Player • What services can we identify?

  25. Checkers Evolution Services • Game-playing • Service just provides an opponent • Low-level - still some work to do • Player evaluation • Client provides a player • Service evaluates quality of player

  26. Static evaluator evaluation public interface StaticEvaluator { public double evaluate( int[][] board ); } • How good is my static evaluator? • Very interesting! • Which service is best at evaluating my static evaluator? • Do the details of the Minimax algorithm (e.g. depth) affect the evaluation service?

  27. Other Evolutionary Services • Representational services: • Gene manipulation (mutation, crossover etc) • Phenotype mapping service • Creating evaluatable individuals from independently specified genomes • Algorithmic services • Random hill climber • ‘Standard’ GA • Guided local search?

  28. Example Code public Mutable search( Mutatable current, int maxEvals, FitnessEvaluator evaluator) { fitness = evaluator.fitness( ((IntArrayGenotype) current).getIntArray() ); for (int i=0; i<maxEvals-1; i++) { Mutable child = current.mutate(); double childFitness = evaluator.fitness( ((IntArrayGenotype) child).getIntArray() ); if ( childFitness > fitness ) { current = child; fitness = childFitness; } } return current; }

  29. Kernel Machines Kernel-based Classifier (e.g. SVM, RVM) Independent Web Services String Kernel

  30. Sample Results

  31. Software Scalability • Suppose we have: • A algorithms implemented in L languages • D datasets • P problems • E algorithm evaluators • How will our software effort scale with respect to these numbers?

  32. Service Messages • In practice, the normal request/response pattern may not be the best • Some services could be slow • Need intermediate messages • Reckon I’ll be another few minutes • Or immediate response of a job URI

  33. Conclusions • Excellent way to utilise networked computers for coarse-grained distributed computing • Imposes strict discipline • Main extra overhead is: • User-defined type-mappings (don’t always need these) • Configuring the service listeners • Deploying the service

More Related