[QCon 2019] Learning From Machines

Speaker: Ashi Krishnan @rakshesha

For other QCon blog posts, see QCon live blog table of contents

http://lfm.ashi.io

Note: this is not as good as my usual blog posts as far as capturing information. See the impressions section at the bottom for why.

General

  • Neural network
  • Gradient system
  • Eyes see using layers
  • Each neuron has a receptive field
  • Inception – one pass from beginning to end
  • Neural networks – reinforce
  • Movement affects brain
  • Neural networks can recognize when something is off about the input
  • Recognition can have same problems as optical illusions

Dreams

  • Algorithm can generate fake human photos
  • Trained with two classes – real and fake
  • Generator being fed noise

Latency

  • Efference – signal to brain
  • Predict how body’s state will change
  • Signals have latency (10ms)
  • Use prediction for smooth moments and to anticipate touch
  • This is why cerebellum damage makes jerky movements

My impressions

I’m really sensitive to visual distraction. Which meant I had trouble paying attention to the beginning concepts with all the flashing and zooming images. I also felt a little dizzy with the sustained zooming and had to close my eyes at a few points. (It’s not easy to trigger even mild motion sickness on a screen that size) There was a disclaimer up front.. But it definitely impacted my learning anything. During the calm parts, even the lower right changed from her twitter handle to website periodically (on the same slide). This meant I was continually drawn to that over the material. This became a negative feedback loop because I didn’t hear/retain key definitions up front and had to google. Which meant I missed more. It wasn’t just the beginning. The movement throughout made me struggle. I know the movement was reinforcing key points. It didn’t for me. The parts that I was able to follow were good so I feel like I missed out.

Live blogging from QCon 2019

It’s my first time live blogging since we upgraded the blog software. Fingers crossed I can keep up!

Before I get to the blog, I became a Java Champion on Tuesday morning. Wes announced it right before I announced my track. It was awesome!

Stats and Impressions

  • 145 speakers
  • Over 1000 attendee
  • 25 minute breaks for hallway track
  • Love the badges emphasizing first names

Monday

Tuesday

Wednesday

DevNexus 2019 – Alternatives to Java Reflection and Unsafe Usage – Chandra Guntur

See the table of contents for my other blog posts from the conference

This presentation is a lot of live coding with this kata.

JSR 292

  • Multi Language VM proposed in 2016
  • Code named Da Vinci Machine project
  • Gained ability to change classes and methods at runtime

Issues with reflection

  • Performance overhead
  • Security restrictions
  • Exposes internals – breaks abstractions and encapsulation

Method handle

  • Goal is to make as fast as a statically linked Java call
  • Mainly same since Java 7
  • More verbose than reflection
  • Performance benefit because only checks accessibility the first time you use it
  • Main APIs:
    • MethodHandles.Lookup – searches for a method handle
    • MethodHandle – execution logic
    • MethodType – represents return type and input parameters of a method. Immutable

Katas

  • Call constructor using a method handle
    • MethodHandles.publicLookup() – gives a loop reference
    • MethodType.methodType(void.class) – constructors don’t have return types so void
    • lookup.findConstructor(DemoClass.class, methodType) – actually get the MethodHandle
    • handle.invokeExact() – invoke method (well, constructor) with no parameters. Need to cast result so correct type.
  • Pass in parameters
    • handle.invokeExact(“paramValue”) – note that the parameters are bound at runtime. If call with wrong params, get runtime exception
  • Call a public method
    • MethodType.methodType(String.class, String.class) – a method that takes a string and returns a string
    • lookup.findVirtual(DemoClass.class, “methodName”, methodType) – call public method with findVirtual
    • handle.invoke(demoClass, “param”)
  • Call a private method (protected and package private work the same way)
    • DemoClass.class.getDeclaredMethod(“name”, String.class)
    • privateMethod.setAccessible(true) – just like with reflection
    • lookup.unreflect(method) – creates lightweight version
    • handle.invoke(demoClass, “param”)

VarHandle

  • Unsafe still deprecated (but not removed) in Java 12
  • VarHandle replaces Unsafe in many cases
  • Standard replacement for some features for atomic concurrency and Unsafe
  • Can use to access field/array index elements
  • Memory fences for fine grained control of memory ordering
  • A strong readability fence
  • Improves safety – requires content types to match/be castable. Also requires array indexes to exist
  • Improves integrity – Follows field access rules including honoring final
  • Performance equivalent to Unsafe
  • API more usable than Unsafe because intended to be an API
  • Uses coordinates since fields are referenced by name.

My take

I like reflection so this was a good opportunity to learn about it’s “successor”. I enjoyed seeing the live coding. In addition to Method Handles code, it was nice to see the callouts to some IntelliJ features. Chandra did a kata on VarHandles. I didn’t take notes on that since I was reviewing my presentation which is next.